Ejemplo n.º 1
0
            public void It_should_have_the_Expected_Value_By_Default()
            {
                var target = new InterlockedDateTime();

                target.Equals(new DateTime(0, DateTimeKind.Utc)).Should().BeTrue();
                target.Equals(new InterlockedDateTime(0)).Should().BeTrue();
                target.GetHashCode().Should().Be(new DateTime(0, DateTimeKind.Utc).GetHashCode());
            }
Ejemplo n.º 2
0
            public void It_should_Accept_The_Value_Set()
            {
                var expected = DateTime.UtcNow;
                var target   = new InterlockedDateTime();

                target.Equals(expected).Should().BeFalse();
                target.SetValue(expected);
                target.Equals(expected).Should().BeTrue();
            }
Ejemplo n.º 3
0
            public void It_should_Be_Accept_A_Starting_Tick_Count()
            {
                var original = DateTime.UtcNow;
                var target   = new InterlockedDateTime(original.Ticks);

                target.GetValue().Should().Be(original);
                target.Equals(original).Should().BeTrue();
                target.Equals(new InterlockedDateTime(original)).Should().BeTrue();
            }
Ejemplo n.º 4
0
            public void It_should_Evaluate_Equality_With_Value_Semantics()
            {
                var now    = DateTime.UtcNow;
                var target = new InterlockedDateTime(now);

                target.Equals(null).Should().BeFalse();
                target.Equals((object)new InterlockedDateTime(now)).Should().BeTrue();

                // ReSharper disable once SuspiciousTypeConversion.Global
                target.Equals((object)now).Should().BeTrue();

                target.Equals(new object()).Should().BeFalse();
            }