public void SetUp()
        {
            this.shipfileData = new ConsignmentShipfile
            {
                Id          = 1,
                Consignment = new Consignment
                {
                    SalesAccount =
                        new SalesAccount
                    {
                        OrgId          = null,
                        ContactDetails = new Contact()
                    }
                }
            };
            this.toSend = new List <ConsignmentShipfile>
            {
                new ConsignmentShipfile
                {
                    Id = 1,
                }
            };

            this.ShipfileRepository.FindById(1).Returns(this.shipfileData);

            this.result = this.Sut.SendEmails(this.toSend);
        }
Пример #2
0
        public void SetUp()
        {
            var account = new SalesAccount
            {
                OrgId          = null,
                ContactId      = 1,
                ContactDetails = new Contact {
                    EmailAddress = "*****@*****.**", AddressId = 1
                }
            };
            var consignment = new Consignment
            {
                ConsignmentId = 1,
                SalesAccount  = account,
                Items         = new List <ConsignmentItem> {
                    new ConsignmentItem {
                        OrderNumber = 1
                    }
                },
                Address = new Address {
                    Country = new Country {
                        CountryCode = "US"
                    }
                },
                Carrier = "TNT"
            };

            this.shipfileData = new ConsignmentShipfile
            {
                Id          = 1,
                Consignment = consignment
            };
            this.toSend = new List <ConsignmentShipfile>
            {
                new ConsignmentShipfile {
                    Id = 1, ConsignmentId = 1
                }
            };

            this.PackingListService.BuildPackingList(Arg.Any <IEnumerable <PackingListItem> >())
            .ReturnsForAnyArgs(new List <PackingListItem> {
                new PackingListItem(1, 1, "desc", 1m)
            });
            this.ShipfileRepository.FindById(1).Returns(this.shipfileData);
            this.ConsignmentRepository.FindById(Arg.Any <int>()).Returns(consignment);
            this.DataService.GetPdfModelData(Arg.Any <int>(), Arg.Any <int>()).Returns(
                new ConsignmentShipfilePdfModel
            {
                ConsignmentNumber = "1",
                PackingList       = new PackingListItem[] { },
                DespatchNotes     = new DespatchNote[] { new DespatchNote() },
                DateDispatched    = "12/05/2008 09:34:58"
            });
            this.result = this.Sut.SendEmails(this.toSend);
        }
        public void SetUp()
        {
            this.result = new ConsignmentShipfile
            {
                ConsignmentId = 1,
                Consignment   = new Consignment(),
            };

            this.ShipfileService.DeleteShipfile(1)
            .Returns(new SuccessResult <ConsignmentShipfile>(this.result));

            this.Response = this.Browser.Delete(
                $"/logistics/shipfiles/1",
                with =>
            {
                with.Header("Accept", "application/json");
            }).Result;
        }
        public void SetUp()
        {
            var account = new SalesAccount
            {
                OrgId          = 1,
                ContactId      = 1,
                ContactDetails = new Contact {
                    EmailAddress = "*****@*****.**", AddressId = 1
                }
            };
            var orders = new List <SalesOrder>
            {
                new SalesOrder
                {
                    SalesOutlet = new SalesOutlet
                    {
                        AccountId    = 1,
                        OutletNumber = 1,
                        OrderContact = new Contact
                        {
                            EmailAddress = null,
                            AddressId    = 1
                        }
                    }
                },
            };
            var outlet = new SalesOutlet {
                OutletAddressId = 1
            };
            var outlets = new List <SalesOutlet> {
                outlet
            };
            var consignment = new Consignment
            {
                SalesAccount = account,
                Items        = new List <ConsignmentItem> {
                    new ConsignmentItem {
                        OrderNumber = 1
                    }
                },
                Address = new Address {
                    Country = new Country {
                        CountryCode = "GB"
                    }
                }
            };

            this.shipfileData = new ConsignmentShipfile
            {
                Id          = 1,
                Consignment = consignment
            };

            this.toSend = new List <ConsignmentShipfile>
            {
                new ConsignmentShipfile {
                    Id = 1
                }
            };

            this.ShipfileRepository.FindById(1).Returns(this.shipfileData);

            this.OutletRepository.FilterBy(Arg.Any <Expression <Func <SalesOutlet, bool> > >())
            .Returns(outlets.AsQueryable());
            this.OutletRepository.FindBy(Arg.Any <Expression <Func <SalesOutlet, bool> > >()).Returns(outlet);
            this.SalesOrderRepository.FilterBy(Arg.Any <Expression <Func <SalesOrder, bool> > >()).Returns(orders.AsQueryable());
            this.ConsignmentRepository.FindById(1).Returns(consignment);
            this.DataService.GetPdfModelData(Arg.Any <int>(), Arg.Any <int>()).Returns(
                new ConsignmentShipfilePdfModel
            {
                PackingList       = new PackingListItem[] { },
                DespatchNotes     = new DespatchNote[] { new DespatchNote() },
                DateDispatched    = "12/05/2008 09:34:58",
                ConsignmentNumber = "1"
            });
            this.result = this.Sut.SendEmails(this.toSend);
        }