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); }
public void NoPrefixMatchesNumberOnly() { FileSemVer fileSemVer; fileSemVer = new FileSemVer("1.2.3"); Assert.AreEqual("1.2.3", fileSemVer.SemVersionProper.ToString()); }
public void ToStringTest() { string VERSION = "1.2.3"; FileSemVer fileSemVer = new FileSemVer(VERSION); Assert.AreEqual(VERSION, fileSemVer.ToString(), "A10:"); }
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:"); }
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:"); }
public void NonMatchingNameWithPrefixThrows() { FileSemVer fileSemVer; Assert.Throws <ArgumentException>(() => fileSemVer = new FileSemVer("ABC1.2.3", "Ver")); }