예제 #1
0
        public void Compare_SameRowsDateTime_ReturnEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowOrdinalEquivaler(new SettingsSingleRowOrdinalResultSet(ColumnType.DateTime, null, null));
            var reference = BuildDataTable <string>(new string[] { "2015-01-17", "2015-01-18" });
            var actual    = BuildDataTable <DateTime>(new DateTime[] { new DateTime(2015, 01, 17), new DateTime(2015, 01, 18) });

            //Call the method to test
            var res = comparer.Compare(reference, actual);

            //Assertion
            Assert.That(res, Is.EqualTo(ResultResultSet.Matching));
        }
예제 #2
0
        public void Compare_SameRowsBoolean_ReturnEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowOrdinalEquivaler(new SettingsSingleRowOrdinalResultSet(ColumnType.Boolean, null, null));
            var reference = BuildDataTable <string>(new string[] { "yes", "no" });
            var actual    = BuildDataTable <bool>(new bool[] { true, false });

            //Call the method to test
            var res = comparer.Compare(reference, actual);

            //Assertion
            Assert.That(res, Is.EqualTo(ResultResultSet.Matching));
        }
예제 #3
0
        public void Compare_SameRowsString_ReturnEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowOrdinalEquivaler(new SettingsSingleRowOrdinalResultSet(ColumnType.Text, null, null));
            var reference = BuildDataTable <string>(new string[] { "alpha", "beta" });
            var actual    = BuildDataTable <string>(new string[] { "alpha", "beta" });

            //Call the method to test
            var res = comparer.Compare(reference, actual);

            //Assertion
            Assert.That(res, Is.EqualTo(ResultResultSet.Matching));
        }
예제 #4
0
        public void Compare_SameRows_ReturnEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowOrdinalEquivaler(new SettingsSingleRowOrdinalResultSet(ColumnType.Numeric, null, null));
            var reference = BuildDataTable <double>(new double[] { 0, 1 });
            var actual    = BuildDataTable <double>(new double[] { 0, 1 });

            //Call the method to test
            var res = comparer.Compare(reference, actual);

            //Assertion
            Assert.That(res, Is.EqualTo(ResultResultSet.Matching));
        }
예제 #5
0
        public void Compare_DifferentRowsNumeric_ReturnNotEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowOrdinalEquivaler(new SettingsSingleRowOrdinalResultSet(ColumnType.Numeric, null, null));
            var reference = BuildDataTable <string>(new string[] { "100", "12.750" });
            var actual    = BuildDataTable <decimal>(new decimal[] { new decimal(999), new decimal(12.75) });

            //Call the method to test
            var res = comparer.Compare(reference, actual);

            //Assertion
            Assert.That(res, Is.EqualTo(ResultResultSet.NotMatching));
        }
예제 #6
0
        public void Compare_ObjectsVersusSameTypedButWithPrecision_ReturnEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowOrdinalEquivaler(new SettingsSingleRowOrdinalResultSet(ColumnType.Numeric, null, BuildColumnsStringDecimal()));
            var reference = BuildDataTable <string>(new string[] { "Value0", "100.50" });
            var actual    = BuildDataTable <object>(new object[] { "Value0", 100.5 });


            //Call the method to test
            var res = comparer.Compare(reference, actual);

            //Assertion
            Assert.That(res, Is.EqualTo(ResultResultSet.Matching));
        }
예제 #7
0
        public void Compare_MissingRow_ReturnNotEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowOrdinalEquivaler(new SettingsSingleRowOrdinalResultSet(ColumnType.Text, null, null));
            var reference = BuildDataTable <string>(new string[] { "Value0", "Value1", "Value2" });
            var actual    = BuildDataEmptyTable <string>(3);

            //Call the method to test
            var res = comparer.Compare(actual, reference);

            //Assertion
            Assert.That(res, Is.EqualTo(ResultResultSet.NotMatching));
            Assert.That(res.Missing, Has.Count.EqualTo(1));
        }