Exemple #1
0
        public void Should_be_able_to_parse(string value, int major, int minor, int patch, string versionCore, string prerelease, string buildMetadata)
        {
            SemanticVersion.Parser parser = null;

            Assert.That(() => parser = new SemanticVersion.Parser(value), Throws.Nothing);

            Assert.That(parser.Major, Is.EqualTo(major));
            Assert.That(parser.Minor, Is.EqualTo(minor));
            Assert.That(parser.Patch, Is.EqualTo(patch));
            Assert.That(parser.BuildMetadata, Is.EqualTo(buildMetadata));
            Assert.That(parser.VersionCore, Is.EqualTo(versionCore));
            Assert.That(parser.Prerelease, Is.EqualTo(prerelease));
            Assert.That(parser.Version, Is.EqualTo(value));

            var semanticVersion = new SemanticVersion {
                Value = value
            };

            Assert.That(() => semanticVersion.Execute(), Throws.Nothing);

            Assert.That(semanticVersion.BuildMetadata, Is.EqualTo(buildMetadata));
            Assert.That(semanticVersion.VersionCore, Is.EqualTo(versionCore));
            Assert.That(semanticVersion.Prerelease, Is.EqualTo(prerelease));
            Assert.That(semanticVersion.Version, Is.EqualTo(value));
        }