public void CanProcess_Positive() { // Arrange var countWordsData = new CountWordsData(); // Actual var actualValue = countWordsOperation.CanProcess(countWordsData); // Assert Assert.True(actualValue); }
public void CanProcess_Negative() { // Arrange var countWordsData = new CountWordsData(); // Actual var actualValue = replaceWordOperation.CanProcess(countWordsData); // Assert Assert.False(actualValue); }
public void Parse_CountWords(params string[] args) { // Arrange var expectedValue = new CountWordsData { FilePath = args[0], SearchWord = args[1] }; // Act var actualValue = (CountWordsData)countWordsParser.Parse(args); // Assert Assert.Equal(expectedValue.FilePath, actualValue.FilePath); Assert.Equal(expectedValue.SearchWord, actualValue.SearchWord); }
public void Process() { // Arrange var text = "123 456 123 456 789 123"; var filePath = "File.txt"; var countWordsData = new CountWordsData { FilePath = filePath, SearchWord = "123" }; var expectedMessage = "Count founded words: 3"; var fileManagerMock = new Mock <IFileManager>(); fileManagerMock .Setup(m => m.ReadText(filePath)) .Returns(text); var actualMessage = string.Empty; var loggerMock = new Mock <ILogger>(); loggerMock .Setup(l => l.LogInformation(It.IsAny <string>())) .Callback <string>(message => actualMessage = message); var operation = new CountWordsOperation( fileManagerMock.Object, loggerMock.Object ); // Act operation.Process(countWordsData); // Assert Assert.Equal(expectedMessage, actualMessage); }