Exemplo n.º 1
0
        public void ShouldGetTheCorrectLatestVersion(string mask, string[] versionList, string expected)
        {
            var versions       = versionList.Select(version => SemanticVersion.Parse(version)).ToList();
            var currentVersion = SemanticVersionMask.GetLatestMaskedVersion(mask, versions);

            Assert.AreEqual(currentVersion.ToString(), expected);
        }
Exemplo n.º 2
0
        public void ShouldCreateZeroedVersionWhenNoCurrentPresent(string mask, string expected)
        {
            var resultVersion = SemanticVersionMask.ApplyMask(mask, null);
            var received      = resultVersion.ToString();

            Assert.That(received, Is.EqualTo(expected));
        }
Exemplo n.º 3
0
        public void ShouldNotMatchAnyVersions(string mask, string[] versionList)
        {
            var versions       = versionList.Select(version => SemanticVersion.Parse(version)).ToList();
            var currentVersion = SemanticVersionMask.GetLatestMaskedVersion(mask, versions);

            Assert.IsNull(currentVersion);
        }
Exemplo n.º 4
0
        public void ShouldApplyMask(string mask, string current, string expected)
        {
            var currentVersion = SemanticVersion.Parse(current);
            var resultVersion  = SemanticVersionMask.ApplyMask(mask, currentVersion);
            var received       = resultVersion.ToString();

            Assert.That(received, Is.EqualTo(expected));
        }
        public override bool IsValid(object value)
        {
            var text = (value ?? string.Empty).ToString();

            if (text.Length == 0)
            {
                return(true);
            }

            SemanticVersion version;

            return(SemanticVersion.TryParse(text, out version) ||
                   SemanticVersionMask.IsMask(text));
        }
Exemplo n.º 6
0
        public void ShouldBeMask(string version, bool valid)
        {
            var isMask = SemanticVersionMask.IsMask(version);

            Assert.That(isMask, Is.EqualTo(valid));
        }