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
what are the topics choosen for jam round for interviews
Iam using Microsoft Visual Studio to create a system for mobile store I want to know how to calculate mobile price that the customer buy and how to reduce quantity from the data base that we have for mobile .And also how to calculate revnue for each mobile and revnue for the total mobile
One boy has to climb steps. He can climb 1 or 2 steps at a time. Write a function that will returns number of way a boy can climb the steps. Int WaytoSteps(int n) (eg:- suppose number of steps is n=4 ,the function will return 5 (one-one-one-one ,one-one-two, one-two-one-,two-one-one, two-two)
What is the purpose of
Is there any standard procedure to test the application as a whole? Or How can I test complete application right from the requirement gathering?
what does mean and stack mean in genral programming?
What's the difference b/w Table & Templete in Smartform?
what is the filters in biztakk server? where it can use?
hi all, i need ur help in preparing a sql which performs scd2, i mean i have a scd2 mapping i need a sql which can give me same result as scd2 mapping, SRC table: cust_no, loc 01 abc 02 xyz TGT table: pm_ky cust_no loc current_flag 1 01 abc Y 2 02 xyz Y cust 1 has changed his loc to xyz then it loads into TGT table as below, pm_ky cust_no loc current_flag 1 01 abc N 2 02 xyz Y 3 01 xyz Y i need sql to get the above result, hope got me question, Any suggestion will be appreciate.. thanks, Vinod
I want to insert date in the form of yyyy-mm-dd... if any changes happen while inserting date format want to show error meg...any one can solve this..??
What is the entry point function of a DLL?
Given an array of size n+1 which contains all the numbers from 1 to n.Find the number which is repeated in O(n) time.How do you proceed with the same with floating numbers from 0 to 1 instead of 1 to n?
sample and simple coding where we get?
How to call a C++ function which is compiled with C++ compiler in C code?
Need guidewire related Documents(Interview Question/Tips/Best Practice/Dumps)