Exemplo n.º 1
0
            public void It_should_Be_False_Upon_Demand()
            {
                var target = new InterlockedBoolean(false);

                target.GetValue().Should().BeFalse();
                target.Equals(false).Should().BeTrue();
                target.Equals(new InterlockedBoolean(false)).Should().BeTrue();
            }
Exemplo n.º 2
0
            public void It_should_Be_True_Upon_Demand()
            {
                var target = new InterlockedBoolean(true);

                target.GetValue().Should().BeTrue();
                target.Equals(true).Should().BeTrue();
                target.Equals(new InterlockedBoolean(true)).Should().BeTrue();
                target.GetHashCode().Should().Be(true.GetHashCode());
            }
Exemplo n.º 3
0
            public void It_should_Be_False_By_Default()
            {
                var target = new InterlockedBoolean();

                target.GetValue().Should().BeFalse();
                target.Equals(false).Should().BeTrue();
                target.Equals(new InterlockedBoolean(false)).Should().BeTrue();
                target.GetHashCode().Should().Be(false.GetHashCode());
            }
Exemplo n.º 4
0
            public void It_should_Evaluate_Equality_With_Value_Semantics()
            {
                var target = new InterlockedBoolean(true);

                target.Equals(null).Should().BeFalse();
                target.Equals((object)new InterlockedBoolean(true)).Should().BeTrue();

                // ReSharper disable once SuspiciousTypeConversion.Global
                target.Equals((object)true).Should().BeTrue();
                target.Equals(new object()).Should().BeFalse();
            }
Exemplo n.º 5
0
        public void TestEquals()
        {
            var ibTrue     = new InterlockedBoolean(true);
            var ibAlsoTrue = new InterlockedBoolean(true);
            var ibFalse    = new InterlockedBoolean(false);

            TestEquality(ibTrue, ibAlsoTrue, true);
            ibTrue.Equals(true).ShouldBeEquivalentTo(true);
            ibTrue.Equals(false).ShouldBeEquivalentTo(false);
            ibFalse.Equals(false).ShouldBeEquivalentTo(true);
            ibFalse.Equals(true).ShouldBeEquivalentTo(false);
        }
Exemplo n.º 6
0
 public void TestEquality(InterlockedBoolean first, InterlockedBoolean second, bool expected)
 {
     (first == second).ShouldBeEquivalentTo(expected);
     first.Equals(second).ShouldBeEquivalentTo(expected);
     (first.GetHashCode() == second.GetHashCode()).ShouldBeEquivalentTo(expected);
     (first != second).ShouldBeEquivalentTo(!expected);
 }