Beispiel #1
0
        public void IsRepresentingThirdPartLibrary_ShouldBeTrue_WhenUsingInstanceRepresentingNonThirdPartLibrary()
        {
            var instanceRepresentingNonThirdPartLibrary = FileInfoVersion.FileInfoVersionNOTrepresentingThirdPartLibrary;

            Assert.IsFalse(instanceRepresentingNonThirdPartLibrary.IsRepresentingThirdPartLibrary());

            var someOtherInstanceWithDifferentPropertyValues = new FileInfoVersion("a", 123, "b");

            Assert.IsTrue(someOtherInstanceWithDifferentPropertyValues.IsRepresentingThirdPartLibrary());
        }
        private void VerifyExpectedEnumAndAssemblyVersion(
            CrsTransformationAdapterBase crsTransformationAdapter,
            FileInfoVersion expectedFileInfoVersion,
            CrsTransformationAdapteeType expectedEnumWithMatchingNameInlcudingVersionNumber
            )
        {
            Assert.AreEqual(
                expectedEnumWithMatchingNameInlcudingVersionNumber,
                crsTransformationAdapter.AdapteeType
                );
            FileInfoVersion fileInfoVersion = crsTransformationAdapter._GetFileInfoVersion();

            if (expectedFileInfoVersion.IsRepresentingThirdPartLibrary())
            {
                Assert.That(
                    fileInfoVersion.FileName, Does.EndWith(expectedFileInfoVersion.FileName),
                    "Likely failure reason: You have upgraded a version. If so, then upgrade both the enum value and the filename"
                    );
                Assert.AreEqual(
                    // This test is actually quite fragile for example
                    // regarding the .NET version
                    // (e.g. "net45" or "netstandard2.0")
                    // but remember that the purpose is to detect
                    // that a library (i.e. the binary file e.g. file size)
                    // has been modified and then maybe the enum specifying
                    // the version should be updated
                    expectedFileInfoVersion.FileSize,
                    fileInfoVersion.FileSize
                    );

                Assert.AreEqual(
                    expectedFileInfoVersion.Version,
                    fileInfoVersion.Version
                    );
            }
        }