public void DeleteGroceriesCommandHandlerShouldntReturnNotification() { var _mock = MockRepository.GenerateMock <IGroceriesRepository>(); var command = new DeleteGroceriesCommand(Guid.NewGuid()); _mock.Expect(x => x.GetById(command.Id)).Return(new Groceries(command.Id, "Test3", 30, Unity.Unity, Category.Beverages)); DeleteGroceriesCommandHandler handler = new DeleteGroceriesCommandHandler(_mock); var g = handler.Handle(command); Assert.AreEqual(handler.Notifications.Count, 0); }
public void DeleteGroceriesCommandHandlerShoulReturnNotification() { var _mock = MockRepository.GenerateMock <IGroceriesRepository>(); var command = new DeleteGroceriesCommand(Guid.NewGuid()); _mock.Expect(x => x.GetById(command.Id)).Return(null); DeleteGroceriesCommandHandler handler = new DeleteGroceriesCommandHandler(_mock); var g = handler.Handle(command); Assert.AreNotEqual(handler.Notifications.Count, 0); }
public GroceriesController(RegisterGroceriesCommandHandler registerGroceriesCommandHandler, UpdateGroceriesCommandHandler updateGroceriesCommandHandler, DeleteGroceriesCommandHandler deleteGroceriesCommandHandler, SearchGroceriesCommandHandler searchGroceriesCommandHandler, GetGroceriesCommandHandler getGroceriesCommandHandler, UpdateGroceriesPositionCommandHandler updateGroceriesPositionCommandHandler) { _registerGroceriesCommandHandler = registerGroceriesCommandHandler; _updateGroceriesCommandHandler = updateGroceriesCommandHandler; _deleteGroceriesCommandHandler = deleteGroceriesCommandHandler; _searchGroceriesCommandHandler = searchGroceriesCommandHandler; _getGroceriesCommandHandler = getGroceriesCommandHandler; _updateGroceriesPositionCommandHandler = updateGroceriesPositionCommandHandler; }