Answer Posted / perfdev
TravelInsuranceQuoteTests --> BusinessLayer -->QuoteEngineTests.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using TravelInsuranceQuote.DataLayer;
using TravelInsuranceQuote.BusinessLayer;
namespace TravelInsuranceQuoteTests.BusinessLayer
{
[TestFixture]
public class QuoteEngineTests
{
[Test]
public void QuoteEngine_CanCreateObject()
{
var quoteEngine = new QuoteEngine();
Assert.That(quoteEngine, Is.Not.Null);
Assert.That(quoteEngine, Is.TypeOf<QuoteEngine>());
}
[Test]
public void GetBasePremium_ValidSingleTripType_ReturnsPremium()
{
var quoteEngine = new QuoteEngine();
var premium = quoteEngine.GetBasePremium(TripType.Single);
Assert.That(premium, Is.EqualTo(20.00));
}
[Test]
public void GetBasePremium_ValidAnnualTripType_ReturnsPremium()
{
var quoteEngine = new QuoteEngine();
var premium = quoteEngine.GetBasePremium(TripType.Annual);
Assert.That(premium, Is.EqualTo(80.00));
}
[Test]
public void GetAgeRating_ValidAgeRange_ReturnsRating()
{
var quoteEngine = new QuoteEngine();
var rating = quoteEngine.GetAgeRating(50);
Assert.That(rating, Is.EqualTo(1.2));
}
[Test]
public void GetAgeRating_HighAgeRange_ReturnsZero()
{
var quoteEngine = new QuoteEngine();
var rating = quoteEngine.GetAgeRating(90);
Assert.That(rating, Is.EqualTo(0));
}
[Test]
public void GetSexRating_InputFemale_ReturnsRating()
{
var quoteEngine = new QuoteEngine();
var rating = quoteEngine.GetSexRating(Sex.Female);
Assert.That(rating, Is.EqualTo(0.9));
}
[Test]
public void GetDestinationRating_InputWorlwide_ReturnsRating()
{
var quoteEngine = new QuoteEngine();
var rating = quoteEngine.GetDestinationRating(Destination.Worldwide);
Assert.That(rating, Is.EqualTo(1.4));
}
[Test]
public void GetTravelPeriodRating_InputValidDays_ReturnsRating()
{
var quoteEngine = new QuoteEngine();
var rating = quoteEngine.GetTravelPeriodRating(10);
Assert.That(rating, Is.EqualTo(0.9));
}
[Test]
public void GetUpdatedPremium_InputPremiumAndRate_ReturnsUpdatedPremiumAndDifference()
{
var quoteEngine = new QuoteEngine();
var updatedPremium = quoteEngine.GetUpdatedPremium(10.00, 2.0);
Assert.That(updatedPremium[0], Is.EqualTo(20.00));
Assert.That(updatedPremium[1], Is.EqualTo(10.00));
}
[Test]
public void GetPremium_InputCustomer_ReturnsCustomerPremium()
{
var quoteEngine = new QuoteEngine();
var customer = new Customer {
TripType = TripType.Single,
Age = 20,
Sex = Sex.Male,
Destination = Destination.Europe,
TravelPeriod = 1
};
string reason;
var customerPremium = quoteEngine.GetPremium(customer, out reason);
Assert.That(customerPremium.Base, Is.EqualTo(20.00));
Assert.That(customerPremium.Age[0], Is.EqualTo(20.00));
Assert.That(customerPremium.Sex[1], Is.EqualTo(4.00));
Assert.That(customerPremium.Destination[0], Is.EqualTo(24.00));
Assert.That(customerPremium.TravelPeriod[1], Is.EqualTo(-12.00));
Assert.That(customerPremium.Tax[0], Is.EqualTo(12.60));
Assert.That(customerPremium.Total, Is.EqualTo(12.60));
Assert.That(reason, Is.EqualTo(string.Empty));
}
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Plz sent me in .net 2.0 interview Question & answers?
Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming
How to create a new dataset only duplicate observations in proc sort procedure?
What is the entry point function of a DLL?
what is log files in qtp what is use
What are the tasks performed by a Team Lead
could u please also write an example of a code that involves instances from an abstract class just as u did for interfaces because u said it could also work which i really doubt. thanks
In loading programs into memory, what is the difference between load-time dynamic linking and run-time dynamic linking?
Q2. A memory location has physical address D5687h. Compute: a. The offset address if the segment number is D445h. b. The segment number if the offset address is B577h.
What binary value will be internally stored for NULL for the type S9(1) COMP 3 in mainframe
Is there any standard procedure to test the application as a whole? Or How can I test complete application right from the requirement gathering?
Can i please VHDL code for D-Latch with clear input ?? (HINT: Set up a “Process” with appropriate sensitivity list to get the desired D-Latch with Clr working.) Inputs and Outputs: entity Lab4b is Port ( Clr, Clk, D : in STD_LOGIC; Q : out STD_LOGIC); end Lab4b;
Given a set. Write the pseudo code to get all the subsets for the given set. Eg. Input : {1,2} Output : (),(1),(2),(1,2)
Tag for turning an image into a hyperlink is
along with oracle which language will be beneficial to have knowledge with,java,.net,since i m doing oracle have appeared for 8th sem BEIT,plz suggest