public void CanHaveCompoundEnumValues()
 {
     var p = new Person { PersonType = PeopleTypes.CoolestType };
     Assert.IsTrue(p.PersonType.HasFlag(PeopleTypes.CoolestType));
     Assert.IsTrue(p.PersonType.HasFlag(PeopleTypes.Geek));
     Assert.IsTrue(p.PersonType.HasFlag(PeopleTypes.Trekkie));
     Assert.IsTrue(p.PersonType.HasFlag(PeopleTypes.Geek | PeopleTypes.Trekkie));
 }
 public void CanAddValuesAtDifferentTimes()
 {
     var p = new Person();
     //has a default value
     Assert.AreEqual(0, (int) p.PersonType);
     Assert.IsTrue(p.PersonType.HasFlag(PeopleTypes.Square));
     //can add a value
     p.PersonType |= PeopleTypes.Nerd;
     Assert.IsTrue(p.PersonType.HasFlag(PeopleTypes.Square | PeopleTypes.Nerd));
 }
 public void CanSkipItemsWhenAsAProperty()
 {
     //first four but skip geek
     var person = new Person { PersonType = PeopleTypes.Dweeb | PeopleTypes.Nerd | PeopleTypes.Fanboy };
     Assert.IsFalse(person.PersonType.HasFlag(PeopleTypes.Geek));
 }
 public void AddingTwoValuesToPeople_TestingHasFlagsCanFail()
 {
     var p = new Person { PersonType = PeopleTypes.Dweeb | PeopleTypes.Geek };
     Assert.IsFalse(p.PersonType.HasFlag(PeopleTypes.Dweeb | PeopleTypes.Fanboy));
 }
 public void AddingTwoValuesToPeople_TestingHasSingleFlag()
 {
     var p = new Person { PersonType = PeopleTypes.Dweeb | PeopleTypes.Geek };
     Assert.IsTrue(p.PersonType.HasFlag(PeopleTypes.Geek));
 }
 public void AddingOneValueToPeople_TestingHasFlagsWillFail()
 {
     var p = new Person { PersonType = PeopleTypes.Dweeb };
     Assert.IsFalse(p.PersonType.HasFlag(PeopleTypes.Geek));
 }
 public void AddingOneValueToPeople_TestingHasFlags()
 {
     var p = new Person { PersonType = PeopleTypes.Dweeb };
     Assert.IsTrue(p.PersonType.HasFlag(PeopleTypes.Dweeb));
 }
 public void HasDefaultValueWhenSetByObjectInitialiser()
 {
     var p = new Person { PersonType = PeopleTypes.CoolestType };
     Assert.IsTrue(p.PersonType.HasFlag(PeopleTypes.Square));
 }
 public void HasDefaultValueWhenConstructed()
 {
     var p = new Person(PeopleTypes.CoolestType);
     Assert.IsTrue(p.PersonType.HasFlag(PeopleTypes.Square));
 }
 public void AddingOneValueToPeople()
 {
     var p = new Person { PersonType = PeopleTypes.Dweeb };
     Assert.AreEqual(PeopleTypes.Dweeb, p.PersonType);
 }