Skip to content
This repository was archived by the owner on Dec 2, 2021. It is now read-only.

Commit 6c81795

Browse files
Merge pull request #55 from 304NotModified/improve-tests
Improve tests
2 parents 222e95c + 3ee5762 commit 6c81795

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

Tests/TaskTests.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,31 @@ public void EnsureAttributeExists()
5151
var customAttributes = (AssemblyInformationalVersionAttribute)assembly
5252
.GetCustomAttributes(typeof (AssemblyInformationalVersionAttribute), false)
5353
.First();
54-
Assert.IsNotNull(customAttributes.InformationalVersion);
55-
Assert.IsNotEmpty(customAttributes.InformationalVersion);
56-
Trace.WriteLine(customAttributes.InformationalVersion);
54+
55+
AssertVersionWithSha(customAttributes.InformationalVersion);
5756
}
5857

5958
[Test]
6059
public void Win32Resource()
6160
{
6261
var versionInfo = FileVersionInfo.GetVersionInfo(afterAssemblyPath);
63-
Assert.IsNotNull(versionInfo.ProductVersion);
64-
Assert.IsNotEmpty(versionInfo.ProductVersion);
62+
63+
AssertVersionWithSha(versionInfo.ProductVersion);
64+
6565
Assert.IsNotNull(versionInfo.FileVersion);
6666
Assert.IsNotEmpty(versionInfo.FileVersion);
67-
Trace.WriteLine(versionInfo.ProductVersion);
68-
Trace.WriteLine(versionInfo.FileVersion);
67+
Assert.AreEqual("1.0.0.0",versionInfo.FileVersion);
6968
}
7069

70+
private static void AssertVersionWithSha(string version)
71+
{
72+
Assert.IsNotNull(version);
73+
Assert.IsNotEmpty(version);
74+
StringAssert.Contains("1.0.0.0", version, "Missing number");
75+
StringAssert.Contains("Head:", version, message: "Missing Head");
76+
StringAssert.Contains("Sha:", version, message: "Missing Sha");
77+
Trace.WriteLine(version);
78+
}
7179

7280
#if(DEBUG)
7381
[Test]

0 commit comments

Comments
 (0)