public void this_assembly_has_a_valid_AssemblyInformationalVersionAttribute() { var info = InformationalVersion.ReadFromAssembly(System.Reflection.Assembly.GetExecutingAssembly()); info.IsValidSyntax.Should().BeTrue(); info.ParseErrorMessage.Should().BeNull(); }
public void InformationalVersion_ReadFromAssembly_only_throws_if_assembly_is_null() { Assert.Throws <ArgumentNullException>(() => InformationalVersion.ReadFromAssembly(null)); var info = InformationalVersion.ReadFromAssembly(typeof(string).Assembly); info.IsValidSyntax.Should().BeFalse(); info.ParseErrorMessage.Should().NotBeNull(); }
static SVersion GetPackageVersion(Assembly a, AssemblyName n) { var info = InformationalVersion.ReadFromAssembly(a); if (info.IsValidSyntax && info.Version !.IsValid) { return(info.Version); } var v = n.Version; return(SVersion.Create(v.Major, v.Minor, v.Build)); }