Exemple #1
0
        public void GetMatchingFiles_InvalidInput_ErrorReported()
        {
            Mock <ILogger> MockLogger = new Mock <ILogger>();

            string[] result = Utils.GetMatchingFiles(null, MockLogger.Object);

            result.Length.Should().Be(0);
            MockLogger.Verify(l => l.LogError(It.IsAny <string>()), Times.Once);
        }
Exemple #2
0
        public void GetMatchingFiles_NonExistingPath_ErrorReported()
        {
            Mock <ILogger> MockLogger = new Mock <ILogger>();

            string[] result = Utils.GetMatchingFiles(@"some\non\exisiting\path", MockLogger.Object);

            result.Length.Should().Be(0);
            MockLogger.Verify(l => l.LogError(It.IsAny <string>()), Times.Once);
        }
Exemple #3
0
        public void GetMatchingFiles_ValidInput_ReturnsValidList()
        {
            Mock <ILogger> MockLogger = new Mock <ILogger>();

            string[] result = Utils.GetMatchingFiles(Path.GetDirectoryName(TestResources.Tests_DebugX86) + @"\*.exe", MockLogger.Object);

            result.Should().Contain(s => s.Equals(TestResources.Tests_DebugX86, StringComparison.CurrentCultureIgnoreCase));
            result.Should().NotContain(s => !s.EndsWith(".exe", StringComparison.CurrentCultureIgnoreCase));
            MockLogger.Verify(l => l.LogError(It.IsAny <string>()), Times.Never);
        }