示例#1
0
        public void NoVersions()
        {
            var fileSystem = SetupNoVersions();

            SemVerUtil semVerUtil = new SemVerUtil(fileSystem);

            semVerUtil.Initialize(@"C:\", "Ver");

            FileSemVer fileSemVer = semVerUtil.DirectoryMostRecentVersion();

            Assert.IsNull(fileSemVer);

            fileSemVer = semVerUtil.DirectoryOldestVersion();
            Assert.IsNull(fileSemVer);

            List <FileSemVer> lists = semVerUtil.DirectoryNewestVersions(4);

            Assert.IsNull(lists);

            lists = semVerUtil.DirectoryOldestVersions(5);
            Assert.IsNull(lists);

            lists = semVerUtil.OldestWithMin(2);
            Assert.AreEqual(0, lists.Count);
        }
示例#2
0
        public void NoPrefixMatchesNumberOnly()
        {
            FileSemVer fileSemVer;

            fileSemVer = new FileSemVer("1.2.3");
            Assert.AreEqual("1.2.3", fileSemVer.SemVersionProper.ToString());
        }
示例#3
0
        public void ToStringTest()
        {
            string VERSION = "1.2.3";

            FileSemVer fileSemVer = new FileSemVer(VERSION);

            Assert.AreEqual(VERSION, fileSemVer.ToString(), "A10:");
        }
示例#4
0
        public void ValidConstructs(string name, string prefix, string expectedSemVer)
        {
            FileSemVer fileSemVer = new FileSemVer(name, prefix);

            Assert.AreEqual(name, fileSemVer.FileName, "A10:");
            Assert.AreEqual(prefix, fileSemVer.Prefix, "A20:");
            Assert.AreEqual(expectedSemVer, fileSemVer.SemVerPart, "A30:");
            Assert.AreEqual(expectedSemVer, fileSemVer.Version, "A40:");
        }
示例#5
0
        public void OldestVersion()
        {
            var fileSystem = SetupFileSystem();

            SemVerUtil semVerUtil = new SemVerUtil(fileSystem);

            semVerUtil.Initialize(@"C:\", "Ver");

            FileSemVer fileSemVer = semVerUtil.DirectoryOldestVersion();

            Assert.AreEqual(FIRST_VERSION, fileSemVer.Version, "A10:");
        }
示例#6
0
        public void NonMatchingNameWithPrefixThrows()
        {
            FileSemVer fileSemVer;

            Assert.Throws <ArgumentException>(() => fileSemVer = new FileSemVer("ABC1.2.3", "Ver"));
        }