Beispiel #1
0
 public ProductCore(IProductRepository productRepository, IBarCodeRepository codeRepository, IInventoryItemCore inventoryCore, IMapper mapper)
 {
     this.productRepository = productRepository;
     this.codeRepository    = codeRepository;
     this.inventoryCore     = inventoryCore;
     this.mapper            = mapper;
 }
Beispiel #2
0
        public void GetProductShouldReturnProduct()
        {
            IProductRepository productRepository = Substitute.For <IProductRepository>();
            IBarCodeRepository codeRepository    = Substitute.For <IBarCodeRepository>();
            IInventoryItemCore inventoryCore     = Substitute.For <IInventoryItemCore>();
            IMapper            mapper            = Substitute.For <IMapper>();

            string products = Data.ResourceManager.GetString("Products");
            IEnumerable <Product> lstProducts = JsonConvert.DeserializeObject <IEnumerable <Product> >(products);

            productRepository.Find(1).Returns(lstProducts.First(lp => lp.Id == 1));

            IProductCore controller = new ProductCore(productRepository, codeRepository, inventoryCore, mapper);

            var result = controller.Find(1);

            result.ProductId.Should().Be(1);
        }
Beispiel #3
0
        public void GetProductsShouldReturnAllProducts()
        {
            IProductRepository productRepository = Substitute.For <IProductRepository>();
            IBarCodeRepository codeRepository    = Substitute.For <IBarCodeRepository>();
            IInventoryItemCore inventoryCore     = Substitute.For <IInventoryItemCore>();
            IMapper            mapper            = Substitute.For <IMapper>();

            string products = Data.ResourceManager.GetString("Products");
            IEnumerable <Product> lstProducts = JsonConvert.DeserializeObject <IEnumerable <Product> >(products);

            productRepository.GetAll().Returns(lstProducts);

            IProductCore controller = new ProductCore(productRepository, codeRepository, inventoryCore, mapper);

            var result = controller.GetAll();

            result.Should().HaveCount(4);
        }
 public InventoryController(IInventoryItemCore inventoryCore, ILogger <InventoryController> logger)
 {
     _inventoryCore = inventoryCore;
     _logger        = logger;
 }