public void Can_Calculate_Total_Price_Second() { using (var scope = AutofacInjections.GetContainer().BeginLifetimeScope()) { // Arrange - create a terminal var terminal = scope.Resolve <IPointOfSaleTerminal>(); // Arrange - set pricing SetPricing(terminal); // Arrange - scan products terminal.Scan("C"); terminal.Scan("C"); terminal.Scan("C"); terminal.Scan("C"); terminal.Scan("C"); terminal.Scan("C"); terminal.Scan("C"); // Act var total = terminal.CompleteOrder(); // Assert Assert.AreEqual(total, 6); } }
public void Can_Create_New_Order() { using (var scope = AutofacInjections.GetContainer().BeginLifetimeScope()) { // Arrange - create a terminal var terminal = scope.Resolve <IPointOfSaleTerminal>(); // Arrange - set pricing SetPricing(terminal); // Act terminal.Scan("A"); terminal.Scan("A"); terminal.Scan("A"); var total_first_order = terminal.CompleteOrder(); // Act terminal.NewOrder(); terminal.Scan("D"); terminal.Scan("D"); terminal.Scan("D"); var total_second_order = terminal.CompleteOrder(); // Assert Assert.AreEqual(total_first_order, 3); Assert.AreEqual(total_second_order, 2.25); } }
public void Pass_Incorrect_Product_Price_Thrown_Argument_Exception() { using (var scope = AutofacInjections.GetContainer().BeginLifetimeScope()) { // Arrange - create a terminal var terminal = scope.Resolve <IPointOfSaleTerminal>(); // Act terminal.SetProductRetailPrice("Z", -0.5); } }
public void Set_Wholesale_Price_Before_Retail_Thrown_Exception_Product_Not_Found() { using (var scope = AutofacInjections.GetContainer().BeginLifetimeScope()) { // Arrange - create a terminal var terminal = scope.Resolve <IPointOfSaleTerminal>(); // Act terminal.SetProductWholesalePrice("Z", 1, 1); terminal.SetProductRetailPrice("Z", 1); } }
public void Scan_Unknown_Product_Thrown_Exception_Product_Not_Found() { using (var scope = AutofacInjections.GetContainer().BeginLifetimeScope()) { // Arrange - create a terminal var terminal = scope.Resolve <IPointOfSaleTerminal>(); // Arrange - set pricing SetPricing(terminal); // Act terminal.Scan("Z"); } }
public void New_Order_When_Prev_Not_Completed_Thrown_Exception_Order_Not_Completed() { using (var scope = AutofacInjections.GetContainer().BeginLifetimeScope()) { // Arrange - create a terminal var terminal = scope.Resolve <IPointOfSaleTerminal>(); // Arrange - set pricing SetPricing(terminal); terminal.Scan("A"); // Act terminal.NewOrder(); } }
public void Scan_After_Order_Complete_Thrown_Exception_Order_Not_Found() { using (var scope = AutofacInjections.GetContainer().BeginLifetimeScope()) { // Arrange - create a terminal var terminal = scope.Resolve <IPointOfSaleTerminal>(); // Arrange - set pricing SetPricing(terminal); terminal.Scan("A"); // Arrange - complete order terminal.CompleteOrder(); // Act terminal.Scan("A"); } }