예제 #1
0
        public void Load_LoggerCalledCorrecty_CalledOnce()
        {
            //Arrange
            const string messageSent = "Called from load";
            var loggerMock = new Mock<ILogger>();
            IRepository repository = new Repository(loggerMock.Object);

            //Act
            repository.Load();

            //Assert
            loggerMock.Verify(logger => logger.Log(messageSent), Times.Exactly(1));
        }
예제 #2
0
        public void Load_MessageSet_SetCorrectly()
        {
            //Arrange
            const string messageSent = "Called from load";
            var loggerMock = new Mock<ILogger>();
            IRepository repository = new Repository(loggerMock.Object);

            //Act
            repository.Load();

            //Assert
            Assert.AreEqual(messageSent, repository.GetMessage());
        }
예제 #3
0
        public void Load_MessageText_IsCorrect()
        {
            //Arrange
            var loggerMock = new Mock<ILogger>();
            IRepository repository = new Repository(loggerMock.Object);

            //Act
            repository.Load();
            var receivedMessage = repository.GetMessage();

            //Assert
            Assert.AreEqual("Called from load", receivedMessage);
        }