示例#1
0
        public void TestCompareValues_TwoValues_Identical()
        {
            // Arrange
            string type   = this.Util.GetTestValue("type");
            string key    = this.Util.GetTestValue("key");
            string value0 = this.Util.GetTestValue("value0");
            string value1 = this.Util.GetTestValue("value1");

            DataSet ds0 = new DataSet("TestDataSet0", type);
            DataSet ds1 = new DataSet("TestDataSet1", type);

            ds0.NewInstance();
            DataPoint dp0 = new DataPoint(ds0, type, key, value0);

            dp0.AddValue(value1);

            ds1.NewInstance();
            DataPoint dp1 = new DataPoint(ds1, type, key, value0);

            dp1.AddValue(value1);

            // Act
            CompareResult result0 = dp0.Compare(dp1);
            CompareResult result1 = dp1.Compare(dp0);

            // Assert
            Assert.AreEqual(CompareResult.Identical, result0,
                            "Compare should return Identical when both datapoints have the same values.");
            Assert.AreEqual(CompareResult.Identical, result1,
                            "Compare should return Identical when both datapoints have the same values.");
        }
示例#2
0
        public void TestCompareValues_TwoValues_NoOverlap()
        {
            // Arrange
            string type   = this.Util.GetTestValue("type");
            string key    = this.Util.GetTestValue("key");
            string value0 = this.Util.GetTestValue("value0");
            string value1 = this.Util.GetTestValue("value1");

            DataSet ds0 = new DataSet("TestDataSet0", type);
            DataSet ds1 = new DataSet("TestDataSet1", type);

            ds0.NewInstance();
            DataPoint dp0 = new DataPoint(ds0, type, key, value0);

            ds0.NewInstance();
            dp0.AddValue(value1);

            ds1.NewInstance();
            DataPoint dp1 = new DataPoint(ds1, type, key, value0 + "x");

            ds1.NewInstance();
            dp1.AddValue(value1 + "x");

            // Act
            CompareResult result0 = dp0.Compare(dp1);
            CompareResult result1 = dp1.Compare(dp0);

            // Assert
            Assert.AreEqual(CompareResult.NoOverlap, result0,
                            "Compare should return NoOverlap when datapoints have all different values.");
            Assert.AreEqual(CompareResult.NoOverlap, result1,
                            "Compare should return NoOverlap when datapoints have all different values.");
        }
示例#3
0
        public void TestCompareValues_OneValue_Different_NotAlwaysExist()
        {
            // Arrange
            string  type   = this.Util.GetTestValue("type");
            string  key    = this.Util.GetTestValue("key");
            string  value0 = this.Util.GetTestValue("value0");
            string  value1 = this.Util.GetTestValue("value1");
            DataSet ds0    = new DataSet("TestDataSet0", type);
            DataSet ds1    = new DataSet("TestDataSet1", type);

            ds0.NewInstance();
            DataPoint dp0 = new DataPoint(ds0, type, key, value0);

            ds1.NewInstance();
            DataPoint dp1 = new DataPoint(ds1, type, key, value1);

            // Adding another instance means AlwaysExists() will return false
            ds0.NewInstance();
            ds1.NewInstance();

            // Act
            CompareResult result0 = dp0.Compare(dp1);
            CompareResult result1 = dp1.Compare(dp0);

            // Assert
            Assert.AreEqual(CompareResult.Overlap, result0,
                            "Compare should return Overlap when values do not overlap but AlwaysExists() is false for both datapoints.");
            Assert.AreEqual(CompareResult.Overlap, result1,
                            "Compare should return Overlap when values do not overlap but AlwaysExists() is false for both datapoints.");
        }
示例#4
0
        public void TestCompareValues_ThreeValues_Overlap()
        {
            // Arrange
            string type   = this.Util.GetTestValue("type");
            string key    = this.Util.GetTestValue("key");
            string value0 = this.Util.GetTestValue("value0");
            string value1 = this.Util.GetTestValue("value1");
            string value2 = this.Util.GetTestValue("value2");

            DataSet ds0 = new DataSet("TestDataSet0", type);
            DataSet ds1 = new DataSet("TestDataSet1", type);
            DataSet ds2 = new DataSet("TestDataSet2", type);
            DataSet ds3 = new DataSet("TestDataSet3", type);
            DataSet ds4 = new DataSet("TestDataSet3", type);

            ds0.NewInstance();
            DataPoint dp0 = new DataPoint(ds0, type, key, value0);

            ds0.NewInstance();
            dp0.AddValue(value1);
            ds0.NewInstance();
            dp0.AddValue(value2);

            ds1.NewInstance();
            DataPoint dp1 = new DataPoint(ds1, type, key, value0 + "x");

            ds1.NewInstance();
            dp1.AddValue(value1);
            ds1.NewInstance();
            dp1.AddValue(value2);

            ds2.NewInstance();
            DataPoint dp2 = new DataPoint(ds2, type, key, value0);

            ds2.NewInstance();
            dp2.AddValue(value1 + "x");
            ds2.NewInstance();
            dp2.AddValue(value2);

            ds3.NewInstance();
            DataPoint dp3 = new DataPoint(ds3, type, key, value0);

            ds3.NewInstance();
            dp3.AddValue(value1);
            ds3.NewInstance();
            dp3.AddValue(value2 + "x");

            ds4.NewInstance();
            DataPoint dp4 = new DataPoint(ds4, type, key, value0 + "x");

            ds4.NewInstance();
            dp4.AddValue(value1);
            ds4.NewInstance();
            dp4.AddValue(value2 + "x");

            // Act
            CompareResult result0 = dp0.Compare(dp1);
            CompareResult result1 = dp0.Compare(dp2);
            CompareResult result2 = dp0.Compare(dp3);
            CompareResult result3 = dp0.Compare(dp4);

            // Assert
            Assert.AreEqual(CompareResult.Overlap, result0,
                            "Compare should return Overlap when datapoints have overlapping values (only first different).");
            Assert.AreEqual(CompareResult.Overlap, result1,
                            "Compare should return Overlap when datapoints have overlapping values (only second different).");
            Assert.AreEqual(CompareResult.Overlap, result2,
                            "Compare should return Overlap when datapoints have overlapping values (only last different).");
            Assert.AreEqual(CompareResult.Overlap, result3,
                            "Compare should return Overlap when datapoints have overlapping values (first and last different).");
        }