Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Building Quotation engine program

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


Please Help Members By Posting Answers For Below Questions

MOV.CB 007H,ADCON1 MOVE.CT 001H,_OPTION_REG_7 MOV.CB 007H,CMCON

1996


Suppose server object is not loaded into the memory, and the client request for it , what will happen?

2617


What is BASIS

2130


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.

1940


How can we develop a multi-tier application in Java?

1846


Write a program to swap the content of two variables without using a third variable.

1020


how pseudo column works?

2157


when we use mantis? how learn mantis?

2126


iam confused to choose among testing, .net and java can anybody help me????????

2035


what is the basic and unique feature of dotnet

2183


Is buffer size and file block size is similar? If similar,at which case it will be same size?

2138


Please describe an example where you used object orientation in one of your programs.

1912


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

2773


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?

1930


when will triggars the at new event in abap and web dybn pro?

1928