public void BuyPackage_AdditionalServices_Error() { /*Price for Package 1 is 500 eruos*/ var packageId = 1; var clientId = 2; /*ServiceType.BachelorPartyHoliday * Adds 1050.00 euros to the package price */ /*ServiceType.HonneyMoon * Adds 800.50 euros to price */ var aditionalServices = new List <int>() { (int)ServiceType.BachelorPartyHoliday, (int)ServiceType.HonneyMoon }; var package = new BuyPackageBusinessLayer(); var price = package.CalculatePrice(packageId, aditionalServices); //Assertin with a wrong value. Assert.IsFalse(price == 1650M); }
public PackageDTO CalculatePrice(int packageId, string additionalServices) { var package = new BuyPackageBusinessLayer(); additionalServices = additionalServices != "0" ? additionalServices : string.Empty; var additionalServicesAux = !string.IsNullOrEmpty(additionalServices) ? additionalServices.Split(',').Select(x => Convert.ToInt32(x)).ToList() : new List <int>(); var price = package.CalculatePrice(packageId, additionalServicesAux); var packageEntity = new PackageEntity() { PackageId = packageId, Price = price }; return(Mapper.Map <PackageDTO>(packageEntity)); }
public void BuyPackage_AdditionalServices_Success() { /*Price for Package 1 is 500 eruos*/ var packageId = 1; var clientId = 2; /*ServiceType.BachelorPartyHoliday * Adds 1050.00 euro to the package price */ /*ServiceType.BirthDayParty * Adds 100 euro to price */ var aditionalServices = new List <int>() { (int)ServiceType.BachelorPartyHoliday, (int)ServiceType.BirthDayParty }; var package = new BuyPackageBusinessLayer(); var price = package.CalculatePrice(packageId, aditionalServices); Assert.IsTrue(price == 1650M); }