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); }
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()); }
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()); }