Exemplo n.º 1
0
        public void IsLockedIsTrueAfterTheValuePropertyIsAccessed()
        {
            var semimutable = new Semimutable <int>(1);

            _ = semimutable.Value;

            Assert.True(semimutable.IsLocked);
        }
Exemplo n.º 2
0
        public void HasDefaultValueIsFalseWhenSetValueIsCalled()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.SetValue(() => 2);

            Assert.False(semimutable.HasDefaultValue);
        }
Exemplo n.º 3
0
        public void CanChangeValuePropertyWithTheSetValueMethod()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.SetValue(() => 2);

            Assert.Equal(2, semimutable.Value);
        }
Exemplo n.º 4
0
        public void HasDefaultValueIsFalseWhenValueIsChanged()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.Value = 2;

            Assert.False(semimutable.HasDefaultValue);
        }
Exemplo n.º 5
0
        public void CanChangeValueProperty()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.Value = 2;

            Assert.Equal(2, semimutable.Value);
        }
Exemplo n.º 6
0
        public void CallingTheResetValueMethodThrowsWhenIsLockedIsTrue()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.LockValue();

            Assert.Throws <InvalidOperationException>(() => semimutable.ResetValue());
        }
Exemplo n.º 7
0
        public void SettingTheValuePropertyThrowsWhenIsLockedIsTrue()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.LockValue();

            Assert.Throws <InvalidOperationException>(() => semimutable.Value = 2);
        }
Exemplo n.º 8
0
        public void IsLockedIsTrueAfterLockValueIsCalled()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.LockValue();

            Assert.True(semimutable.IsLocked);
        }
Exemplo n.º 9
0
        public void HasDefaultValueIsTrueWhenResetValueIsCalled()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.Value = 2;
            semimutable.ResetValue();

            Assert.True(semimutable.HasDefaultValue);
        }
Exemplo n.º 10
0
        public void ResetChangesValueBackToDefault()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.Value = 2;

            semimutable.ResetValue();

            Assert.True(semimutable.HasDefaultValue);
        }
Exemplo n.º 11
0
        public void InvokingTheMethodReturnedFromGetUnlockMethodUnlocksTheValue()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.LockValue();

            var unlockValue = semimutable.GetUnlockValueMethod();

            unlockValue.Invoke(semimutable, null);

            Assert.False(semimutable.IsLocked);

            semimutable.Value = 2;

            Assert.Equal(2, semimutable.Value);
        }
Exemplo n.º 12
0
        public void IsLockedIsFalseInitially()
        {
            var semimutable = new Semimutable <int>(1);

            Assert.False(semimutable.IsLocked);
        }
Exemplo n.º 13
0
        public void DefaultValueIsUsedWhenValueIsNotChanged()
        {
            var semimutable = new Semimutable <int>(1);

            Assert.Equal(1, semimutable.Value);
        }
Exemplo n.º 14
0
        public void HasDefaultValueIsTrueWhenValueIsNotChanged()
        {
            var semimutable = new Semimutable <int>(1);

            Assert.True(semimutable.HasDefaultValue);
        }