Exemple #1
0
        public void Comparing_different_types_results_in_implicit_cast()
        {
            var object1 = default(CastSpy);
            var object2 = default(string);

            "Given a DefaultComparison"
            .Given(() => SUT = new DefaultComparison());

            "And 2 objects to compare"
            .And(() =>
            {
                object1 = new CastSpy("abc");
                object2 = "abc";
            });

            "And a Comparison context object"
            .And(() => Context = new ComparisonContext());

            "When calling Compare"
            .When(() => Result = SUT.Compare(Context, object1, object2));

            "Then it should call the implicit operator"
            .Then(() => object1.Called.ShouldBe(true));

            "And it should return Pass"
            .And(() => Result.ShouldBe(ComparisonResult.Pass));
        }
        public void Comparing_different_types_results_in_implicit_cast()
        {
            var object1 = default (CastSpy);
            var object2 = default (string);

            "Given a DefaultComparison"
                .Given(() => SUT = new DefaultComparison());

            "And 2 objects to compare"
                .And(() =>
                    {
                        object1 = new CastSpy("abc");
                        object2 = "abc";
                    });

            "And a Comparison context object"
                .And(() => Context = new ComparisonContext());

            "When calling Compare"
                .When(() => Result = SUT.Compare(Context, object1, object2));

            "Then it should call the implicit operator"
                .Then(() => object1.Called.ShouldBe(true));

            "And it should return Pass"
                .And(() => Result.ShouldBe(ComparisonResult.Pass));
        }