Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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");
 }
Ejemplo n.º 4
0
 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");
        }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 8
0
        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;
        }
Ejemplo n.º 9
0
 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
     });
 }
Ejemplo n.º 10
0
        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);
 }
Ejemplo n.º 13
0
        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();
 }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
0
 public void SetUp()
 {
     this.retailerId = 231;
     this.result     = this.Sut.CreateRetailerDemList(this.retailerId, "employee/200");
 }
Ejemplo n.º 17
0
 public void Add(RetailerDemList retailerDemList)
 {
     this.serviceDbContext.RetailerDemLists.Add(retailerDemList);
 }