예제 #1
0
        public void ShouldAddProductToTheAcquirerCatalog()
        {
            string sku = "999-vyk-317", description = "Cheese cake";

            _tenantRepositoryMock.Setup(m => m.Acquirer).Returns(new Tenant(Constants.Configuration.Acquirer,
                                                                            Constants.Configuration.Acquirer, new TenantConfig("p", "s", "ps")));

            _tenantRepositoryMock.Setup(m => m.Acquiree).Returns(new Tenant(Constants.Configuration.Acquiree,
                                                                            Constants.Configuration.Acquiree, new TenantConfig("p", "s", "ps")));

            _productRepositoryMock.Setup(m => m.GetBySku(Constants.Configuration.Acquirer, "999-vyk-317"))
            .Returns(new Product(sku, description));

            _inventoryManager = new InventoryManager(_productRepositoryMock.Object, _supplierRepositoryMock.Object,
                                                     _supplierProductBarcodeRepositoryMock.Object, _tenantRepositoryMock.Object);

            var catalogManager = new CatalogManager(_inventoryManager, _tenantRepositoryMock.Object,
                                                    _reportGeneratorMock.Object);

            catalogManager.AddProduct(sku, description);
            var product = _inventoryManager.GetProductBySku(Constants.Configuration.Acquirer, sku);

            Assert.AreEqual(product.Sku, sku);
            Assert.AreEqual(product.Description, description);
        }