Example #1
0
        public void FlagEnum_ArrayConstructor_SingleValue()
        {
            var value = new FlagEnum <TreeNodeDifference>(new[] { TreeNodeDifference.Name });

            Assert.IsTrue(value.Equals(TreeNodeDifference.Name));
            Assert.IsTrue(value.GetValues().Single() == TreeNodeDifference.Name);
        }
Example #2
0
        public void FlagEnum_ValueConstructor_FlagValue()
        {
            var value = new FlagEnum <TreeNodeDifference>(TreeNodeDifference.Name | TreeNodeDifference.NumberOfChildren);

            Assert.AreEqual(2, value.GetValues().Count);
            Assert.IsTrue(value.Equals(TreeNodeDifference.Name | TreeNodeDifference.NumberOfChildren));
            Assert.IsTrue(value.Contains(TreeNodeDifference.Name));
            Assert.IsTrue(value.Contains(TreeNodeDifference.NumberOfChildren));
        }
Example #3
0
        public void FlagEnum_DefaultConstructor_ShouldBeDefaultValue()
        {
            var value = new FlagEnum <TreeNodeDifference>();

            Assert.IsTrue(value.Equals(TreeNodeDifference.None));
            Assert.IsFalse(TreeNodeDifference.None.Equals(value));
            Assert.IsTrue(value == TreeNodeDifference.None);
            Assert.IsTrue(TreeNodeDifference.None == value);

            Assert.IsTrue(value.GetValues().Single() == TreeNodeDifference.None);
        }
Example #4
0
        public void FlagEnum_GetHashCode_EqualsFlagEnum()
        {
            var value = new FlagEnum <TreeNodeDifference>(TreeNodeDifference.Name);

            Assert.IsTrue(value.Equals((object)new FlagEnum <TreeNodeDifference>(TreeNodeDifference.Name)));
        }