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
MOV.CB 007H,ADCON1 MOVE.CT 001H,_OPTION_REG_7 MOV.CB 007H,CMCON
Suppose server object is not loaded into the memory, and the client request for it , what will happen?
What is BASIS
Is anyone has done the ASP.NET MVC4 workshop course(2 days) from Peers Technologies. Let me know. I need to talk before joining ASP.NET MVC4 training at peers, Hyderabad.
How can we develop a multi-tier application in Java?
Write a program to swap the content of two variables without using a third variable.
how pseudo column works?
when we use mantis? how learn mantis?
iam confused to choose among testing, .net and java can anybody help me????????
what is the basic and unique feature of dotnet
Is buffer size and file block size is similar? If similar,at which case it will be same size?
Please describe an example where you used object orientation in one of your programs.
1. Consider the following input and generate the object code using single pass assembler. JOHN START 0 USING *,15 L 1,FIVE A 1,FOUR ST 1,TEMP FOUR DC F’4’ FIVE DC F’5’ TEMP DS ‘F END
It is possible to take number of controls added to form at run-time.ex-when user enter 6, 6 text boxes get added to form,next time number of controls get change as per user number enter. What is code for that?
when will triggars the at new event in abap and web dybn pro?