Exemple #1
0
        public void Value_Type_Homogenizer_Homogenizes_Instances_Of_Supported_Type()
        {
            var homogenizer = new DoublingHomogenizer();

            homogenizer
            .Homogenize(7)
            .Should()
            .Be(14);
            homogenizer
            .Homogenize(-4)
            .Should()
            .Be(-8);
            homogenizer
            .Homogenize(0)
            .Should()
            .Be(0);
            int?nullableValue = 27;

            homogenizer
            .Homogenize(nullableValue)
            .Should()
            .Be(54);
            int?nullValue = null;

            homogenizer
            .Homogenize(nullValue)
            .Should()
            .BeNull();
        }
Exemple #2
0
        public void Value_Type_Homogenizer_Does_Not_Affect_Instances_Of_Unsupported_Types()
        {
            var homogenizer = new DoublingHomogenizer();

            homogenizer
            .Homogenize(787.0m)
            .Should()
            .Be(787.0m);
            homogenizer
            .Homogenize(57L)
            .Should()
            .Be(57L);
            homogenizer
            .Homogenize("Islands in the Stream")
            .Should()
            .Be("Islands in the Stream");
            var instance = new object();

            homogenizer
            .Homogenize(instance)
            .Should()
            .Be(instance);
            var anotherInstance = new InvalidCastException();

            homogenizer
            .Homogenize(anotherInstance)
            .Should()
            .Be(anotherInstance);
            DateTime now = DateTime.Now;

            homogenizer
            .Homogenize(now)
            .Should()
            .Be(now);
            long?nullValue = null;

            homogenizer
            .Homogenize(nullValue)
            .Should()
            .BeNull();
            Exception anotherNullValue = null;

            homogenizer
            .Homogenize(anotherNullValue)
            .Should()
            .BeNull();
        }