Beispiel #1
0
        public void ReachAllFieldsOfAllTypes()
        {
            //  # Arrange.
            var     pr  = new PseudoRandom(nameof(ReachAllFieldsOfAllTypes));
            dynamic sut = new ReachIn(typeof(MyStaticBaseClassWithTypes));

            //  #   Act and Assert.
            var anyIntValue = pr.Int();

            sut._myPrivateStaticIntField = anyIntValue;
            // We have a problem here with FluentAssertions where it, runtime, throws an exception even though the parameters are equal.
            //sut._myPrivateStaticIntField.Should().be(anyIntValue);
            Assert.Equal(anyIntValue, sut._myPrivateStaticIntField);

            var anyStringValue = pr.String();

            sut._myPrivateStaticStringField = anyStringValue;
            // We have a problem here with FluentAssertions where it, runtime, throws an exception even though the parameters are equal.
            //sut._myPrivateStaticStringField.Should().Be(anyStringValue);
            Assert.Equal(anyStringValue, sut._myPrivateStaticStringField);

            var anyLongValue = pr.PositiveLong();

            sut._myPrivateStaticLongField = anyLongValue;
            // We have a problem here with FluentAssertions where it, runtime, throws an exception even though the parameters are equal.
            //sut._myPrivateStaticLongField.Should().be(anyLongValue);
            Assert.Equal(anyLongValue, sut._myPrivateStaticLongField);

            var anyObject =
                new
            {
                FieldOne = pr.Int(),
            };

            sut._myPrivateStaticObjectField = anyObject;
            // We have a problem here with FluentAssertions where it, runtime, throws an exception even though the parameters are equal.
            //sut._myPrivateStaticObjectField.FieldOne.Should().Be(anyObject.FieldOne);
            Assert.Equal(anyObject.FieldOne, sut._myPrivateStaticObjectField.FieldOne);

            // If there is any other type to test, this is the place to add.
        }