public void SetUp()
        {
            this.financialYear = "2018/19";
            this.account       = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "one"))
            {
                DiscountSchemeUri = "/ds/1",
                TurnoverBandUri   = "/tb/1"
            };

            this.proposedTurnoverBands = new List <ProposedTurnoverBand>
            {
                new ProposedTurnoverBand
                {
                    SalesAccount              = this.account,
                    FinancialYear             = this.financialYear,
                    SalesValueCurrency        = 1,
                    CalculatedTurnoverBandUri = "/tb/2",
                    ProposedTurnoverBandUri   = "/tb/2",
                    AppliedToAccount          = true
                }
            };
            this.ProposedTurnoverBandRepository.GetAllForFinancialYear(this.financialYear)
            .Returns(this.proposedTurnoverBands);
            this.results = this.Sut.ApplyTurnoverBandProposal(this.financialYear, "/employees/100").ProposedTurnoverBands;
        }
        public void SetUp()
        {
            this.salesAccountUpdateResource = new SalesAccountUpdateResource
            {
                TurnoverBandUri               = "/tb/10",
                DiscountSchemeUri             = "/ds/10",
                EligibleForGoodCreditDiscount = true
            };

            this.salesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "name"))
            {
                Id = 111
            };

            this.discountScheme = new DiscountScheme {
                DiscountSchemeUri = "/ds/10", TurnoverBandUris = new[] { "/tb/10" }
            };
            this.DiscountingService.GetDiscountScheme(this.salesAccountUpdateResource.DiscountSchemeUri)
            .Returns(this.discountScheme);
            this.SalesAccountRepository.GetById(111).Returns(this.salesAccount);

            this.Response = this.Browser.Put(
                "/sales/accounts/111",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Header("Content-Type", "application/json");
                with.JsonBody(this.salesAccountUpdateResource);
            }).Result;
        }
Пример #3
0
        public void SetUp()
        {
            this.financialYear = "2018/19";
            var salesAccount =
                new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "Name"))
            {
                TurnoverBandUri = "/tb/3"
            };

            this.proposedTurnoverBands = new List <ProposedTurnoverBand>
            {
                new ProposedTurnoverBand
                {
                    Id                        = 808,
                    SalesAccount              = salesAccount,
                    SalesValueCurrency        = 1.1m,
                    ProposedTurnoverBandUri   = "/tb/1",
                    CalculatedTurnoverBandUri = "/tb/2"
                }
            };
            this.ProposedTurnoverBandRepository.GetAllForFinancialYear(this.financialYear)
            .Returns(this.proposedTurnoverBands);
            this.DiscountingService.GetTurnoverBand("/tb/1").Returns(new TurnoverBand {
                Name = "turnover band 1", TurnoverBandUri = "/tb/1"
            });
            this.DiscountingService.GetTurnoverBand("/tb/2").Returns(new TurnoverBand {
                Name = "turnover band 2", TurnoverBandUri = "/tb/2"
            });
            this.DiscountingService.GetTurnoverBand("/tb/3").Returns(new TurnoverBand {
                Name = "turnover band 3", TurnoverBandUri = "/tb/3"
            });
            this.results = this.Sut.GetProposedTurnoverBandModelResults(this.financialYear);
        }
Пример #4
0
 public void SetUp()
 {
     this.salesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "name"));
     this.salesAccount.UpdateGrowthPartner(new SalesAccountGrowthPartnerActivity("/employees/100", true));
     this.salesAccount.CloseAccount(new SalesAccountCloseActivity("/employees/100", 16.April(2018)));
     this.SalesAccountRepository.GetById(1).Returns(this.salesAccount);
     this.Result = this.Sut.GetById(1);
 }
 public void SetUp()
 {
     this.salesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 123, "search something"))
     {
         Id = 1
     };
     this.SalesAccountRepository.GetById(123).Returns(this.salesAccount);
     this.Results = this.Sut.Get("123");
 }
 public void SetUp()
 {
     this.salesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 123, "account"))
     {
         Id = 1
     };
     this.SalesAccountRepository.GetAllOpenAccounts().Returns(new[] { this.salesAccount });
     this.Results = this.Sut.Get(string.Empty);
 }
Пример #7
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);
        }
Пример #8
0
        public void SetUp()
        {
            this.salesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "name"))
            {
                Id = 111
            };
            this.SalesAccountRepository.GetById(111).Returns(this.salesAccount);

            this.Response = this.Browser.Get(
                "/sales/accounts/111",
                with => { with.Header("Accept", "application/json"); }).Result;
        }
Пример #9
0
        public void SetUp()
        {
            this.financialYear = "2018/19";
            this.account1      = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "one"))
            {
                DiscountSchemeUri = "/ds/1", TurnoverBandUri = "/tb/1"
            };
            this.account2 = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 2, "two"))
            {
                DiscountSchemeUri = "/ds/2"
            };
            this.account3 = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 3, "three"))
            {
                DiscountSchemeUri = "/ds/1", TurnoverBandUri = "/tb/1"
            };
            this.account4 = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 4, "four"))
            {
                DiscountSchemeUri = "/ds/1", TurnoverBandUri = "/tb/1"
            };

            var discountScheme1 = new DiscountScheme {
                DiscountSchemeUri = "/ds/1", TurnoverBandSetUri = "/tbs/1"
            };
            var discountScheme2 = new DiscountScheme {
                DiscountSchemeUri = "/ds/2"
            };

            this.DiscountingService.GetDiscountScheme("/ds/1").Returns(discountScheme1);
            this.DiscountingService.GetDiscountScheme("/ds/2").Returns(discountScheme2);
            this.DiscountingService.GetTurnoverBandForTurnoverValue("/tbs/1", "GBP", 111).Returns("/tb/1");
            this.DiscountingService.GetTurnoverBandForTurnoverValue("/tbs/1", "EUR", 333).Returns("/tb/2");
            this.ProposedTurnoverBandRepository.GetAllForFinancialYear(this.financialYear)
            .Returns(new ProposedTurnoverBand[0]);
            this.SalesReportingService.GetSalesByAccount(this.financialYear)
            .Returns(new List <SalesDataDetail>
            {
                new SalesDataDetail {
                    Id = "1", CurrencyValue = 111, CurrencyCode = "GBP", BaseValue = 111
                },
                new SalesDataDetail {
                    Id = "2", CurrencyValue = 222, CurrencyCode = "GBP", BaseValue = 222
                },
                new SalesDataDetail {
                    Id = "3", CurrencyValue = 333, CurrencyCode = "EUR", BaseValue = 333
                },
                new SalesDataDetail {
                    Id = "4", CurrencyValue = 333, CurrencyCode = "NEW", BaseValue = 333
                }
            });
            this.SalesAccountRepository.GetAllOpenAccounts()
            .Returns(new[] { this.account1, this.account2, this.account3, this.account4 });
            this.result = this.Sut.CalculateProposedTurnoverBands(this.financialYear);
        }
Пример #10
0
        public void SetUp()
        {
            this.salesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "name"));
            this.SalesAccountRepository.Get("search").Returns(new[] { this.salesAccount });

            this.Response = this.Browser.Get(
                "/sales/accounts",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Query("searchTerm", "search");
            }).Result;
        }
 public void SetUp()
 {
     this.salesAccount1 = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 123, "account 1"))
     {
         Id = 1
     };
     this.salesAccount2 = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 456, "123rd Street"))
     {
         Id = 2
     };
     this.SalesAccountRepository.GetById(123).Returns(this.salesAccount1);
     this.SalesAccountRepository.Get("123").Returns(new[] { this.salesAccount2 });
     this.Results = this.Sut.Get("123");
 }
Пример #12
0
        public IResult <SalesAccount> AddSalesAccount(SalesAccountCreateResource createResource, string updatedByUri)
        {
            var createActivity = new SalesAccountCreateActivity(
                updatedByUri,
                createResource.AccountId,
                createResource.Name,
                string.IsNullOrEmpty(createResource.ClosedOn) ? (DateTime?)null : DateTime.Parse(createResource.ClosedOn));
            var account = new SalesAccount(createActivity);

            this.salesAccountRepository.Add(account);
            this.transactionManager.Commit();

            return(new CreatedResult <SalesAccount>(account));
        }
        private SalesDataDetail GetSalesForSalesAccount(
            IEnumerable <SalesDataDetail> salesDataDetails,
            SalesAccount salesAccount)
        {
            var sales = salesDataDetails.FirstOrDefault(s => s.Id == salesAccount.Id.ToString());

            return(sales ?? new SalesDataDetail
            {
                CurrencyValue = 0m,
                BaseValue = 0m,
                Id = salesAccount.Id.ToString(),
                Name = salesAccount.Name
            });
        }
Пример #14
0
        public void SetUpContext()
        {
            this.SalesAccount                  = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "name"));
            this.SalesAccountRepository        = Substitute.For <ISalesAccountRepository>();
            this.SalesAccountUpdatedDispatcher = Substitute.For <ISalesAccountUpdatedDispatcher>();
            this.DiscountingService            = Substitute.For <IDiscountingService>();
            this.SalesAccountRepository.GetById(1).Returns(this.SalesAccount);
            this.TransactionManager = Substitute.For <ITransactionManager>();

            this.Sut = new SalesAccountService(
                this.TransactionManager,
                this.SalesAccountRepository,
                this.DiscountingService,
                this.SalesAccountUpdatedDispatcher);
        }
Пример #15
0
 public static SalesAccountMessage ToMessage(this SalesAccount salesAccount)
 {
     return(new SalesAccountMessage
     {
         Id = salesAccount.Id,
         Href = $"/sales/accounts/{salesAccount.Id}",
         Name = salesAccount.Name,
         DiscountSchemeUri = salesAccount.DiscountSchemeUri,
         EligibleForGoodCreditDiscount = salesAccount.EligibleForGoodCreditDiscount,
         EligibleForRebate = salesAccount.EligibleForRebate,
         GrowthPartner = salesAccount.GrowthPartner,
         TurnoverBandUri = salesAccount.TurnoverBandUri,
         ClosedOn = salesAccount.ClosedOn?.ToString("o")
     });
 }
        private string GetTurnoverBandForSalesAccount(SalesAccount salesAccount, SalesDataDetail salesData)
        {
            if (string.IsNullOrEmpty(salesAccount.DiscountSchemeUri))
            {
                return(null);
            }

            var discountScheme = this.discountingService.GetDiscountScheme(salesAccount.DiscountSchemeUri);

            if (!string.IsNullOrEmpty(discountScheme.TurnoverBandSetUri))
            {
                return(this.discountingService.GetTurnoverBandForTurnoverValue(
                           discountScheme.TurnoverBandSetUri,
                           salesData.CurrencyCode ?? "GBP",
                           salesData.CurrencyValue));
            }

            return(null);
        }
        private void AddOrUpdateProposedTurnoverBand(
            IList <ProposedTurnoverBand> proposedTurnoverBands,
            SalesAccount salesAccount,
            string turnoverBandUri,
            SalesDataDetail salesForAccount,
            string financialYear)
        {
            if (string.IsNullOrEmpty(turnoverBandUri) && string.IsNullOrEmpty(salesAccount.TurnoverBandUri))
            {
                return;
            }

            var proposedTurnoverBand = proposedTurnoverBands.FirstOrDefault(t => t.SalesAccount.Id == salesAccount.Id);

            if (proposedTurnoverBand == null)
            {
                proposedTurnoverBand = new ProposedTurnoverBand
                {
                    SalesAccount              = salesAccount,
                    FinancialYear             = financialYear,
                    CalculatedTurnoverBandUri = turnoverBandUri,
                    ProposedTurnoverBandUri   = turnoverBandUri,
                    AppliedToAccount          = false,
                    SalesValueBase            = salesForAccount.BaseValue,
                    CurrencyCode              = salesForAccount.CurrencyCode,
                    SalesValueCurrency        = salesForAccount.CurrencyValue
                };
                proposedTurnoverBands.Add(proposedTurnoverBand);
                this.proposedTurnoverBandRepository.Add(proposedTurnoverBand);
            }
            else
            {
                if (!proposedTurnoverBand.AppliedToAccount)
                {
                    proposedTurnoverBand.CalculatedTurnoverBandUri = turnoverBandUri;
                    proposedTurnoverBand.ProposedTurnoverBandUri   = turnoverBandUri;
                    proposedTurnoverBand.SalesValueBase            = salesForAccount.BaseValue;
                    proposedTurnoverBand.CurrencyCode       = salesForAccount.CurrencyCode ?? proposedTurnoverBand.CurrencyCode;
                    proposedTurnoverBand.SalesValueCurrency = salesForAccount.CurrencyValue;
                    proposedTurnoverBand.IncludeProposalInUpdate();
                }
            }
        }
        public void SetUp()
        {
            var account1 = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "one"));

            this.financialYear = "2018/19";
            this.ProposedTurnoverBandService.ApplyTurnoverBandProposal(this.financialYear, "/employees/100")
            .Returns(new TurnoverBandProposal(
                         this.financialYear,
                         new List <ProposedTurnoverBand>
            {
                new ProposedTurnoverBand
                {
                    SalesAccount              = account1,
                    FinancialYear             = this.financialYear,
                    CalculatedTurnoverBandUri = "/tb/1"
                }
            }));
            this.Results = this.Sut.ApplyTurnoverBandProposal(this.financialYear, "/employees/100");
        }
        public void SetUp()
        {
            var discountScheme = new DiscountScheme {
                DiscountSchemeUri = "/ds/1", TurnoverBandUris = new[] { "/tb/1" }
            };
            var address = new SalesAccountAddress("ln1", "ln2", string.Empty, string.Empty, "/countries/UK", "post");

            this.salesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "name", 4.May(2018)))
            {
                Id = 1
            };
            this.salesAccount.UpdateAccount("/employees/100", discountScheme, "/tb/1", true, true, true);
            this.salesAccount.UpdateNameAndAddress("/employees/100", "new name", address);
            this.salesAccount.CloseAccount(new SalesAccountCloseActivity("/employees/100", 17.April(2018)));

            this.SalesAccountRepository.GetById(1).Returns(this.salesAccount);

            this.Response = this.Browser.Get(
                "/sales/accounts/1/activities",
                with => { with.Header("Accept", "application/json"); }).Result;
        }
        public void SetUp()
        {
            this.financialYear = "2018/19";
            this.account1      = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "one"))
            {
                DiscountSchemeUri = "/ds/1",
                TurnoverBandUri   = "/tb/1"
            };

            var proposedTurnoverBands = new List <ProposedTurnoverBand>
            {
                new ProposedTurnoverBand
                {
                    SalesAccount              = this.account1,
                    FinancialYear             = this.financialYear,
                    AppliedToAccount          = true,
                    SalesValueCurrency        = 1,
                    ProposedTurnoverBandUri   = "/tb/100",
                    CalculatedTurnoverBandUri = "/tb/100"
                }
            };

            this.ProposedTurnoverBandRepository.GetAllForFinancialYear(this.financialYear)
            .Returns(proposedTurnoverBands);
            var discountScheme1 = new DiscountScheme {
                DiscountSchemeUri = "/ds/1", TurnoverBandSetUri = "/tbs/1"
            };

            this.DiscountingService.GetDiscountScheme("/ds/1").Returns(discountScheme1);
            this.DiscountingService.GetTurnoverBandForTurnoverValue("/tbs/1", "GBP", 111).Returns("/tb/1");
            this.SalesReportingService.GetSalesByAccount(this.financialYear)
            .Returns(new List <SalesDataDetail>
            {
                new SalesDataDetail {
                    Id = "1", CurrencyValue = 111, CurrencyCode = "GBP", BaseValue = 111
                }
            });
            this.SalesAccountRepository.GetAllOpenAccounts().Returns(new[] { this.account1 });
            this.results = this.Sut.CalculateProposedTurnoverBands(this.financialYear).ProposedTurnoverBands;
        }
Пример #21
0
        public void SetUp()
        {
            var acct1 = new SalesAccount {
                AccountId = 1, AccountName = "acct1"
            };
            var acct2 = new SalesAccount {
                AccountId = 2, AccountName = "acct2"
            };

            this.SalesAccountService.SearchSalesAccounts("acct").Returns(
                new SuccessResult <IEnumerable <SalesAccount> >(new List <SalesAccount> {
                acct1, acct2
            }));

            this.Response = this.Browser.Get(
                "/inventory/sales-accounts",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Query("searchTerm", "acct");
            }).Result;
        }
Пример #22
0
        public void SetUp()
        {
            this.salesAccountCloseResource = new SalesAccountCloseResource {
                ClosedOn = "2018-01-30T11:41:53.0000000+00:00"
            };

            this.salesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "name"))
            {
                Id = 111
            };

            this.SalesAccountRepository.GetById(111).Returns(this.salesAccount);

            this.Response = this.Browser.Delete(
                "/sales/accounts/111",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Header("Content-Type", "application/json");
                with.JsonBody(this.salesAccountCloseResource);
            }).Result;
        }
Пример #23
0
        /// <summary>
        /// Method to process deposit & withdraw to accounts
        /// </summary>
        /// <param name="payables"></param>
        public virtual void Process(List <IPayable> payables)
        {
            foreach (IPayable payable in payables)
            {
                // Get amount
                decimal amount = payable.GetAmount();

                if (payable is Sale)
                {
                    // Withdraw the expense
                    SalesAccount.Deposit(amount);
                }

                else if (payable is Expense)
                {
                    // Withdraw the expense
                    ExpensesAccount.Withdraw(amount);
                }

                // Set IsProcessed to true
                payable.IsProcessed = true;
            }
        }
Пример #24
0
 public void SetUp()
 {
     this.salesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "name"));
     this.SalesAccountRepository.GetById(1).Returns(this.salesAccount);
     this.Result = this.Sut.GetById(1);
 }
        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);
        }
 public void SetUp()
 {
     this.createActivity = new SalesAccountCreateActivity("/employees/100", 1, "New Account", 1.December(2018));
     this.result         = new SalesAccount(this.createActivity);
 }
Пример #27
0
 public void SetUpContext()
 {
     this.Sut = new SalesAccount(new SalesAccountCreateActivity("employees/100", 10, "Account 10"));
 }
Пример #28
0
        public void SetUp()
        {
            this.financialYear = "2018/19";
            this.account1      = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "one"))
            {
                DiscountSchemeUri = "/ds/1", TurnoverBandUri = "/tb/1"
            };
            this.account2 = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 2, "two"))
            {
                DiscountSchemeUri = "/ds/1", TurnoverBandUri = "/tb/1"
            };
            this.account3 = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 3, "three"))
            {
                DiscountSchemeUri = "/ds/1", TurnoverBandUri = "/tb/1"
            };
            this.account4 = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 4, "four"))
            {
                DiscountSchemeUri = "/ds/1", TurnoverBandUri = "/tb/1"
            };
            this.account5 = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 5, "closed"))
            {
                DiscountSchemeUri = "/ds/1", TurnoverBandUri = "/tb/1"
            };
            this.account5.CloseAccount(new SalesAccountCloseActivity("/employees/100", 1.May(2018)));

            this.proposedTurnoverBand5 = new ProposedTurnoverBand
            {
                SalesAccount       = this.account5,
                FinancialYear      = this.financialYear,
                SalesValueCurrency = 1
            };
            var proposedTurnoverBands = new List <ProposedTurnoverBand>
            {
                new ProposedTurnoverBand {
                    SalesAccount = this.account1, FinancialYear = this.financialYear, SalesValueCurrency = 1
                },
                new ProposedTurnoverBand {
                    SalesAccount = this.account2, FinancialYear = this.financialYear, SalesValueCurrency = 1
                },
                new ProposedTurnoverBand {
                    SalesAccount = this.account3, FinancialYear = this.financialYear, SalesValueCurrency = 1
                },
                this.proposedTurnoverBand5
            };

            this.ProposedTurnoverBandRepository.GetAllForFinancialYear(this.financialYear)
            .Returns(proposedTurnoverBands);
            var discountScheme1 = new DiscountScheme {
                DiscountSchemeUri = "/ds/1", TurnoverBandSetUri = "/tbs/1"
            };
            var discountScheme2 = new DiscountScheme {
                DiscountSchemeUri = "/ds/2"
            };

            this.DiscountingService.GetDiscountScheme("/ds/1").Returns(discountScheme1);
            this.DiscountingService.GetDiscountScheme("/ds/2").Returns(discountScheme2);
            this.DiscountingService.GetTurnoverBandForTurnoverValue("/tbs/1", "GBP", 111).Returns("/tb/1");
            this.DiscountingService.GetTurnoverBandForTurnoverValue("/tbs/1", "GBP", 222).Returns("/tb/1");
            this.DiscountingService.GetTurnoverBandForTurnoverValue("/tbs/1", "GBP", 333).Returns("/tb/2");
            this.DiscountingService.GetTurnoverBandForTurnoverValue("/tbs/1", "GBP", 444).Returns("/tb/2");
            this.SalesReportingService.GetSalesByAccount(this.financialYear)
            .Returns(new List <SalesDataDetail>
            {
                new SalesDataDetail {
                    Id = "1", CurrencyValue = 111, CurrencyCode = "GBP", BaseValue = 111
                },
                new SalesDataDetail {
                    Id = "2", CurrencyValue = 222, CurrencyCode = "GBP", BaseValue = 222
                },
                new SalesDataDetail {
                    Id = "4", CurrencyValue = 444, CurrencyCode = "GBP", BaseValue = 444
                },
                new SalesDataDetail {
                    Id = "5", CurrencyValue = 111, CurrencyCode = "GBP", BaseValue = 111
                }
            });
            this.SalesAccountRepository.GetAllOpenAccounts().Returns(new[] { this.account1, this.account2, this.account3, this.account4 });
            this.results = this.Sut.CalculateProposedTurnoverBands(this.financialYear).ProposedTurnoverBands;
        }
Пример #29
0
 public void Add(SalesAccount salesAccount)
 {
     this.serviceDbContext.SalesAccounts.Add(salesAccount);
 }