Пример #1
0
        public void SetFlag_DoesNotMutateArgument()
        {
            NoZeroFlags fourNotSet = NoZeroFlags.Three;

            Assert.That(fourNotSet.HasFlag(NoZeroFlags.Four), Is.False, "does not contain four initially");

            fourNotSet.SetFlag(NoZeroFlags.Four);             // no assignation

            Assert.That(fourNotSet.HasFlag(NoZeroFlags.Four), Is.False, "no mutation");
        }
Пример #2
0
        public void SetFlag_AlreadySetValue_ValueLeftAsSet()
        {
            NoZeroFlags fourAlreadySet = NoZeroFlags.Three | NoZeroFlags.Four;

            Assert.That(fourAlreadySet.HasFlag(NoZeroFlags.Four), Is.True, "contains four initially");

            fourAlreadySet = fourAlreadySet.SetFlag(NoZeroFlags.Four);

            Assert.That(fourAlreadySet.HasFlag(NoZeroFlags.Four), Is.True, "still contains four");
        }