Пример #1
0
        public void FileAccess_ListTestAssemblyPaths_NotEmptyMatchingFilesToBeIncludedAndNotEmptyMatchingFilesToBeExcluded()
        {
            // Arrange
            var tempTestUnitFileName        = Path.Combine(_netFrameworkDirectoryInfo.FullName, "Test.Unit.Access.Customer.dll");
            var tempTestIntegrationFileName = Path.Combine(_netFrameworkDirectoryInfo.FullName, "Test.Integration.Access.Customer.dll");

            using (var fs = new FileStream(tempTestUnitFileName, FileMode.Create)) { }
            using (var fs = new FileStream(tempTestIntegrationFileName, FileMode.Create)) { }

            var directory         = _tempDirListTestAssemblyPathsTestsDirectoryInfo.FullName.ToLowerInvariant();
            var minimatchPatterns = new string[]
            {
                "**\\Debug\\**\\*Test.Integration*.dll",
                "**\\Debug\\**\\*Test.Unit*.dll",
                "!**\\Debug\\**"
            };

            var target = new FileAccessFactory().Create();

            // Act
            var actual = target.ListTestAssemblyPaths(directory, minimatchPatterns.Select(x => x.ToLowerInvariant()).ToArray());

            // Assert
            actual.Length.Should().Be(0);
        }
Пример #2
0
        public void FileAccess_ListDuplicateTestMethods_EmptyDuplicateTestMethods()
        {
            // Arrange
            var testMethods = GetType().GetMethods().Where(x => x.Name.Contains("ListDuplicateTestMethods")).ToArray();

            var target = new FileAccessFactory().Create();

            // Act
            var actual = target.ListDuplicateTestMethods(testMethods);

            //// Assert
            actual.Count.Should().Be(0);
        }
Пример #3
0
        public void FileAccess_ListDuplicateTestMethods_EmptyTestMethods()
        {
            // Arrange
            var testMethods = new MethodInfo[1];

            var target = new FileAccessFactory().Create();

            // Act
            Action actual = () => target.ListDuplicateTestMethods(testMethods);

            // Assert
            actual.Should().Throw <NullReferenceException>();
        }
        public void FileAccess_ListTestMethods_EmptyTestAssemblyPaths()
        {
            // Arrange
            var testAssemblyPaths = new string[0];

            var target = new FileAccessFactory().Create();

            // Act
            var actual = target.ListTestMethods(testAssemblyPaths);

            // Assert
            actual.Length.Should().Be(0);
        }
        public void FileAccess_ListTestMethods_TestAssemblyPathNotFound()
        {
            // Arrange
            var fixture           = new Fixture();
            var testAssemblyPaths = new string[] { fixture.Create <string>() };

            var target = new FileAccessFactory().Create();

            // Act
            Action actual = () => target.ListTestMethods(testAssemblyPaths);

            // Assert
            actual.Should().Throw <FileNotFoundException>();
        }
Пример #6
0
        public void FileAccess_ListTestAssemblyPaths_NonExistingDirectoryPath()
        {
            // Arrange
            var directory         = string.Empty;
            var minimatchPatterns = new string[0];

            var target = new FileAccessFactory().Create();

            // Act
            Action actual = () => target.ListTestAssemblyPaths(directory, minimatchPatterns.Select(x => x.ToLowerInvariant()).ToArray());

            // Assert
            actual.Should().Throw <ArgumentException>();
        }
Пример #7
0
        public void FileAccess_ListDuplicateTestMethods_NotEmptyDuplicateTestMethods()
        {
            // Arrange
            var testMethods = new List <MethodInfo>();
            var testMethodsToBeDuplicated = GetType().GetMethods().Where(x => x.Name.Contains("ListDuplicateTestMethods")).ToArray();

            testMethods.AddRange(testMethodsToBeDuplicated);
            testMethods.AddRange(testMethodsToBeDuplicated);

            var target = new FileAccessFactory().Create();

            // Act
            var actual = target.ListDuplicateTestMethods(testMethods.ToArray());

            //// Assert
            actual.Count.Should().Be(testMethods.Count / 2);
        }
        public void FileAccess_ListTestMethods_Success()
        {
            // Arrange
            var assemblyAccessMock = new Mock <AssemblyHelper>();

            var fixture           = new Fixture();
            var testAssembly      = Assembly.GetExecutingAssembly();
            var testAssemblyPaths = new string[] { fixture.Create <string>() };

            assemblyAccessMock.Setup(x => x.LoadFrom(It.IsAny <string>())).Returns(testAssembly);

            var target = new FileAccessFactory(assemblyAccessMock.Object).Create();

            // Act
            var actual = target.ListTestMethods(testAssemblyPaths);

            // Assert
            actual.Length.Should().BeGreaterThan(0);
        }
Пример #9
0
        public void FileAccess_ListTestAssemblyPaths_EmptyMatchingFilesToBeIncluded()
        {
            // Arrange
            var directory         = _tempDirListTestAssemblyPathsTestsDirectoryInfo.FullName.ToLowerInvariant();
            var minimatchPatterns = new string[]
            {
                "**\\Debug\\**\\*Test.Integration*.dll",
                "**\\Debug\\**\\*Test.Unit*.dll",
                "!**\\obj\\**"
            };

            var target = new FileAccessFactory().Create();

            // Act
            var actual = target.ListTestAssemblyPaths(directory, minimatchPatterns.Select(x => x.ToLowerInvariant()).ToArray());

            // Assert
            actual.Should().BeNull();
        }