Ejemplo n.º 1
0
        public void Compare_SameRowsBoolean_ReturnEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowComparer(new SettingsSingleRowComparison(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(ResultSetCompareResult.Matching));
        }
Ejemplo n.º 2
0
        public void Compare_SameRowsString_ReturnEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowComparer(new SettingsSingleRowComparison(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(ResultSetCompareResult.Matching));
        }
Ejemplo n.º 3
0
        public void Compare_SameRowsDateTime_ReturnEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowComparer(new SettingsSingleRowComparison(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(ResultSetCompareResult.Matching));
        }
Ejemplo n.º 4
0
        public void Compare_SameRows_ReturnEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowComparer(new SettingsSingleRowComparison(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(ResultSetCompareResult.Matching));
        }
Ejemplo n.º 5
0
        public void Compare_DifferentRowsNumeric_ReturnNotEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowComparer(new SettingsSingleRowComparison(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(ResultSetCompareResult.NotMatching));
        }
Ejemplo n.º 6
0
        public void Compare_DifferentRows_ReturnNotEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowComparer(new SettingsSingleRowComparison(ColumnType.Text, null, null));
            var reference = BuildDataTable <string>(new string[] { "Value0", "Value1" });
            var actual    = BuildDataTable <string>(new string[] { "ValueX", "ValueY" });

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

            //Assertion
            Assert.That(res, Is.EqualTo(ResultSetCompareResult.NotMatching));
        }
Ejemplo n.º 7
0
        public void Compare_ObjectsVersusSameTypedButWithPrecision_ReturnEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowComparer(new SettingsSingleRowComparison(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(ResultSetCompareResult.Matching));
        }
Ejemplo n.º 8
0
        public void Compare_MissingRow_ReturnNotEqual()
        {
            //Buiding object used during test
            var comparer  = new SingleRowComparer(new SettingsSingleRowComparison(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(ResultSetCompareResult.NotMatching));
            Assert.That(res.Missing, Has.Count.EqualTo(1));
        }