Exemplo n.º 1
0
        public void Can_Store_Event()
        {
            //Arrange
            var result         = new AuditLog();
            var repositoryMock = new Mock <IAuditLogRepository>();

            repositoryMock.Setup(m => m.Add(It.IsAny <AuditLog>())).Callback((AuditLog log) => result = log);

            //Act

            var target = new EventWatcher(repositoryMock.Object);

            target.StoreEvent("1", typeof(ProjectAdded).Name, "newMessage");

            //Assert

            repositoryMock.Verify(m => m.Add(It.IsAny <AuditLog>()));
            Assert.True(result.EventMassage == "newMessage");
            Assert.True(result.UserId == 1);
            Assert.True(result.EventType == "ProjectAdded");
        }