Ejemplo n.º 1
0
        public void Enum_Add_matches_bitwise_operation()
        {
            const AccountState bitOperation = AccountState.Closed | AccountState.PastDue;
            var declarative = AccountState.Closed.Add(AccountState.PastDue);

            bitOperation.Should().Be(declarative);
        }
Ejemplo n.º 2
0
        public void Enum_Remove_matches_bitwise_operation()
        {
            const AccountState bitwise = (AccountState.Closed | AccountState.PastDue) ^ AccountState.PastDue;
            var declarative            = (AccountState.Closed | AccountState.PastDue).Remove(AccountState.PastDue);

            bitwise.Should().Be(declarative);
        }
Ejemplo n.º 3
0
        public void Enum_Is_detects_overlap()
        {
            const AccountState state = AccountState.Active | AccountState.PastDue;

            state.Is(AccountState.PastDue).Should().BeTrue();
            state.Is(AccountState.Active).Should().BeTrue();
            state.Is(AccountState.Closed).Should().BeFalse();
        }
Ejemplo n.º 4
0
        public void String_ParseAsEnum_preserves_flags_parsing()
        {
            const AccountState state = AccountState.Active | AccountState.PastDue;

            var stateString = state.ToString();

            var result = stateString.ParseAsEnum <AccountState>();

            result.Should().Be(state);
        }
Ejemplo n.º 5
0
        public void String_ParseAsEnum_parses_AccountState_correctly(string toParse, AccountState expected)
        {
            var actual = toParse.ParseAsEnum <AccountState>();

            actual.Should().Be(expected);
        }
Ejemplo n.º 6
0
 public void String_ParseAsEnum_parses_AccountState_correctly(string toParse, AccountState expected)
 {
     var actual = toParse.ParseAsEnum<AccountState>();
     actual.Should().Be(expected);
 }