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
How can we develop a multi-tier application in Java?
Suppose server object is not loaded into the memory, and the client request for it , what will happen?
9.Difference between even and odd signals?explain with the diagram?
Hey this is venkatesh.Please can any body tell me what is SFLNXTCHG?where we use this keyword?what perpuse we use this?Can you tell me in real time senario with example? And in 7 specification(RPG/400)what is the mandatory specification using programs?
what is the main usage of an abstract keyword?please follow the program class A { void display() { System.out.println("hai"); } void print() { } } class B extends A { void print() { System.out.println("Hello"); } } In this program i was gives the implementation of print() according to my requirements in subclass.And there is no definition in superclass then why we can use abstract keyword before a method that i want to gives definition in other classes,is any mistakes in the above usage of method?
give idea for creating screen in abap
I m new to the dbms. Recently i came across words clustered indexes & nonclustered indexes but i dont know what is this all about & whats the difference between them.. So please help me!!!!!!!!
Is class is a abstract datatype in java?
what will we require to build project with the help of oracle
What is the difference between COM and CORBA?
hai i am mca 2009 fresher.please tell me which certification helps me to get an IT job faster which institute is good in hyderabad.please mail me to prasanna.1856@rediff.com
Plz sent me in .net 2.0 interview Question & answers?
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.
In project we have Documentation phase also,in that what is micro and macro designing?
Hello Experts, What is the difference between move and move corresponding exactly? please post me asap