Esempio n. 1
0
        public async Task Able_to_generate_invoice()
        {
            var product     = ProductMockBuilder.Build();
            var productRepo = Substitute.For <IProductRepository>();

            productRepo.Get(Arg.Any <Guid>()).Returns(product);

            var supplier     = SupplierMockBuilder.Build();
            var supplierRepo = Substitute.For <ISupplierRepository>();

            supplierRepo.Get(Arg.Any <Guid>()).Returns(supplier);

            var customer     = CustomerMockBuilder.Build();
            var customerRepo = Substitute.For <ICustomerRepository>();

            customerRepo.Get(Arg.Any <Guid>()).Returns(customer);

            var sut    = new InvoiceGenerator(productRepo, supplierRepo, customerRepo);
            var actual = await sut.Generate(OrderMockBuilder.Build());

            actual.Customer.Should().Be(customer);
            actual.Supplier.Should().Be(supplier);
            actual.Product.Should().Be(product);
            actual.Amount.Should().Be(new InvoiceAmount(30, 0.19));
        }
Esempio n. 2
0
        public override async Task Able_to_get_existing_entity()
        {
            var product = ProductMockBuilder.Build();
            await _sut.Save(product);

            var actual = await _sut.Get(product.Id);

            actual.Should().Be(product);
        }