public void SetUp()
        {
            _categoryService = new Mock <ICategoryService>();
            _eventPublisher  = new Mock <IEventPublisher>();

            _handler = new UpdateCategoryHandler(_categoryService.Object, _eventPublisher.Object);
        }
Esempio n. 2
0
        public async Task UpdateCategory_Success_ReturnUnit()
        {
            // Arrange
            // Mock data for product
            var category = new Category()
            {
                CategoryId = Constants.CategoryId,
                Name       = "Phone",
                Thumbnail  = "no-image.jpg"
            };

            _fuhoDbContext.Categories.AddRange(category);
            _fuhoDbContext.SaveChanges();

            var updateCategoryCommand = new UpdateCategoryCommand()
            {
                CategoryId = Constants.CategoryId,
                Name       = "Phone XXX",
                Thumbnail  = "image.jpg"
            };

            // Act
            var sut    = new UpdateCategoryHandler(_fuhoDbContext, _logger.Object);
            var result = await sut.Handle(updateCategoryCommand, CancellationToken.None);

            // Result
            Assert.IsType <Unit>(result);
        }
 public UpdateCategoryTests()
 {
     _context = ProductCatalogContextFactory.Create();
     _handler = new UpdateCategoryHandler(_context);
 }