public void SetUp() { this.requestResource = new ProposedTurnoverBandRequestResource { FinancialYear = "2018/19" }; this.proposedTurnoverBands = new List <ProposedTurnoverBand> { new ProposedTurnoverBand { CalculatedTurnoverBandUri = "/1", SalesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "one")) }, new ProposedTurnoverBand { CalculatedTurnoverBandUri = "/2", SalesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 2, "two")) } }; var turnoverBand = new TurnoverBand { Name = "n", TurnoverBandUri = "/1" }; var proposal = new TurnoverBandProposal(this.requestResource.FinancialYear, this.proposedTurnoverBands); this.TurnoverBandService.GetProposedTurnoverBandModelResults(this.requestResource.FinancialYear) .Returns(new SuccessResult <IEnumerable <ProposedTurnoverBandModel> >(proposal.ProposedTurnoverBands.Select(a => a.ToModel(turnoverBand, turnoverBand, turnoverBand)))); this.Response = this.Browser.Get( "/sales/accounts/turnover-band-proposals/export", with => { with.Query("financialYear", this.requestResource.FinancialYear); }).Result; }
public void SetUp() { this.requestResource = new ProposedTurnoverBandRequestResource { FinancialYear = "2018/19" }; this.proposedTurnoverBands = new List <ProposedTurnoverBand> { new ProposedTurnoverBand { CalculatedTurnoverBandUri = "/1", SalesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 1, "one")) }, new ProposedTurnoverBand { CalculatedTurnoverBandUri = "/2", SalesAccount = new SalesAccount(new SalesAccountCreateActivity("/employees/100", 2, "two")) } }; var proposal = new TurnoverBandProposal(this.requestResource.FinancialYear, this.proposedTurnoverBands); this.TurnoverBandService.ApplyTurnoverBandProposal("2018/19", null) .Returns(new SuccessResult <TurnoverBandProposal>(proposal)); this.Response = this.Browser.Post( "/sales/accounts/turnover-band-proposals/apply", with => { with.Header("Accept", "application/json"); with.Header("Content-Type", "application/json"); with.JsonBody(this.requestResource); }).Result; }
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); }