Ejemplo n.º 1
0
        public void FindAbsentExpectedFiles_PackageWithIncorrectlyNamedMSBuildFile_FindsOne(string[] files)
        {
            //Arrange
            string packageId = "packageId";

            //Act
            var rule   = new UpholdBuildConventionRule();
            var issues = rule.FindAbsentExpectedFiles(files, packageId);

            //Assert
            Assert.Single(issues);
        }
Ejemplo n.º 2
0
        public void FindAbsentExpectedFiles_PackageWithCorrectlyNamedMSBuildFile_FindsZero(string[] files)
        {
            //Arrange
            string packageId = "packageId";

            //Act
            var rule   = new UpholdBuildConventionRule();
            var actual = rule.FindAbsentExpectedFiles(files, packageId);

            //Assert
            Assert.Empty(actual);
        }
Ejemplo n.º 3
0
        public void FindAbsentExpectedFiles_PackageWithFileNameSimilarToBuildDirectory_DoesNotWarn()
        {
            // Arrange
            var packageId = "PackageId";
            var files     = new[]
            {
                @"buildCustom\anything.props",
                "buildCustom/anything.targets"
            };

            // Act
            var target = new UpholdBuildConventionRule();
            var actual = target.FindAbsentExpectedFiles(files, packageId);

            // Assert
            Assert.Empty(actual);
        }
Ejemplo n.º 4
0
        public void FindAbsentExpectedFiles_DifferentPathSeparators_GroupTogether()
        {
            // Arrange
            var files = new[]
            {
                "build/net5.0/one.props",
                @"build\net5.0\two.props"
            };
            var packageId = "PackageId";

            // Act
            var target = new UpholdBuildConventionRule();
            var actual = target.FindAbsentExpectedFiles(files, packageId);

            // Assert
            Assert.Equal(1, actual.Count);
        }
Ejemplo n.º 5
0
        public void FindAbsentExpectedFiles_MultiplePropsInOneDirectory_FindsOne()
        {
            // Arrange
            var files = new[]
            {
                "build/one.props",
                "build/two.props"
            };
            var packageId = "PackageId";

            // Act
            var target = new UpholdBuildConventionRule();
            var actual = target.FindAbsentExpectedFiles(files, packageId);

            // Assert
            Assert.Equal(1, actual.Count);
        }
Ejemplo n.º 6
0
        public void FindAbsentExpectedFiles_MultiplePropsInSubDirectories_FindsOne(string pathToTest)
        {
            // Arrange
            var files = new[]
            {
                pathToTest + "one.props",
                pathToTest + "two/two.props",
                pathToTest + "three/three.props"
            };
            var packageId = "PackageId";

            // Act
            var target = new UpholdBuildConventionRule();
            var actual = target.FindAbsentExpectedFiles(files, packageId);

            // Assert
            Assert.Equal(1, actual.Count);
        }
Ejemplo n.º 7
0
        public void FindAbsentExpectedFiles_NonCompliantFileInTfmSubDirectory_ExpectedPathIsBuildRoot()
        {
            // Arrange
            var files = new[]
            {
                "build/net5.0/custom/other.props"
            };
            var packageId = "packageId";

            // Act
            var target = new UpholdBuildConventionRule();
            var actual = target.FindAbsentExpectedFiles(files, packageId);

            // Assert
            UpholdBuildConventionRule.ExpectedFile expectedFile = Assert.Single(actual);
            Assert.Equal("build/net5.0/", expectedFile.Path);
            Assert.Equal("build/net5.0/packageId.props", expectedFile.ExpectedPath);
        }