Exemplo n.º 1
0
        public void JjKellerShouldHandleEmployeeDeletedEvent()
        {
            //Arrange
            var logger           = new Mock <ILogger>();
            var employeeProvider = new Mock <IEmployeeWriteProvider>();
            var jjKeller         = new JjKeller(logger.Object, employeeProvider.Object);

            //Act
            var handler = jjKeller as IHandle <EmployeeDeletedEvent>;

            Assert.IsNull(handler);
        }
Exemplo n.º 2
0
        public async Task JjKellerShouldHandleEmployeeUpdatedEvent()
        {
            //Arrange
            var logger           = new Mock <ILogger>();
            var employeeProvider = new Mock <IEmployeeWriteProvider>();
            var jjKeller         = new JjKeller(logger.Object, employeeProvider.Object);
            var handler          = jjKeller as IHandle <EmployeeUpdatedEvent>;
            var e = new EmployeeUpdatedEvent(_employeeWithProviders, DateTime.Now);

            //Act
            await handler.Handle(e);

            //Assert
            employeeProvider.Verify(f => f.UpdateEmployee(_employeeWithProviders), Times.Once);
            logger.Verify(f => f.LogMessage(e), Times.Once);
        }