Пример #1
0
        public void VersionUnit_DefaultsToIncrementWithNumber()
        {
            var sut = new VersionUnit("1");

            Assert.Equal("1", sut.Value); //, "The value should default correctly");
            Assert.Equal(VersionIncrementBehaviour.Fixed, sut.Behaviour);
        }
Пример #2
0
        public void ChangeBehaviour_OnceSet_Exception()
        {
            var sut = new VersionUnit("1");

            sut.SetBehaviour(VersionIncrementBehaviour.AutoIncrementWithReset);

            Assert.Throws <InvalidOperationException>(() => { sut.Value = "Bannana"; });
        }
Пример #3
0
        public void VersionUnit_ChangeBehavour_ExceptionIfNotIncrementable()
        {
            Bilge.Log(nameof(VersionUnit_ChangeBehavour_ExceptionIfNotIncrementable) + " Entered");
            var sut = new VersionUnit("monkey");


            Assert.Throws <InvalidOperationException>(() => { sut.SetBehaviour(VersionIncrementBehaviour.AutoIncrementWithReset); });
        }
Пример #4
0
        public void VersionUnit_ChangeBehaviour_ExceptionIfNotIncrimentable()
        {
            b.Info.Flow();

            Assert.Throws <InvalidOperationException>(() => {
                var sut = new VersionUnit("monkey");
                sut.SetBehaviour(DigitIncremementBehaviour.AutoIncrementWithReset);
            });
        }
        public void Increment_OverrideReplacesIncrement()
        {
            var vu = new VersionUnit("1", "", DigitIncremementBehaviour.ContinualIncrement);

            vu.IncrementOverride = "9";
            var sut = new CompleteVersion(vu);

            sut.Increment();
            Assert.Equal("9", sut.GetVersionString(DisplayType.Full)); //, "The overide on a word value did not work");
        }
        public void SimpleIncrement_Incrment_Works()
        {
            var vu = new VersionUnit("2", ".");

            vu.SetBehaviour(DigitIncremementBehaviour.AutoIncrementWithReset);
            var sut = new CompleteVersion(new VersionUnit("1"), vu);

            sut.Increment();
            Assert.Equal("1.3", sut.ToString()); //, "The verison increment should do nothing for fixed");
        }
Пример #7
0
        public void SimpleIncrement_Incrment_Works()
        {
            var vu = new VersionUnit("2", ".");

            vu.SetBehaviour(VersionIncrementBehaviour.AutoIncrementWithReset);
            var sut = new CompleteVersion(new VersionUnit("1"), vu);

            sut.PerformIncrement();
            Assert.Equal("1.3", sut.ToString());
        }
Пример #8
0
        public void Increment_OverrideReplacesIncrement()
        {
            var vu = new VersionUnit("1", "", VersionIncrementBehaviour.ContinualIncrement);

            vu.IncrementOverride = "9";
            var sut = new CompleteVersion(vu);

            sut.PerformIncrement();
            Assert.Equal("9", sut.GetVersionString(DisplayType.Full));
        }
        public void Override_NoIncrement_DoesNotChangeValue()
        {
            var vu = new VersionUnit("1");

            vu.Value             = "Monkey";
            vu.IncrementOverride = "Fish";
            var sut = new CompleteVersion(vu);

            Assert.Equal("Monkey", sut.GetVersionString(DisplayType.Full));
        }
Пример #10
0
        public void Increment_OverrideWorksOnFixed()
        {
            var vu = new VersionUnit("1", "", VersionIncrementBehaviour.Fixed);

            vu.IncrementOverride = "Fish";

            var sut = new CompleteVersion(vu);

            sut.PerformIncrement();

            Assert.Equal("Fish", sut.GetVersionString(DisplayType.Full)); //, "The overide on a word value did not work");
        }
        public void Increment_OverrideWorksOnFixed()
        {
            var vu = new VersionUnit("1", "", DigitIncremementBehaviour.Fixed);

            vu.IncrementOverride = "Fish";

            var sut = new CompleteVersion(vu);

            sut.Increment();

            Assert.Equal("Fish", sut.GetVersionString(DisplayType.Full));
        }
        public void Increment_OverrideWorksForNumbers()
        {
            var vu = new VersionUnit("1");

            vu.IncrementOverride = "5";

            var sut = new CompleteVersion(vu);

            sut.Increment();

            Assert.Equal("5", sut.GetVersionString(DisplayType.Full));
        }
        public void Increment_OverrideWorksForNames()
        {
            var vu = new VersionUnit("Monkey");

            vu.IncrementOverride = "Fish";

            var sut = new CompleteVersion(vu);

            sut.Increment();

            Assert.Equal("Fish", sut.GetVersionString(DisplayType.Full)); //, "The overide on a word value did not work");
        }
        public void Increment_ResentAnyWorks()
        {
            var vu2 = new VersionUnit("0", ".");
            var sut = new CompleteVersion(
                new VersionUnit("1", ""),
                vu2,
                new VersionUnit("1", "."),
                new VersionUnit("0", ".", DigitIncremementBehaviour.AutoIncrementWithResetAny));

            Assert.Equal("1.0.1.0", sut.GetVersionString()); //, "Without an increment its wrong - invalid test");

            sut.Increment();
            Assert.Equal("1.0.1.1", sut.GetVersionString()); //, "Increment on all fixed should not change anything");
            vu2.IncrementOverride = "5";
            sut.Increment();

            Assert.Equal("1.5.1.0", sut.GetVersionString()); //, "The final digit should reset when a fixed digit changes.");
        }
Пример #15
0
        public void VersionUnit_DefaultPostfix_IsCorrect()
        {
            var sut = new VersionUnit("1");

            Assert.Equal("", sut.PreFix); //, "The default prefix is blank");
        }
Пример #16
0
        public void VersionUnit_DefaultPostfix_IsCorrect()
        {
            var sut = new VersionUnit("1");

            Assert.Equal("", sut.PreFix);
        }
Пример #17
0
        public void DefaultBehaviour_IsFixed()
        {
            var vu = new VersionUnit("2", ".");

            Assert.Equal(VersionIncrementBehaviour.Fixed, vu.Behaviour);
        }
Пример #18
0
        public void SetBehaviour_OnConstructor_Works()
        {
            var vu = new VersionUnit("2", ".", VersionIncrementBehaviour.AutoIncrementWithReset);

            Assert.Equal(VersionIncrementBehaviour.AutoIncrementWithReset, vu.Behaviour);
        }
Пример #19
0
        public void VersionUnit_NonDigit_WorksFine()
        {
            var sut = new VersionUnit("monkey");

            Assert.Equal("monkey", sut.Value); //, "The value was not set correctly");
        }
Пример #20
0
        public void VersionUnit_FirstParamIsTheDigit()
        {
            var sut = new VersionUnit("1");

            Assert.Equal("1", sut.Value); //, "The value isnt set in the constructor");
        }
Пример #21
0
        public void Prefix_IsPrefixWhenSpecified()
        {
            var sut = new VersionUnit("5", "Monkey");

            Assert.Equal("Monkey5", sut.ToString()); //, "The prefix was not correctly specified in the ToSTring method");
        }
Пример #22
0
        public void VersionUnit_SecondParameterChangesPostfix()
        {
            var sut = new VersionUnit("1", "X");

            Assert.Equal("X", sut.PreFix); //, "The prefix needs to be set by the constructor");
        }
Пример #23
0
        public void VersionUnit_FirstParamIsTheDigit()
        {
            var sut = new VersionUnit("1");

            Assert.Equal("1", sut.Value);
        }