Exemplo n.º 1
0
        public void GetMessage_MessageNotSet_ReturnsNull()
        {
            //Arrange
            var loggerMock = new Mock<ILogger>();
            IRepository repository = new Repository(loggerMock.Object);

            //Act
            var messageReceived = repository.GetMessage();

            //Assert
            Assert.IsTrue(string.IsNullOrEmpty(messageReceived));
        }
Exemplo n.º 2
0
        public void Clear_MessageSet_SetCorrectly()
        {
            //Arrange
            const string messageSent = "Called from clear";
            var loggerMock = new Mock<ILogger>();
            IRepository repository = new Repository(loggerMock.Object);

            //Act
            repository.Clear();

            //Assert
            Assert.AreEqual(messageSent, repository.GetMessage());
        }
Exemplo n.º 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);
        }