public void Should_Not_Parse_Invalid_Version_Strings(string versionString) { Action version1Fixture = () => { var _ = new MinVerVersion(versionString); }; Action version2Fixture = () => { var _ = MinVerVersion.Parse(versionString); }; var result = MinVerVersion.TryParse(versionString, out _); version1Fixture.Should().ThrowExactly <FormatException>(); version2Fixture.Should().ThrowExactly <FormatException>(); result.Should().BeFalse(); }
public void Should_Parse_Valid_Version_Strings(string versionString) { var version1 = new MinVerVersion(versionString); var version2 = MinVerVersion.Parse(versionString); var result = MinVerVersion.TryParse(versionString, out var version3); result.Should().BeTrue(); version1.Version.Should().Be(versionString); version2.Version.Should().Be(versionString); version3.Version.Should().Be(versionString); version1.Should().BeEquivalentTo(version2); version2.Should().BeEquivalentTo(version3); }