Beispiel #1
0
        public void InvokeReadAllText_WhenFileReaderIsValid()
        {
            //Arrange
            var fakeFileReader = new Mock <IFileReader>();
            var command        = new HelpCommand(fakeFileReader.Object);
            //Act
            var result = command.ExecuteThisCommand();

            //Assert
            fakeFileReader.Verify(v => v.ReadAllText(It.IsAny <string>()), Times.Once);
        }
Beispiel #2
0
        public void ReturnTheCorrectResult_WhenCommandExecutionFinish()
        {
            //Arrange
            var fakeFileReader = new Mock <IFileReader>();
            var command        = new HelpCommand(fakeFileReader.Object);

            fakeFileReader.Setup(s => s.ReadAllText(It.IsAny <string>())).Returns("test");
            var expectedResult = "test";
            //Act
            var actualResult = command.ExecuteThisCommand();

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }