コード例 #1
0
 public void TestInit()
 {
     // get a new build manager after each test
     this.versionManagerUnderTest = new BuildVersionManager(ArchivePath);
 }
コード例 #2
0
 public void Ctor_EmptyArchivePath_ThrowsException()
 {
     var target = new BuildVersionManager(string.Empty);
 }
コード例 #3
0
 public void Ctor_ValidPath_AssertDefaults()
 {
     var target = new BuildVersionManager(ArchivePath);
     Assert.IsNull(target.Name);
     Assert.AreEqual(byte.MaxValue, target.MaxArchiveSize);
     Assert.AreEqual(Path.GetFullPath(ArchivePath), target.ArchivePath, true);
 }
コード例 #4
0
        public void Ctor_WithNameAndMaxArchiveSize_PropertiesSet()
        {
            byte maxBuilds = 100;
            string name = "MyBuildManager";

            var target = new BuildVersionManager(
                ArchivePath,
                maxBuilds,
                name);

            var expectedPath = Path.Combine(Path.GetFullPath(ArchivePath), name);
            Assert.AreEqual(expectedPath, target.ArchivePath, true);
            Assert.AreEqual(maxBuilds, target.MaxArchiveSize);
            Assert.AreEqual(name, target.Name, true);
        }
コード例 #5
0
        public void Ctor_ValidName_CorrectPathsWhenLoadingRecentBuild()
        {
            string name = "foo";
            this.versionManagerUnderTest = new BuildVersionManager(ArchivePath, name: name);

            string expectedPath = Path.Combine(
                ArchivePath,
                name,
                this.versionManagerUnderTest.SequenceNumber.ToString(),
                TestAssemblyV1Name);

            this.versionManagerUnderTest.AddNewSuccessfulBuild(TestAssemblyV1Path);
            Build mostRecent = this.versionManagerUnderTest.GetMostRecentBuild();

            Assert.AreEqual(this.versionManagerUnderTest.Name, name);
            Assert.IsNotNull(mostRecent);
            Assert.AreEqual(mostRecent.AssemblyPath, Path.GetFullPath(expectedPath), true);
            Assert.IsTrue(File.Exists(expectedPath));
        }
コード例 #6
0
 public void Ctor_NullArchivePath_ThrowsException()
 {
     var target = new BuildVersionManager(null);
 }
コード例 #7
0
        public void Ctor_NonExistingDirectory_DirectoryCreated()
        {
            var path = Path.Combine(ArchivePath, "test-dir");
            var target = new BuildVersionManager(path);

            Assert.IsTrue(Directory.Exists(path));
            Assert.AreEqual(Path.GetFullPath(path), target.ArchivePath, true);
        }
コード例 #8
0
        public void Ctor_NoNameAndMaxArchiveSize_PropertiesSet()
        {
            byte maxBuilds = 100;
            var target = new BuildVersionManager(ArchivePath, maxBuilds);

            Assert.AreEqual(Path.GetFullPath(ArchivePath), target.ArchivePath, true);
            Assert.AreEqual(maxBuilds, target.MaxArchiveSize);
            Assert.IsNull(target.Name);
        }
コード例 #9
0
 public void Ctor_ExistingFilePath_ThrowsException()
 {
     var target = new BuildVersionManager(TestAssemblyV1Path);
 }