public void SetUp() { this.resource = new RetailerResource { Id = 123, Name = "Retailer Name", DateClosed = DateTime.UtcNow }; this.retailerDemList = new RetailerDemList(123, string.Empty); this.RetailerDemListRepository.GetByRetailerId(123).Returns(this.retailerDemList); var json = JsonConvert.SerializeObject( this.resource, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }); var body = Encoding.UTF8.GetBytes(json); var message = Substitute.For <IReceivedMessage>(); message.Body.Returns(body); this.result = this.Sut.Execute(message); }
public void SetUp() { this.resource = new InvoiceResource { id = 123, lines = new List <InvoiceLineResource> { new InvoiceLineResource { quantity = 2, forDemonstration = true, links = new List <LinkResource> { new LinkResource("productUri", "/products/sales-parts/123"), new LinkResource("sales-customer", "/sales/customers/808") } }, new InvoiceLineResource { quantity = 1, forDemonstration = true, links = new List <LinkResource> { new LinkResource("productUri", "/products/sales-parts/456"), new LinkResource("sales-customer", "/sales/customers/808") } } } }; this.retailerDemList = new RetailerDemList(444, null); this.RetailerProxy.GetRetailerId("/sales/customers/808").Returns((int?)null); this.Sut.CaptureDemRootProductsFromInvoice(this.resource); }
public void SetUp() { this.retailerId = 50; this.retailerDemList = new RetailerDemList(this.retailerId, "/employee/200") { Id = 12 }; this.DemListRepository.GetByRetailerId(this.retailerId).Returns(this.retailerDemList); this.result = this.Sut.SetRetailerListRootProduct(this.retailerId, "/rp/50", 3, "/employees/100"); }
public void SetUp() { this.retailerId = 50; this.retailerDemList = new RetailerDemList(this.retailerId, "employee/200") { Id = 12 }; this.DemListRepository.GetByRetailerId(this.retailerId).Returns(this.retailerDemList); this.result = this.Sut.UpdateRetailerDemListDetails(this.retailerId, 1.April(2018), "/employees/100"); }
public void SetUp() { this.retailerId = 231; var existingDemList = new RetailerDemList(this.retailerId, "employee/200"); this.DemListRepository.GetByRetailerId(this.retailerId).Returns(existingDemList); this.action = () => this.Sut.CreateRetailerDemList(this.retailerId, "employee/200"); }
public void SetUp() { this.retailerId = 200; this.retailerDemList = new RetailerDemList(this.retailerId, "employee/200") { Id = 20 }; this.retailerDemList.SetLastReviewedDate(7.March(2018), "/employees/555"); this.retailerDemList.SetRootProductQuantity("/products/123", "/employees/555", 3); this.DemListRepository.GetByRetailerId(this.retailerId).Returns(this.retailerDemList); this.result = this.Sut.GetRetailerDemListActivities(this.retailerId); }
public void SetUp() { this.retailerDemList = new RetailerDemList(200, "/employee/200"); this.retailerDemList.SetRootProductQuantity("/products/100", "/employees/50", 3); this.DemStockService.GetRetailerDemList(200) .Returns(new SuccessResult <RetailerDemList>(this.retailerDemList)); this.Response = this.Browser.Get( "/retailers/200/dem-stock", with => { with.Header("Accept", "application/json"); }).Result; }
public void SetUp() { this.retailerDemList1 = new RetailerDemList(1, "/employee/200"); this.retailerDemList2 = new RetailerDemList(2, "/employee/200"); this.DemStockService.GetRetailerDemListsByLastReviewed() .Returns(new SuccessResult <IEnumerable <RetailerDemList> >(new[] { this.retailerDemList1, this.retailerDemList2 })); this.Response = this.Browser.Get( "/retailers/dem-stock/last-reviewed", with => { with.Header("Accept", "application/json"); }).Result; }
public static RetailerDemListModel ToModel( this RetailerDemList domain, RetailerResource retailer, SalesRegionResource salesRegion) { return(new RetailerDemListModel { RetailerId = domain.RetailerId, RetailerName = retailer?.Name, LastReviewed = domain.LastReviewedOn.HasValue ? DateTime.SpecifyKind(domain.LastReviewedOn.Value, DateTimeKind.Utc).ToString("d") : null, SalesRegion = salesRegion?.Name }); }
public void SetUp() { this.productUri = "/root-products/1"; this.retailerDemList1 = new RetailerDemList(1, "/employee/200"); this.retailerDemList2 = new RetailerDemList(2, "/employee/200"); this.DemStockService.GetRetailerDemListsWithoutProduct(this.productUri) .Returns(new SuccessResult <IEnumerable <RetailerDemList> >(new[] { this.retailerDemList1, this.retailerDemList2 })); this.Response = this.Browser.Get( "/retailers/dem-stock/lists-without-product", with => { with.Header("Accept", "application/json"); with.Query("productUri", this.productUri); }).Result; }
public void SetUp() { this.retailerDemList = new RetailerDemList(200, "/employee/200"); this.retailerDemList.SetRootProductQuantity("/products/100", "/employees/50", 3); this.retailerDemList.SetLastReviewedDate(13.April(2018), "/employees/21"); this.DemStockService.GetRetailerDemList(200) .Returns(new SuccessResult <RetailerDemList>(this.retailerDemList)); this.DemStockService.GetRetailerDemListActivities(200).Returns( new SuccessResult <IEnumerable <RetailerDemListActivity> >(this.retailerDemList.Activities)); this.Response = this.Browser.Get( "/retailers/200/dem-stock/activities", with => { with.Header("Accept", "application/json"); }).Result; }
public void SetUp() { this.rootProductUri = "/rp/1"; this.retailerDemList1 = new RetailerDemList(1, "/employee/200") { Id = 10, RootProducts = { new RootProduct("/rp/1") } }; this.retailerDemList2 = new RetailerDemList(2, "/employee/200") { Id = 20, RootProducts = { new RootProduct("/rp/2") } }; this.retailerDemList3 = new RetailerDemList(3, "/employee/200") { Id = 30, RootProducts = { new RootProduct("/rp/1") } }; this.DemListRepository.GetRetailerDemLists() .Returns(new[] { this.retailerDemList1, this.retailerDemList2, this.retailerDemList3 }); this.results = this.Sut.GetRetailerDemListModelsWithoutProduct(this.rootProductUri); }
public void SetUp() { this.requestResource = new UpdateDateRequestResource { UpdatedDate = "2018-03-14T13:45:33+00:00" }; this.retailerDemList = new RetailerDemList(234, "/employee/200"); this.retailerDemList.SetLastReviewedDate(1.April(2018), "/employees/21"); this.DemStockService.UpdateRetailerDemListDetails(234, Arg.Any <DateTime?>(), null) .Returns(new SuccessResult <RetailerDemList>(this.retailerDemList)); this.Response = this.Browser.Put( "/retailers/234/dem-stock", with => { with.Header("Accept", "application/json"); with.JsonBody(this.requestResource); }).Result; }
public void SetUp() { this.retailerDemList1 = new RetailerDemList(1, "/employee/200") { Id = 10 }; this.retailerDemList2 = new RetailerDemList(2, "/employee/200") { Id = 20 }; this.retailerDemList3 = new RetailerDemList(3, "/employee/200") { Id = 30 }; this.retailerDemList1.SetLastReviewedDate(7.May(2018), "/employees/555"); this.retailerDemList2.SetLastReviewedDate(7.April(2018), "/employees/555"); this.DemListRepository.GetRetailerDemLists() .Returns(new[] { this.retailerDemList1, this.retailerDemList2, this.retailerDemList3 }); this.results = this.Sut.GetRetailerDemListsByLastReviewed(); }
public void SetUp() { this.resource = new InvoiceResource { id = 123, lines = new List <InvoiceLineResource> { new InvoiceLineResource { quantity = 2, forDemonstration = false, links = new List <LinkResource> { new LinkResource("productUri", "/products/sales-parts/123") } }, new InvoiceLineResource { quantity = 1, forDemonstration = false, links = new List <LinkResource> { new LinkResource("productUri", "/products/sales-parts/456") } } }, links = new List <LinkResource> { new LinkResource("sales-customer", "/sales/customers/808") } }; this.retailerDemList = new RetailerDemList(444, null); this.RetailerProxy.GetRetailerId("/sales/customers/808").Returns(444); this.RetailerDemListRepository.GetByRetailerId(444).Returns(this.retailerDemList); this.ProductsProxy.GetRootProductUri("/products/sales-parts/123") .Returns("/products/root-products/888"); this.ProductsProxy.GetRootProductUri("/products/sales-parts/456") .Returns("/products/root-products/999"); this.Sut.CaptureDemRootProductsFromInvoice(this.resource); }
public void SetUp() { this.retailerId = 231; this.result = this.Sut.CreateRetailerDemList(this.retailerId, "employee/200"); }
public void Add(RetailerDemList retailerDemList) { this.serviceDbContext.RetailerDemLists.Add(retailerDemList); }