public void ItemWithRegisteredBarcodeIsStoredInsideScannedItems(string barcode) { // Arrange var registry = new InMemoryItemRegistry(); var sut = new PointOfSaleServiceBuilder() .WithQuery(registry) .WithGenerator(new Mock <TransactionIdGenerator>().Object) .Build(); var expected = registry.Read(barcode); // Act sut.OnBarcodeScan(barcode); // Assert sut.ScannedItems.Should().Contain(expected); }
public void ScannedItemIsDisplayed() { // Arrange var registry = new InMemoryItemRegistry(); var sut = new Mock <Display>(); string barcode = "123456"; var sale = new PointOfSaleServiceBuilder() .WithQuery(new InMemoryItemRegistry()) .WithGenerator(new Mock <TransactionIdGenerator>().Object) .WithDisplay(sut.Object) .Build(); var expected = new ScannedBarcodeEventArgs(registry.Read(barcode)); // Act sale.OnBarcodeScan(barcode); // Assert sut.Verify(s => s.BarcodeHandler(sale, expected)); }