コード例 #1
0
        public void RepositoryCalledWhenGetUserMessageInvoked()
        {
            string userName = "******";

            subject.GetUserMessages(userName);

            mockRespository.Verify(x => x.GetMessages(userName), Times.Once);
        }
コード例 #2
0
        public void ReturnsNoMessagesWhenForUnknownUsernameEntered()
        {
            mockRespository.Setup(x => x.GetMessages(It.IsAny <string>())).Returns(new List <Message>());

            subject = new MessagePoster(mockRespository.Object);

            var messages = subject.GetUserMessages("joe bloggs");

            Assert.AreEqual(0, messages.Count);
        }