Пример #1
0
        public void UC_NoIncrement_NoChange()
        {
            MockVersionStorage mvs = new MockVersionStorage("0.0.0.1");
            Versioning         sut = new Versioning(mvs);

            Assert.Equal("0.0.0.1", sut.ToString());
        }
Пример #2
0
        public void Storage_DefaultValidationIsTrue()
        {
            b.Info.Flow();
            VersionStorage sut = new MockVersionStorage("itsamock");

            Assert.True(sut.ValidateInitialisation());
        }
Пример #3
0
        public void UC_BehaviouralIncrement_Works(string initial, string target)
        {
            MockVersionStorage mvs = new MockVersionStorage(initial);
            Versioning         sut = new Versioning(mvs);

            mvs.Mock.SetBehaviours(DigitIncremementBehaviour.Fixed, DigitIncremementBehaviour.Fixed, DigitIncremementBehaviour.AutoIncrementWithResetAny, DigitIncremementBehaviour.AutoIncrementWithResetAny);

            sut.Increment();
            Assert.Equal(target, sut.ToString());
        }
Пример #4
0
        public void VersionStorage_SavesCorrectly()
        {
            var            msut = new MockVersionStorage("itsamock");
            VersionStorage sut  = msut;

            var cv = new CompleteVersion(new VersionUnit("1"), new VersionUnit("1"), new VersionUnit("1"), new VersionUnit("1"));

            sut.Persist(cv);
            Assert.True(msut.PersistWasCalled, "The persist method was not called");
            Assert.Equal("1111", msut.VersionStringPersisted);
        }
Пример #5
0
        public void AddInvalid_NugetFile_Throws()
        {
            b.Info.Flow();

            MockVersionStorage mvs = new MockVersionStorage("0.0.0.1");
            Versioning         sut = new Versioning(mvs);

            Assert.Throws <ArgumentNullException>(() => { sut.AddNugetFile(null); });
            Assert.Throws <FileNotFoundException>(() => { sut.AddNugetFile(""); });
            Assert.Throws <FileNotFoundException>(() => { sut.AddNugetFile("c:\\arflebarflegloop.txt"); });
        }
        public void VersionStorage_NotDefaultWhenPresent()
        {
            b.Info.Flow();

            VersionStorage vs  = new MockVersionStorage("0.0.0.0");
            var            ver = vs.GetVersion();

            Assert.False(ver.IsDefault);
            Assert.Equal(4, ver.Digits.Length);
            Assert.Equal("0.0.0.0", ver.ToString());
        }
        public void VersionStorage_CreatesDefaultIfNotPresent()
        {
            b.Info.Flow();

            VersionStorage vs  = new MockVersionStorage("default");
            var            ver = vs.GetVersion();

            Assert.True(ver.IsDefault);
            Assert.Equal(4, ver.Digits.Length);
            Assert.Equal("0.0.0.0", ver.ToString());
        }
Пример #8
0
        public void UC_UpdateNuspecFile_Works()
        {
            b.Info.Flow();

            var    reid    = TestResources.GetIdentifiers(TestResourcesReferences.NuspecSample1);
            string srcFile = uth.GetTestDataFile(reid);

            MockVersionStorage mvs = new MockVersionStorage("0.0.0.1");
            Versioning         sut = new Versioning(mvs);

            sut.AddNugetFile(srcFile);
        }
        public void Outputter_Environment_WritesToEnvironment()
        {
            b.Info.Flow();


            MockVersionStorage mvs = new MockVersionStorage("0.0.0.1");
            var sut = new Versioning(mvs);
            var v   = sut.Version;

            var op = new MockVersioningOutputter(v);

            op.DoOutput(OutputPossibilities.File);

            Assert.True(op.FileWasWritten);
            Assert.False(op.EnvWasSet);
        }