示例#1
0
        public void AlgoTest()
        {
            var checkerFactory = new CheckerFactory();

            var algo = new ShinyBusinessService();
            var source = new Simple { Id = 1, Name = "A", Value = 1.0 };

            var expected = new Simple { Id = 2, Name = "B", Value = 1.2 };

            var candidate = algo.Run(source);

            checkerFactory.Check(expected, candidate);
        }
示例#2
0
        public void GenericTest()
        {
            var checkerFactory = new CheckerFactory();

            var algo = new ShinyBusinessService();
            var source = new Simple {Id = 1, Name = "A", Value = 1.0};

            var expected = new Simple {Id = 2, Name = "B", Value = 1.2};

            var candidate = algo.Run(source);

            var wexpected = new Wrapper<Simple> {Content = expected};
            var wcandidate = new Wrapper<Simple> {Content = candidate};
            checkerFactory.Check(wexpected, wcandidate);
        }
示例#3
0
        public void CompareDoubleStandardComparerTest()
        {
            var checkerFactory = new CheckerFactory();

            ConventionsFactory.Conventions.TypeConventions.Comparer.Clear();

            var expected = new Simple {
                Id = 1, Name = "A", Value = 10.00005
            };

            var candidate = new Simple {
                Id = 1, Name = "A", Value = 10.00006
            };

            try
            {
                checkerFactory.Check(expected, candidate);
            }
            catch (PropertyCheckException pex)
            {
                Assert.That(pex.Message, Is.EqualTo("Simple.Value: Expected:<10.00005>. Actual:<10.00006>"), "Message differs");
            }
        }
示例#4
0
        public void GenericInterfaceTest()
        {
            var checkerFactory = new CheckerFactory();

            var algo   = new ShinyBusinessService();
            var source = new Simple {
                Id = 1, Name = "A", Value = 1.0
            };

            var expected = new Simple {
                Id = 2, Name = "B", Value = 1.2
            };

            var candidate = algo.Run(source);

            IWrapper <Simple> wexpected = new Wrapper <Simple> {
                Content = expected
            };
            IWrapper <Simple> wcandidate = new Wrapper <Simple> {
                Content = candidate
            };

            checkerFactory.Check(wexpected, wcandidate);
        }