public void if_parent_Value_is_default_and_flag_is_Set_parent_Value_is_equal_to_flag_Value() { FlagsNumber flagsNumber = new FlagsNumber(); FlagItem flagItem = new FlagItem(flagsNumber, "name1", 8); // bit 3 flagItem.Set(); Assert.That(flagsNumber.Value, Is.EqualTo(8)); // bit 3 }
[TestCase(2UL, 12UL, 14UL)] // bit 1 - bit 2,3 - bit 1,2,3 public void sets_the_flag_Value_bits_into_the_parent_Value(ulong parentValue, ulong flagValue, ulong expectedParentValue) { FlagsNumber flagsNumber = new FlagsNumber { Value = parentValue }; FlagItem flagItem = new FlagItem(flagsNumber, "name1", flagValue); flagItem.Set(); Assert.That(flagsNumber.Value, Is.EqualTo(expectedParentValue)); }
public void after_Set_method_is_called_IsSet_returns_true() { flagItem.Set(); Assert.That(flagItem.IsSet, Is.True); }