Example #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);
        }
Example #2
0
        public void NoPrefixMatchesNumberOnly()
        {
            FileSemVer fileSemVer;

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

            FileSemVer fileSemVer = new FileSemVer(VERSION);

            Assert.AreEqual(VERSION, fileSemVer.ToString(), "A10:");
        }
Example #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:");
        }
Example #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:");
        }
Example #6
0
        public void NonMatchingNameWithPrefixThrows()
        {
            FileSemVer fileSemVer;

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