public void Post() { BillItemDTO dto = new BillItemDTO() { Id = 0, Bill = new BillDTO() { Id = 1 }, Description = "POST", PriceHT = 100M, PriceTTC = 100M, Quantity = 1, Title = "POST", HomeId = 1 }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK, true, false); List <BillItemDTO> search = (List <BillItemDTO>)reqCreator.CallSearch(st, "BillItem/where/Id/eq/" + reqCreator.deserializedEntity.Id, new List <string>() { "Bill", "GroupBillItem", "BillItemCategory" }, typeof(List <BillItemDTO>)); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto, search[0], new string[] { "Id", "GroupBillItem", "BillItemCategory", "Bill" })); Assert.IsNotNull(search[0].Bill); Assert.IsNull(search[0].GroupBillItem); Assert.IsNull(search[0].BillItemCategory); }
public void Post() { BillDTO dto = new BillDTO() { Id = 0, CreationDate = DateTime.Now, HomeId = 1, IsPayed = false, Reference = "R2014-33", TotalHT = 10M, TotalTTC = 15M, }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK, true, false); entity = reqCreator.deserializedEntity; List <BillDTO> search = (List <BillDTO>)reqCreator.CallSearch(st, "Bill/where/Id/eq/" + entity.Id, new List <string>() { "Document", "Supplier", "BillItems", "PaymentMethods" }, typeof(List <BillDTO>)); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto, search[0], new string[] { "Id", "Document", "Supplier", "BillItems", "PaymentMethods", "CreationDate" })); Assert.IsNull(search[0].Supplier); Assert.AreEqual(0, search[0].BillItems.Count); Assert.IsNull(search[0].Booking); Assert.IsNull(search[0].Document); Assert.AreEqual(0, search[0].PaymentMethods.Count); }
public void PostNestedEntities() { BookingStepConfigDTO dto = new BookingStepConfigDTO() { HomeId = 1, Title = "Post", BookingSteps = new System.Collections.Generic.List <BookingStepDTO>() { new BookingStepDTO() { Id = 0, HomeId = 1, Title = "Post" } } }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK, true); entity = reqCreator.deserializedEntity; List <BookingStepConfigDTO> search = reqCreator.CallSearch(st, "BookingStepConfig/where/id/eq/" + entity.Id, new List <string>() { "BookingSteps" }, typeof(List <BookingStepConfigDTO>)); Assert.IsNull(dto.DateModification); Assert.AreEqual(dto.HomeId, search[0].HomeId); Assert.AreEqual(dto.Title, search[0].Title); for (int i = 0; i < dto.BookingSteps.Count; i++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <BookingStepDTO>( dto.BookingSteps[i], search[0].BookingSteps[i], new string[] { "Id", "BookingStepConfig", "Documents", "MailTemplate" })); } }
public void PutNestedEntities() { entity.Title = "PUT"; entity.Supplier.SocietyName = "PUT"; entity.BillItemCategory.Title = "PUT"; entity.ProductCategory.Title = "PUT"; entity.Tax.Title = "PUT"; entity.IsUnderThreshold = false; reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Put, entity, HttpStatusCode.OK, false, false); List <ProductDTO> search = (List <ProductDTO>)reqCreator.CallSearch(st, "Product/where/id/eq/" + entity.Id, new List <string>() { "BillItemCategory", "Tax", "Supplier", "ProductCategory" }, typeof(List <ProductDTO>)); Assert.AreEqual(entity.Hide, search[0].Hide); Assert.AreEqual(entity.Duration, search[0].Duration); Assert.AreEqual(entity.HomeId, search[0].HomeId); Assert.AreEqual(search[0].IsUnderThreshold, true); Assert.AreEqual(entity.PriceHT, search[0].PriceHT); Assert.AreEqual(entity.RefHide, search[0].RefHide); Assert.AreEqual(entity.ShortDescription, search[0].ShortDescription); Assert.AreEqual(entity.Stock, search[0].Stock); Assert.AreEqual(entity.Threshold, search[0].Threshold); Assert.AreEqual(entity.Title, search[0].Title); PropertiesComparison.PublicInstancePropertiesEqual <BillItemCategoryDTO>(search[0].BillItemCategory, entity.BillItemCategory); PropertiesComparison.PublicInstancePropertiesEqual <ProductCategoryDTO>(search[0].ProductCategory, entity.ProductCategory); PropertiesComparison.PublicInstancePropertiesEqual <SupplierDTO>(search[0].Supplier, entity.Supplier); PropertiesComparison.PublicInstancePropertiesEqual <TaxDTO>(search[0].Tax, entity.Tax); Assert.IsNotNull(search[0].DateModification); }
public void NestedPost() { PaymentMethodDTO dto = new PaymentMethodDTO() { Bill = new BillDTO() { Id = 1 }, HomeId = 1, Id = 0, PaymentType = new PaymentTypeDTO() { Id = 0, HomeId = 1, Title = "POST", }, Price = 300M }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK, true, false); entity = reqCreator.deserializedEntity; List <PaymentMethodDTO> search = reqCreator.CallSearch(st, "PaymentMethod/where/Id/eq/" + entity.Id, new List <string>() { "Bill", "PaymentType" }, typeof(List <PaymentMethodDTO>)); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto, search[0], new string[] { "Id", "Bill", "PaymentType" })); Assert.AreEqual(dto.Bill.Id, search[0].Bill.Id); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto.PaymentType, search[0].PaymentType, new string[] { "Id" })); }
public void Compute() { reqCreator.CreateRequest(st, path + "/Compute/" + entity.Id, HttpMethod.Put, entity, HttpStatusCode.OK, true, false); Assert.AreEqual(reqCreator.deserializedEntity.PriceTTC, 11M); Assert.AreEqual(reqCreator.deserializedEntity.PriceHT, entity.PriceHT); Assert.AreEqual(reqCreator.deserializedEntity.HomeId, 1); Assert.IsNotNull(reqCreator.deserializedEntity.DateModification); Assert.AreEqual(entity.PriceHT, reqCreator.deserializedEntity.PriceHT); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <TaxDTO>(entity.Tax, reqCreator.deserializedEntity.Tax, new string[] { "Id" })); }
public void Put() { entity.Price = 777M; reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Put, entity, HttpStatusCode.OK, false, false); List <PaymentMethodDTO> search = reqCreator.CallSearch(st, "PaymentMethod/where/Id/eq/" + entity.Id, new List <string>(), typeof(List <PaymentMethodDTO>)); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(entity, search[0], new string[] { "Id", "DateModification", "Bill", "PaymentType" })); Assert.IsNotNull(search[0].DateModification); }
public void Put() { entity.Address = "changed"; entity.Title = "changed"; reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Put, entity, HttpStatusCode.OK, false, false); reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Get, null, HttpStatusCode.OK, true); HomeDTO ret = reqCreator.deserializedEntity; Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <HomeDTO>(entity, ret, new string[] { "Id", "DateModification" })); Assert.IsNotNull(ret.DateModification); }
public void Put() { entity.IsPayed = true; entity.TotalHT = 10M; reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Put, entity, HttpStatusCode.OK, false, false); List <BillDTO> search = reqCreator.CallSearch(st, "Bill/where/Id/eq/" + entity.Id, new List <string>() { "Document", "Supplier", "BillItems", "PaymentMethods" }, typeof(List <BillDTO>)); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(entity, search[0], new string[] { "Id", "Document", "Supplier", "BillItems", "PaymentMethods", "DateModification", "CreationDate" })); }
public void NestedPost() { BillItemDTO dto = new BillItemDTO() { Id = 0, Bill = new BillDTO() { Id = 1 }, BillItemCategory = new BillItemCategoryDTO() { Id = 0, HomeId = 1, Title = "POST" }, Description = "POST", GroupBillItem = new GroupBillItemDTO() { Discount = 50M, HomeId = 1, Id = 0, ValueType = Domain.Entity.EValueType.AMOUNT }, PriceHT = 100M, PriceTTC = 100M, Quantity = 1, Title = "POST", HomeId = 1 }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK, true, false); entity = reqCreator.deserializedEntity; List <BillItemDTO> search = (List <BillItemDTO>)reqCreator.CallSearch(st, "BillItem/where/Id/eq/" + entity.Id, new List <string>() { "Bill", "GroupBillItem", "BillItemCategory" }, typeof(List <BillItemDTO>)); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto, entity, new string[] { "Id", "GroupBillItem", "BillItemCategory", "Bill" })); Assert.IsNotNull(entity.Bill); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto.BillItemCategory, entity.BillItemCategory, new string[] { "Id" })); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto.GroupBillItem, entity.GroupBillItem, new string[] { "Id" })); }
public void NestedPost() { PaymentTypeDTO dto = new PaymentTypeDTO() { HomeId = 1, Id = 0, Title = "POST" }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK, true, false); entity = reqCreator.deserializedEntity; List <PaymentTypeDTO> search = (List <PaymentTypeDTO>)reqCreator.CallSearch(st, "PaymentType/where/Id/eq/" + entity.Id, new List <string>(), typeof(List <PaymentTypeDTO>)); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto, entity, new string[] { "Id" })); }
public void Post() { HomeDTO dto = new HomeDTO() { Address = "4 rue du pressoir 57480 contz-les-bains", EstablishmentType = EEstablishmentType.BB, Title = "Test", }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK, true, false); entity = reqCreator.deserializedEntity; reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Get, null, HttpStatusCode.OK, true); HomeDTO ret = reqCreator.deserializedEntity; Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <HomeDTO>(entity, ret, new string[] { "Id" })); }
public void PostNestedEntities() { AdditionalBookingDTO dto = new AdditionalBookingDTO() { HomeId = 1, PriceHT = 10M, Tax = new TaxDTO() { Id = 0, HomeId = 1, Price = 10M, ValueType = EValueType.PERCENT, Title = "Post", }, Title = "Post", Booking = new BookingDTO() { Id = 1 }, BillItemCategory = new BillItemCategoryDTO() { Id = 0, HomeId = 1, Title = "Post" } }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK, true, false); List <AdditionalBookingDTO> search = reqCreator.CallSearch(st, "AdditionalBooking/where/id/eq/" + reqCreator.deserializedEntity.Id, new List <string>() { "BillItemCategory", "Booking", "Tax" }, typeof(List <AdditionalBookingDTO>)); Assert.AreEqual(dto.Title, search[0].Title); Assert.AreEqual(search[0].HomeId, 1); Assert.AreEqual(search[0].DateModification, null); Assert.AreEqual(dto.PriceHT, search[0].PriceHT); Assert.AreEqual(dto.PriceHT, search[0].PriceTTC); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <TaxDTO>(dto.Tax, search[0].Tax, new string[] { "Id" })); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <BillItemCategoryDTO>(dto.BillItemCategory, search[0].BillItemCategory, new string[] { "Id" })); entity = reqCreator.deserializedEntity; }
public void Put() { entity.Description = "PUT"; entity.PriceHT = 0M; entity.Title = "PUT"; reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Put, entity, HttpStatusCode.OK, false, false); List <BillItemDTO> search = reqCreator.CallSearch(st, "BillItem/where/Id/eq/" + entity.Id, new List <string>() { "Bill", "GroupBillItem", "BillItemCategory" }, typeof(List <BillItemDTO>)); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(entity, search[0], new string[] { "Id", "GroupBillItem", "BillItemCategory", "Bill", "DateModification" })); Assert.IsNotNull(search[0].Bill); Assert.IsNotNull(search[0].GroupBillItem); Assert.IsNotNull(search[0].BillItemCategory); }
public void NestedPost() { GroupBillItemDTO dto = new GroupBillItemDTO() { Discount = 50M, HomeId = 1, Id = 0, ValueType = Domain.Entity.EValueType.AMOUNT }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK, true, false); entity = reqCreator.deserializedEntity; List <GroupBillItemDTO> search = reqCreator.CallSearch(st, "GroupBillItem/where/Id/eq/" + entity.Id, new List <string>(), typeof(List <GroupBillItemDTO>)); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto, search[0], new string[] { "Id" })); }
public void Post() { reqCreator.CreateRequest(st, path, HttpMethod.Post, entity, HttpStatusCode.OK, true, false); List <AdditionalBookingDTO> search = reqCreator.CallSearch(st, "AdditionalBooking/where/id/eq/" + reqCreator.deserializedEntity.Id, new List <string>() { "BillItemCategory", "Booking", "Tax" }, typeof(List <AdditionalBookingDTO>)); Assert.AreEqual(search[0].HomeId, 1); Assert.AreEqual(search[0].DateModification, null); Assert.AreEqual(entity.PriceHT, search[0].PriceHT); Assert.AreEqual(entity.PriceHT, search[0].PriceTTC); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <TaxDTO>(entity.Tax, search[0].Tax, new string[] { "Id" })); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <BillItemCategoryDTO>(entity.BillItemCategory, search[0].BillItemCategory, new string[] { "Id" })); }
public void Put() { entity.Canceled = true; reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Put, entity, HttpStatusCode.OK, false, false); List <BookingStepBookingDTO> search = reqCreator.CallSearch(st, "BookingStepBooking/where/id/eq/" + entity.Id, new List <string>() { "BookingStepConfig", "CurrentStep" }, typeof(List <BookingStepBookingDTO>)); Assert.AreEqual(search[0].MailSent, 0); Assert.AreEqual(search[0].HomeId, entity.HomeId); Assert.IsNotNull(search[0].DateModification); Assert.IsNotNull(search[0].DateCurrentStepChanged); Assert.AreEqual(search[0].Canceled, true); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <BookingStepConfigDTO>( search[0].BookingStepConfig, entity.BookingStepConfig, new string[] { "Id", "BookingSteps" })); }
public void Put() { entity.Title = "Put"; reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Put, entity, HttpStatusCode.OK, false); List <BookingStepConfigDTO> search = reqCreator.CallSearch(st, "BookingStepConfig/where/id/eq/" + entity.Id, new List <string>() { "BookingSteps" }, typeof(List <BookingStepConfigDTO>)); Assert.IsNotNull(search[0].DateModification); Assert.AreEqual(search[0].HomeId, entity.HomeId); Assert.AreEqual(search[0].Title, entity.Title); for (int i = 0; i < search[0].BookingSteps.Count; i++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <BookingStepDTO>( search[0].BookingSteps[i], entity.BookingSteps[i], new string[] { "Id", "BookingStepConfig", "Documents", "MailTemplate" })); } }
public void Put() { entity.Title = "PUT"; entity.Hide = true; reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Put, entity, HttpStatusCode.OK, false); List <MealDTO> search = reqCreator.CallSearch(st, "Meal/where/id/eq/" + entity.Id, new List <string>() { "MealCategory", "Documents", "MealPrices", "BillItemCategory" }, typeof(List <MealDTO>)); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(entity, search[0], new string[] { "Id", "MealCategory", "BillItemCategory", "Documents", "MealPrices", "DateModification" })); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(entity.BillItemCategory, search[0].BillItemCategory, new string[] { "Id", "HomeId" })); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(entity.MealCategory, search[0].MealCategory, new string[] { "Id", "HomeId" })); Assert.AreEqual(entity.MealPrices.Count, search[0].MealPrices.Count); }
public void PutNegativePrice() { entity.Title = "changed"; entity.PriceHT = -55M; reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Put, entity, HttpStatusCode.OK, false, false); List <AdditionalBookingDTO> search = reqCreator.CallSearch(st, "AdditionalBooking/where/id/eq/" + entity.Id, new List <string>() { "BillItemCategory", "Booking", "Tax" }, typeof(List <AdditionalBookingDTO>)); Assert.AreEqual(entity.Title, search[0].Title); Assert.AreEqual(search[0].HomeId, 1); Assert.IsNotNull(search[0].DateModification); Assert.AreEqual(entity.PriceHT, search[0].PriceHT); Assert.AreEqual(entity.PriceTTC, search[0].PriceTTC); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <TaxDTO>(entity.Tax, search[0].Tax, new string[] { "Id" })); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <BillItemCategoryDTO>(entity.BillItemCategory, search[0].BillItemCategory, new string[] { "Id" })); }
public void Post() { entity.BookingStepBooking = new BookingStepBookingDTO() { BookingStepConfig = new BookingStepConfigDTO() { Id = 1 }, HomeId = 1 }; reqCreator.CreateRequest(st, path, HttpMethod.Post, entity, HttpStatusCode.OK, true, false); List <BookingDTO> search = reqCreator.CallSearch(st, "Booking/where/id/eq/" + reqCreator.deserializedEntity.Id, new List <string>() { "People", "AdditionalBookings", "AdditionalBookings.Tax", "AdditionalBookings.BillItemCategory", "BookingStepBooking", "Deposits", "DinnerBookings", "DinnerBookings.MealBookings", "DinnerBookings.MealBookings.PeopleCategory", "ProductBookings.Product", "ProductBookings", "RoomBookings", "RoomBookings.Room", "RoomBookings.PeopleBookings", "RoomBookings.SupplementRoomBookings" }, typeof(List <BookingDTO>)); Assert.AreEqual(search[0].Comment, entity.Comment); for (int i = 0; i < search[0].AdditionalBookings.Count; i++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <AdditionalBookingDTO>( search[0].AdditionalBookings[i], entity.AdditionalBookings[i], new string[] { "Id", "PriceTTC", "BillItemCategory", "Tax", "Booking" })); Assert.AreEqual(search[0].AdditionalBookings[i].PriceHT, entity.AdditionalBookings[i].PriceTTC); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <BillItemCategoryDTO>( search[0].AdditionalBookings[i].BillItemCategory, entity.AdditionalBookings[i].BillItemCategory, new string[] { "Id" })); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <TaxDTO>( search[0].AdditionalBookings[i].Tax, entity.AdditionalBookings[i].Tax, new string[] { "Id" })); } Assert.AreEqual(search[0].DateArrival.Date, entity.DateArrival.Date); Assert.IsNotNull(entity.DateCreation); Assert.AreNotEqual(entity.DateCreation, search[0].DateCreation); Assert.AreEqual(search[0].DateDeparture.Date, entity.DateDeparture.Date); Assert.AreEqual(search[0].DateDesiredPayment, entity.DateDesiredPayment); Assert.IsNull(entity.DateModification); Assert.AreEqual(search[0].DateValidation, entity.DateValidation); for (int i = 0; i < search[0].Deposits.Count; i++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <DepositDTO>( search[0].Deposits[i], entity.Deposits[i], new string[] { "Id", "Booking", "DateCreation" })); } for (int i = 0; i < search[0].DinnerBookings.Count; i++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <DinnerBookingDTO>( search[0].DinnerBookings[i], entity.DinnerBookings[i], new string[] { "Id", "Booking", "MealBookings", "Date", "PriceHT", "PriceTTC" })); Assert.AreEqual(0, entity.DinnerBookings[i].PriceHT); Assert.AreEqual(0, entity.DinnerBookings[i].PriceTTC); Assert.AreEqual(((DateTime)entity.DinnerBookings[i].Date).Date, ((DateTime)search[0].DinnerBookings[i].Date).Date); for (int j = 0; j < search[0].DinnerBookings[i].MealBookings.Count; j++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <MealBookingDTO>( search[0].DinnerBookings[i].MealBookings[j], entity.DinnerBookings[i].MealBookings[j], new string[] { "Id", "Meal", "PeopleCategory", "DinnerBooking" })); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <PeopleCategoryDTO>( search[0].DinnerBookings[i].MealBookings[j].PeopleCategory, entity.DinnerBookings[i].MealBookings[j].PeopleCategory, new string[] { "Id", "Tax" })); } } Assert.AreEqual(search[0].HomeId, entity.HomeId); Assert.AreEqual(search[0].IsOnline, entity.IsOnline); Assert.AreEqual(search[0].IsSatisfactionSended, entity.IsSatisfactionSended); Assert.AreEqual(0, entity.TotalPeople); Assert.IsNotNull(entity.BookingStepBooking); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <PeopleDTO>( search[0].People, entity.People, new string[] { "Id", "DateCreation" })); for (int i = 0; i < search[0].ProductBookings.Count; i++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <ProductBookingDTO>( search[0].ProductBookings[i], entity.ProductBookings[i], new string[] { "Id", "Booking", "Product", "PriceHT", "PriceTTC" })); Assert.IsNotNull(search[0].ProductBookings[i].Product); Assert.AreEqual(0, entity.ProductBookings[i].PriceHT); Assert.AreEqual(0, entity.ProductBookings[i].PriceTTC); } for (int i = 0; i < search[0].RoomBookings.Count; i++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <RoomBookingDTO>( search[0].RoomBookings[i], entity.RoomBookings[i], new string[] { "Id", "Booking", "Room", "PriceHT", "PriceTTC", "NbNights", "PeopleBookings", "SupplementRoomBookings" })); Assert.IsNotNull(entity.RoomBookings[i].Room); Assert.AreNotEqual(0, entity.RoomBookings[i].PeopleBookings); Assert.AreNotEqual(0, entity.RoomBookings[i].SupplementRoomBookings); Assert.AreEqual(0, entity.RoomBookings[i].PriceHT); Assert.AreEqual(0, entity.RoomBookings[i].PriceTTC); Assert.AreEqual(0, entity.RoomBookings[i].NbNights); } }
public void PostNestedEntities() { ProductDTO dto = new ProductDTO() { Duration = 10, Hide = false, HomeId = 1, Id = 1, PriceHT = 50M, RefHide = false, Stock = 1, Threshold = 5, Title = "Title", IsUnderThreshold = false, BillItemCategory = new BillItemCategoryDTO() { HomeId = 1, Id = 1, Title = "BillItemCategoryTest" }, ProductCategory = new ProductCategoryDTO() { Id = 0, HomeId = 1, RefHide = true, Title = "POST" }, Supplier = new SupplierDTO() { Id = 0, SocietyName = "Nongfu", Email = "*****@*****.**", HomeId = 1, Comment = "Ceci est un commentaire", Addr = "Ceci est une addresse", Contact = "popop", Phone1 = "0384158418518548", Phone2 = "0384158418518548", DateCreation = DateTime.MinValue }, Tax = new TaxDTO() { Id = 0, HomeId = 1, Price = 10M, Title = "POST", ValueType = EValueType.AMOUNT }, ShortDescription = "short desc" }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK, true, false); List <ProductDTO> search = (List <ProductDTO>)reqCreator.CallSearch(st, "Product/where/id/eq/" + reqCreator.deserializedEntity.Id, new List <string>() { "BillItemCategory", "Tax", "Supplier", "ProductCategory" }, typeof(List <ProductDTO>)); Assert.AreEqual(search[0].Hide, dto.Hide); Assert.AreEqual(search[0].Duration, dto.Duration); Assert.AreEqual(search[0].HomeId, dto.HomeId); Assert.AreEqual(search[0].IsUnderThreshold, true); Assert.AreEqual(search[0].PriceHT, dto.PriceHT); Assert.AreEqual(search[0].RefHide, dto.RefHide); Assert.AreEqual(search[0].ShortDescription, dto.ShortDescription); Assert.AreEqual(search[0].Stock, dto.Stock); Assert.AreEqual(search[0].Threshold, dto.Threshold); Assert.AreEqual(search[0].Title, dto.Title); Assert.AreEqual(search[0].IsUnderThreshold, true); PropertiesComparison.PublicInstancePropertiesEqual <BillItemCategoryDTO>(dto.BillItemCategory, search[0].BillItemCategory); PropertiesComparison.PublicInstancePropertiesEqual <ProductCategoryDTO>(dto.ProductCategory, search[0].ProductCategory); PropertiesComparison.PublicInstancePropertiesEqual <SupplierDTO>(dto.Supplier, search[0].Supplier); PropertiesComparison.PublicInstancePropertiesEqual <TaxDTO>(dto.Tax, search[0].Tax); Assert.AreEqual(search[0].DateModification, null); entity = reqCreator.deserializedEntity; }
public void PostNestedEntities() { MealDTO dto = new MealDTO() { Title = "POST", BillItemCategory = new BillItemCategoryDTO() { Id = 0, Title = "BillItemCategory", }, Description = "POST", Hide = false, MealCategory = new MealCategoryDTO() { Id = 0, Label = "POST", RefHide = false }, MealPrices = new System.Collections.Generic.List <MealPriceDTO>() { new MealPriceDTO() { Id = 0, PeopleCategory = new PeopleCategoryDTO() { Id = 1 }, PriceHT = 50M, Tax = new TaxDTO() { Id = 1 } }, new MealPriceDTO() { Id = 0, PeopleCategory = new PeopleCategoryDTO() { Id = 2 }, PriceHT = 70M, Tax = new TaxDTO() { Id = 2 } } }, HomeId = 1, RefHide = false, ShortDescription = "POST" }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK); entity = reqCreator.deserializedEntity; List <MealDTO> search = reqCreator.CallSearch(st, "Meal/where/id/eq/" + entity.Id, new List <string>() { "MealCategory", "Documents", "MealPrices", "BillItemCategory" }, typeof(List <MealDTO>)); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto, search[0], new string[] { "Id", "MealCategory", "BillItemCategory", "Documents", "MealPrices" })); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto.BillItemCategory, search[0].BillItemCategory, new string[] { "Id", "HomeId" })); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto.MealCategory, search[0].MealCategory, new string[] { "Id", "HomeId" })); Assert.AreEqual(dto.MealPrices.Count, search[0].MealPrices.Count); }
public void PostNestedEntities() { BillDTO dto = new BillDTO() { Id = 0, BillItems = new List <BillItemDTO>() { new BillItemDTO() { Id = 0, PriceHT = 10M, PriceTTC = 10M, Title = "POST", HomeId = 1 } }, CreationDate = DateTime.Now, HomeId = 1, IsPayed = false, Reference = "R2014-33", PaymentMethods = new List <PaymentMethodDTO>() { new PaymentMethodDTO() { Id = 0, HomeId = 1, PaymentType = new PaymentTypeDTO() { Id = 1, Title = "CB" }, Price = 30M }, new PaymentMethodDTO() { Id = 0, HomeId = 1, PaymentType = new PaymentTypeDTO() { Id = 2, Title = "CASH" }, Price = 50M } }, TotalHT = 10M, TotalTTC = 15M, Supplier = new SupplierDTO() { Id = 1 } }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK, true, false); entity = reqCreator.deserializedEntity; List <BillDTO> search = (List <BillDTO>)reqCreator.CallSearch(st, "Bill/where/Id/eq/" + entity.Id, new List <string>() { "Document", "Supplier", "BillItems", "PaymentMethods" }, typeof(List <BillDTO>)); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto, search[0], new string[] { "Id", "Document", "Supplier", "BillItems", "PaymentMethods", "CreationDate" })); Assert.IsNotNull(search[0].Supplier); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual(dto.BillItems[0], search[0].BillItems[0], new string[] { "Id", "Bill", "BillItemCategory", "GroupBillItem" })); Assert.AreEqual(2, search[0].PaymentMethods.Count); }
public void PostNestedEntities() { BookingDTO dto = new BookingDTO() { AdditionalBookings = new System.Collections.Generic.List <AdditionalBookingDTO>() { new AdditionalBookingDTO() { BillItemCategory = new BillItemCategoryDTO() { Id = 0, HomeId = 1, Title = "Post" }, Id = 0, HomeId = 1, PriceHT = 1M, Title = "Post", Tax = new TaxDTO() { Id = 0, HomeId = 1, Price = 1M, Title = "Post", ValueType = EValueType.AMOUNT } } }, BookingStepBooking = new BookingStepBookingDTO() { Id = 0, BookingStepConfig = new BookingStepConfigDTO() { Id = 1 }, HomeId = 1 }, DateArrival = DateTime.Now.AddDays(30), DateDeparture = DateTime.Now.AddDays(35), Deposits = new System.Collections.Generic.List <DepositDTO>() { new DepositDTO() { Id = 0, HomeId = 1, Price = 10M, ValueType = EValueType.PERCENT } }, DinnerBookings = new System.Collections.Generic.List <DinnerBookingDTO>() { new DinnerBookingDTO() { Id = 0, HomeId = 1, MealBookings = new System.Collections.Generic.List <MealBookingDTO>() { new MealBookingDTO() { Id = 0, HomeId = 1, Meal = new MealDTO() { Id = 1 }, NumberOfPeople = 1, } }, NumberOfPeople = 1, Date = DateTime.Now.AddDays(120) } }, HomeId = 1, People = new PeopleDTO() { Id = 0, Firstname = "Chaabane", Lastname = "Jalal", HomeId = 1 }, ProductBookings = new System.Collections.Generic.List <ProductBookingDTO>() { new ProductBookingDTO() { Id = 0, HomeId = 1, Product = new ProductDTO() { Id = 1 }, Quantity = 1 } }, RoomBookings = new System.Collections.Generic.List <RoomBookingDTO>() { new RoomBookingDTO() { Id = 0, HomeId = 1, NbNights = 1, PeopleBookings = new System.Collections.Generic.List <PeopleBookingDTO>() { new PeopleBookingDTO() { Id = 0, HomeId = 1, NumberOfPeople = 1, PeopleCategory = new PeopleCategoryDTO() { Id = 1 }, } }, Room = new RoomDTO() { Id = 1 }, SupplementRoomBookings = new System.Collections.Generic.List <SupplementRoomBookingDTO>() { new SupplementRoomBookingDTO() { Id = 0, HomeId = 1, RoomSupplement = new RoomSupplementDTO() { Id = 1 } } } } } }; reqCreator.CreateRequest(st, path, HttpMethod.Post, dto, HttpStatusCode.OK, true, false); entity = reqCreator.deserializedEntity; List <BookingDTO> search = reqCreator.CallSearch(st, "Booking/where/id/eq/" + entity.Id, new List <string>() { "People", "AdditionalBookings", "AdditionalBookings.Tax", "AdditionalBookings.BillItemCategory", "BookingStepBooking", "Deposits", "DinnerBookings", "DinnerBookings.MealBookings", "DinnerBookings.MealBookings.PeopleCategory", "ProductBookings.Product", "ProductBookings", "RoomBookings", "RoomBookings.Room", "RoomBookings.PeopleBookings", "RoomBookings.SupplementRoomBookings" }, typeof(List <BookingDTO>)); Assert.AreEqual(dto.Comment, search[0].Comment); for (int i = 0; i < dto.AdditionalBookings.Count; i++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <AdditionalBookingDTO>( dto.AdditionalBookings[i], search[0].AdditionalBookings[i], new string[] { "Id", "PriceTTC", "BillItemCategory", "Tax", "Booking" })); Assert.AreEqual(dto.AdditionalBookings[i].PriceHT, search[0].AdditionalBookings[i].PriceTTC); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <BillItemCategoryDTO>( dto.AdditionalBookings[i].BillItemCategory, search[0].AdditionalBookings[i].BillItemCategory, new string[] { "Id" })); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <TaxDTO>( dto.AdditionalBookings[i].Tax, search[0].AdditionalBookings[i].Tax, new string[] { "Id" })); } Assert.AreEqual(dto.DateArrival.Date, search[0].DateArrival.Date); Assert.IsNotNull(search[0].DateCreation); Assert.AreNotEqual(search[0].DateCreation, dto.DateCreation); Assert.AreEqual(dto.DateDeparture.Date, search[0].DateDeparture.Date); Assert.AreEqual(dto.DateDesiredPayment, search[0].DateDesiredPayment); Assert.IsNull(search[0].DateModification); Assert.AreEqual(dto.DateValidation, search[0].DateValidation); for (int i = 0; i < dto.Deposits.Count; i++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <DepositDTO>( dto.Deposits[i], search[0].Deposits[i], new string[] { "Id", "Booking", "DateCreation" })); } for (int i = 0; i < dto.DinnerBookings.Count; i++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <DinnerBookingDTO>( dto.DinnerBookings[i], search[0].DinnerBookings[i], new string[] { "Id", "Booking", "MealBookings", "Date", "PriceHT", "PriceTTC" })); Assert.AreEqual(0, search[0].DinnerBookings[i].PriceHT); Assert.AreEqual(0, search[0].DinnerBookings[i].PriceTTC); Assert.AreEqual(((DateTime)search[0].DinnerBookings[i].Date).Date, ((DateTime)dto.DinnerBookings[i].Date).Date); for (int j = 0; j < dto.DinnerBookings[i].MealBookings.Count; j++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <MealBookingDTO>( dto.DinnerBookings[i].MealBookings[j], search[0].DinnerBookings[i].MealBookings[j], new string[] { "Id", "Meal", "PeopleCategory", "DinnerBooking" })); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <PeopleCategoryDTO>( dto.DinnerBookings[i].MealBookings[j].PeopleCategory, search[0].DinnerBookings[i].MealBookings[j].PeopleCategory, new string[] { "Id", "Tax" })); } } Assert.AreEqual(dto.HomeId, search[0].HomeId); Assert.AreEqual(dto.IsOnline, search[0].IsOnline); Assert.AreEqual(dto.IsSatisfactionSended, search[0].IsSatisfactionSended); Assert.AreEqual(0, search[0].TotalPeople); Assert.IsNotNull(search[0].BookingStepBooking); Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <PeopleDTO>( dto.People, search[0].People, new string[] { "Id", "DateCreation" })); for (int i = 0; i < dto.ProductBookings.Count; i++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <ProductBookingDTO>( dto.ProductBookings[i], search[0].ProductBookings[i], new string[] { "Id", "Booking", "Product", "PriceHT", "PriceTTC" })); Assert.IsNotNull(dto.ProductBookings[i].Product); Assert.AreEqual(0, search[0].ProductBookings[i].PriceHT); Assert.AreEqual(0, search[0].ProductBookings[i].PriceTTC); } for (int i = 0; i < dto.RoomBookings.Count; i++) { Assert.IsTrue(PropertiesComparison.PublicInstancePropertiesEqual <RoomBookingDTO>( dto.RoomBookings[i], search[0].RoomBookings[i], new string[] { "Id", "Booking", "Room", "PriceHT", "PriceTTC", "NbNights", "PeopleBookings", "SupplementRoomBookings" })); Assert.IsNotNull(search[0].RoomBookings[i].Room); Assert.AreNotEqual(0, search[0].RoomBookings[i].PeopleBookings); Assert.AreNotEqual(0, search[0].RoomBookings[i].SupplementRoomBookings); Assert.AreEqual(0, search[0].RoomBookings[i].PriceHT); Assert.AreEqual(0, search[0].RoomBookings[i].PriceTTC); Assert.AreEqual(0, search[0].RoomBookings[i].NbNights); } }