public void ParseExceptionsTest() { Assert.ThrowsException <FormatException>(() => { HeroesDataVersion.Parse(string.Empty); }); Assert.ThrowsException <ArgumentNullException>(() => { HeroesDataVersion.Parse(null !); }); Assert.ThrowsException <ArgumentNullException>(() => { string?value = null; HeroesDataVersion.Parse(value.AsSpan()); }); }
public void ParseSuccessTest(string value, int major, int minor, int revision, int build, bool isPtr) { HeroesDataVersion version = HeroesDataVersion.Parse(value); Assert.AreEqual(major, version !.Major); Assert.AreEqual(minor, version.Minor); Assert.AreEqual(revision, version.Revision); Assert.AreEqual(build, version.Build); Assert.AreEqual(isPtr, version.IsPtr); HeroesDataVersion versionSpan = HeroesDataVersion.Parse(value.AsSpan()); Assert.AreEqual(major, versionSpan !.Major); Assert.AreEqual(minor, versionSpan.Minor); Assert.AreEqual(revision, versionSpan.Revision); Assert.AreEqual(build, versionSpan.Build); Assert.AreEqual(isPtr, versionSpan.IsPtr); }
public void ParseFailTest(string value) { Assert.ThrowsException <FormatException>(() => { HeroesDataVersion.Parse(value); }); Assert.ThrowsException <FormatException>(() => { HeroesDataVersion.Parse(value.AsSpan()); }); }