Ejemplo n.º 1
0
        public void Comparing_different_types_results_in_call_to_IConvertible()
        {
            var object1 = default(StringConvertibleSpy);
            var object2 = default(string);

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

            "And 2 objects to compare"
            .And(() =>
            {
                object1 = new StringConvertibleSpy("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 IConvertible.ToString"
            .Then(() => object1.Called.ShouldBe(true));

            "And it should return Pass"
            .And(() => Result.ShouldBe(ComparisonResult.Pass));
        }
Ejemplo n.º 2
0
        public void Comparing_different_types_results_in_call_to_IConvertible()
        {
            var object1 = default (StringConvertibleSpy);
            var object2 = default (string);

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

            "And 2 objects to compare"
                .And(() =>
                    {
                        object1 = new StringConvertibleSpy("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 IConvertible.ToString"
                .Then(() => object1.Called.ShouldBe(true));

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