public void WhenProductIsNullThenReturnNotSuccessfullActionResult()
        {
            var system = new ProductAdministrationService(Mock.Of <IProductRepository>(), Mock.Of <IUserRepository>(), Mock.Of <IProductCategoryRepository>());

            var actionResult = system.AddProduct(null);

            Assert.AreEqual(ActionStatus.NotSuccessfull, actionResult.Status);
        }
        public void WhenExceptionThrownFromProductRepositoryThenReturnNotSuccessfullActionResult()
        {
            var productDto        = new ProductDto();
            var productRepository = new Mock <IProductRepository>();

            productRepository.Setup(r => r.AddToDatabase(It.IsAny <Product>())).Throws <Exception>();
            var system = new ProductAdministrationService(productRepository.Object, Mock.Of <IUserRepository>(), Mock.Of <IProductCategoryRepository>());

            var actionResult = system.AddProduct(productDto);

            Assert.AreEqual(ActionStatus.NotSuccessfull, actionResult.Status);
        }
        public void WhenProductAddedToRepositoryThenServiceActionResultSuccessfullReturned()
        {
            var productRepository = new Mock <IProductRepository>();
            var system            = new ProductAdministrationService(productRepository.Object, Mock.Of <IUserRepository>(), Mock.Of <IProductCategoryRepository>());

            var actionResult = system.AddProduct(new ProductDto()
            {
                Description  = "Test",
                DefaultPrice = 100m,
//                ProductCategories = new []{new ProductCategoryDto()},
                ProductName = "TestName",
            });

            Assert.AreEqual(ServiceActionResult.Successfull, actionResult);
        }