public void EditForSalesOrder() { this.salesOrderListPage = this.Sidenav.NavigateToSalesOrders(); var salesOrder = new SalesOrders(this.Session).Extent().First; salesOrder.AddOrderAdjustment(new SurchargeAdjustmentBuilder(this.Session).WithAmountDefaults().Build()); this.Session.Derive(); this.Session.Commit(); var before = new OrderAdjustments(this.Session).Extent().ToArray(); var expected = new SurchargeAdjustmentBuilder(this.Session).WithAmountDefaults().Build(); var surchargeAdjustment = salesOrder.OrderAdjustments.First(); var id = surchargeAdjustment.Id; this.Session.Derive(); var expectedAmount = expected.Amount; var expectedDescription = expected.Description; this.salesOrderListPage.Table.DefaultAction(salesOrder); var salesOrderOverview = new SalesOrderOverviewComponent(this.salesOrderListPage.Driver); var adjustmentOverviewPanel = salesOrderOverview.OrderadjustmentOverviewPanel.Click(); adjustmentOverviewPanel.Table.DefaultAction(surchargeAdjustment); var adjustmentEdit = new OrderAdjustmentEditComponent(this.Driver); adjustmentEdit.Amount.Set(expected.Amount.ToString()); adjustmentEdit.Description.Set(expected.Description); this.Session.Rollback(); adjustmentEdit.SAVE.Click(); this.Driver.WaitForAngular(); this.Session.Rollback(); var after = new OrderAdjustments(this.Session).Extent().ToArray(); var actual = (SurchargeAdjustment)this.Session.Instantiate(id); Assert.Equal(after.Length, before.Length); Assert.Equal(expectedAmount, actual.Amount); Assert.Equal(expectedDescription, actual.Description); }
public void CreatePercentageForSalesOrder() { this.salesOrderListPage = this.Sidenav.NavigateToSalesOrders(); var salesOrder = new SalesOrders(this.Session).Extent().First; var before = new MiscellaneousCharges(this.Session).Extent().ToArray(); var expected = new MiscellaneousChargeBuilder(this.Session).WithPercentageDefaults().Build(); salesOrder.AddOrderAdjustment(expected); this.Session.Derive(); Assert.True(expected.ExistPercentage); Assert.True(expected.ExistDescription); var expectedPercentage = expected.Percentage; var expectedDescription = expected.Description; this.salesOrderListPage.Table.DefaultAction(salesOrder); var miscellaneousChargeCreate = new SalesOrderOverviewComponent(this.salesOrderListPage.Driver).OrderadjustmentOverviewPanel.Click().CreateMiscellaneousCharge(); miscellaneousChargeCreate .Percentage.Set(expectedPercentage.ToString()) .Description.Set(expectedDescription); this.Session.Rollback(); miscellaneousChargeCreate.SAVE.Click(); this.Driver.WaitForAngular(); this.Session.Rollback(); var after = new MiscellaneousCharges(this.Session).Extent().ToArray(); Assert.Equal(after.Length, before.Length + 1); var actual = after.Except(before).First(); Assert.Equal(expectedPercentage, actual.Percentage); Assert.Equal(expectedDescription, actual.Description); }
public void CreateAmountForSalesOrder() { this.salesOrderListPage = this.Sidenav.NavigateToSalesOrders(); var salesOrder = new SalesOrders(this.Session).Extent().First; var before = new SurchargeAdjustments(this.Session).Extent().ToArray(); var expected = new SurchargeAdjustmentBuilder(this.Session).WithAmountDefaults().Build(); salesOrder.AddOrderAdjustment(expected); this.Session.Derive(); Assert.True(expected.ExistAmount); Assert.True(expected.ExistDescription); var expectedAmount = expected.Amount; var expectedDescription = expected.Description; this.salesOrderListPage.Table.DefaultAction(salesOrder); var surchargeAdjustmentCreate = new SalesOrderOverviewComponent(this.salesOrderListPage.Driver).OrderadjustmentOverviewPanel.Click().CreateSurchargeAdjustment(); surchargeAdjustmentCreate .Amount.Set(expectedAmount.ToString()) .Description.Set(expectedDescription); this.Session.Rollback(); surchargeAdjustmentCreate.SAVE.Click(); this.Driver.WaitForAngular(); this.Session.Rollback(); var after = new SurchargeAdjustments(this.Session).Extent().ToArray(); Assert.Equal(after.Length, before.Length + 1); var actual = after.Except(before).First(); Assert.Equal(expectedAmount, actual.Amount); Assert.Equal(expectedDescription, actual.Description); }