public void ShouldAddExtraExpenseSpecificationOnTwoCategories() { ICase case1 = ObjectFactory.Instance.CreateNewCase(); CaseViewModel cvm = new CaseViewModel(); cvm.Case = case1; cvm.InjectExpenseCategories(); cvm.CurrentPageViewModel = cvm.PageViewModels[1]; cvm.CurrentPageViewModel.ExtraExpenses[0].Title = "Wall"; cvm.CurrentPageViewModel.ExtraExpenses[0].Description = "Wooden Tile"; cvm.CurrentPageViewModel.ExtraExpenses[0].Amount = 10; cvm.CurrentPageViewModel.ExtraExpenses[0].PricePerUnit = 15; cvm.CurrentPageViewModel = cvm.PageViewModels[11]; cvm.CurrentPageViewModel.ExtraExpenses[0].Title = "Wall-e"; cvm.CurrentPageViewModel.ExtraExpenses[0].Description = "Wooden Tile floating"; cvm.CurrentPageViewModel.ExtraExpenses[0].Amount = 5; cvm.CurrentPageViewModel.ExtraExpenses[0].PricePerUnit = 10; Assert.AreEqual("Wall", case1.GetExpenseCategory(Comforthuse.Category.CarportGarage).ExtraExpenses[0].Title); Assert.AreEqual("Wooden Tile", case1.GetExpenseCategory(Comforthuse.Category.CarportGarage).ExtraExpenses[0].Description); Assert.AreEqual(10, case1.GetExpenseCategory(Comforthuse.Category.CarportGarage).ExtraExpenses[0].Amount); Assert.AreEqual(15, case1.GetExpenseCategory(Comforthuse.Category.CarportGarage).ExtraExpenses[0].PricePerUnit); Assert.AreEqual("Wall-e", case1.GetExpenseCategory(Comforthuse.Category.Carpentry).ExtraExpenses[0].Title); Assert.AreEqual("Wooden Tile floating", case1.GetExpenseCategory(Comforthuse.Category.Carpentry).ExtraExpenses[0].Description); Assert.AreEqual(5, case1.GetExpenseCategory(Comforthuse.Category.Carpentry).ExtraExpenses[0].Amount); Assert.AreEqual(10, case1.GetExpenseCategory(Comforthuse.Category.Carpentry).ExtraExpenses[0].PricePerUnit); }
public void InjectExpenseCategories() { PageViewModels[0].ExpenseCategory = _activeCase.GetExpenseCategory(Category.HouseType); PageViewModels[1].ExpenseCategory = _activeCase.GetExpenseCategory(Category.CarportGarage); IPlotExpenses plExpenses = (IPlotExpenses)_activeCase.GetExpenseCategory(Category.Plot); PageViewModels[2].TechnicalSpecifications = plExpenses.TechnicalSpecifications; PageViewModels[2].ExtraExpenses = plExpenses.ExtraExpenses; IMaterialOutsideExpenses miExpenses = (IMaterialOutsideExpenses)_activeCase.GetExpenseCategory(Category.MaterialOutside); PageViewModels[3].TechnicalSpecifications = miExpenses.TechnicalSpecifications; PageViewModels[3].ExtraExpenses = miExpenses.ExtraExpenses; }
public void GetHouseTypeCategoryObject() { DomainFacade df = new DomainFacade(); ICase c = df.CreateCase(); List <ITechnicalSpecification> tspec = new List <ITechnicalSpecification>(); IExpenseCategory expenseCategory = c.GetExpenseCategory(Category.HouseType); IHouseTypeExpenses houseTypeExpenses = (IHouseTypeExpenses)expenseCategory; Assert.AreEqual(typeof(IHouseTypeExpenses), houseTypeExpenses.GetType()); Assert.AreNotEqual(null, expenseCategory); }
public void ShouldUpdateExtraExpenseAmount() { ICase case1 = ObjectFactory.Instance.CreateNewCase(); CaseViewModel cvm = new CaseViewModel(); cvm.Case = case1; cvm.InjectExpenseCategories(); cvm.CurrentPageViewModel = cvm.PageViewModels[1]; cvm.CurrentPageViewModel.ExtraExpenses[0].Amount = 25; Assert.AreEqual(25, case1.GetExpenseCategory(Comforthuse.Category.CarportGarage).ExtraExpenses[0].Amount); }
public void PriceIsBaseWithoutAnySpecifiedExpenses() { ICase case1 = ObjectFactory.Instance.CreateNewCase(); IExpenseCategory ec = case1.GetExpenseCategory(Comforthuse.Category.HouseType); IHouseTypeExpenses hte = (IHouseTypeExpenses)ec; hte.HouseType.TotalPrice = 123456; Assert.AreEqual(123456, case1.Price); }
public void PriceChangeOnUpdatedPriceOfMaterial() { ICase case1 = ObjectFactory.Instance.CreateNewCase(); IExpenseCategory ec = case1.GetExpenseCategory(Comforthuse.Category.CarportGarage); IExtraExpenseSpecification ees = new ExtraExpenseSpecification(); ees.PricePerUnit = 10; ees.Amount = 1; ec.ExtraExpenses.Add(ees); Assert.AreEqual(10, case1.Price); ees.PricePerUnit = 20; Assert.AreEqual(20, case1.Price); }
public void GetListOfTechnicalSpecifiations() { DomainFacade df = new DomainFacade(); ICase c = df.CreateCase(); List <ITechnicalSpecification> tspec = new List <ITechnicalSpecification>(); IHouseTypeExpenses htExpenses = (IHouseTypeExpenses)c.GetExpenseCategory(Category.HouseType); //List has 5 Assert.AreEqual(typeof(HouseTypeExpenses), htExpenses.GetType()); Assert.AreNotEqual(null, htExpenses); }
private void InsertHouseType(ICase c, int year, int caseNumber) { DeleteHouseType(year, caseNumber); IHouseTypeExpenses houseTypeEx = (IHouseTypeExpenses)c.GetExpenseCategory(Category.HouseType); SqlCommand command = new SqlCommand("CH_SP_InsertHouseType", conn); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@Name", houseTypeEx.HouseType.Name)); command.Parameters.Add(new SqlParameter("@HouseTypeDescription", houseTypeEx.HouseType.Description)); command.Parameters.Add(new SqlParameter("@Area", houseTypeEx.HouseType.Area)); command.Parameters.Add(new SqlParameter("@TotalPrice", houseTypeEx.HouseType.TotalPrice)); command.Parameters.Add(new SqlParameter("@CaseNumber", caseNumber)); command.Parameters.Add(new SqlParameter("@CaseYear", year)); command.ExecuteNonQuery(); command.Dispose(); }
public void ShouldInsertCaseWithAllInformation() { ICase case1 = ObjectFactory.Instance.CreateNewCase(); case1.CaseNumber = 0; case1.Customer.FirstName = "David"; case1.Customer.LastName = "Alves"; case1.Customer.Email = "*****@*****.**"; case1.Customer.City = "Porto"; case1.Customer.Address = "Praceta Ribeiro Sanches nº89"; case1.Customer.Zipcode = "4100-428"; case1.Customer.PhoneNb1 = "937776684"; case1.Customer.PhoneNb2 = "31854331"; case1.Employee = new Employee("Alan", "Boje", "*****@*****.**", "24813540"); case1.MoneyInstitute = new MoneyInstitute() { Name = "intituto", Address = "intitutoAddress", Zipcode = "5200", City = "Odense", PhoneNb = "31854545" }; case1.Plot = new Plot() { Zipcode = "31634", Address = "testaddressforplot", City = "Idunno", Area = 123, Municipality = "Odense", AvailabilityDate = new DateTime(2017, 6, 23) }; case1.Image = new Image() { Path = @"c:\test\img2.png", Description = "Very good image" }; case1.GetExpenseCategory(Category.CarportGarage).ExtraExpenses[0].Title = "Wall"; case1.GetExpenseCategory(Category.CarportGarage).ExtraExpenses[0].Amount = 10; case1.GetExpenseCategory(Category.CarportGarage).ExtraExpenses[0].PricePerUnit = 10; case1.GetExpenseCategory(Category.CarportGarage).ExtraExpenses[0].Description = "Wood"; case1.GetExpenseCategory(Category.HouseType).ExtraExpenses[0].Title = "Material"; case1.GetExpenseCategory(Category.HouseType).ExtraExpenses[0].Amount = 1; case1.GetExpenseCategory(Category.HouseType).ExtraExpenses[0].PricePerUnit = 10; case1.GetExpenseCategory(Category.HouseType).ExtraExpenses[0].Description = "Hammer"; case1.GetExpenseCategory(Category.CarportGarage).TechnicalSpecifications[0].Editable = true; case1.GetExpenseCategory(Category.CarportGarage).TechnicalSpecifications[0].Description = "Woow such a technical thing"; case1.GetExpenseCategory(Category.HouseType).TechnicalSpecifications[0].Editable = false; case1.GetExpenseCategory(Category.HouseType).TechnicalSpecifications[0].Description = "I don't know how to write technical jk"; case1.GetExpenseCategory(Category.Plot).TechnicalSpecifications[0].Editable = false; case1.GetExpenseCategory(Category.Plot).TechnicalSpecifications[0].Description = "I don't know how to write"; case1.GetExpenseCategory(Category.CarportGarage).ProductTypes[0].ListOfProductOptions[1].Selected = true; case1.GetExpenseCategory(Category.CarportGarage).ProductTypes[0].ListOfProductOptions[1].Amount = 30; case1.GetExpenseCategory(Category.CarportGarage).ProductTypes[0].ListOfProductOptions[1].SpecialPrice = 19.99M; IHouseTypeExpenses houseEx = (IHouseTypeExpenses)case1.GetExpenseCategory(Category.HouseType); houseEx.HouseType = new HouseType(); houseEx.HouseType.TotalPrice = 123654; Assert.IsTrue(DatabaseController.Instance.SaveCase(case1)); }