예제 #1
0
        public void GetSeparateValue_ItemSetFeatures4Items15_ReturnsSeparateValue()
        {
            // arrange
            FillItemSet_Features4_Items15();
            ISplitter splitter = new SplitterRss();

            // act
            FeatureNumericalValue sv = splitter.Split(_set, "F1");
            double fv = Math.Round(sv.FeatureValue, 2);

            // assert
            Assert.IsNotNull(sv);
        }
예제 #2
0
        public void GetSeparateValue_ItemSetFeatures1Items1_ReturnsSeparateValue()
        {
            // arrange
            ISplitter        splitter = new SplitterRss();
            ItemNumericalSet set      = new ItemNumericalSet(new List <string>()
            {
                "F1"
            });
            ItemNumerical item = set.CreateItem();

            item.SetValue("F1", 1);
            set.AddItem(item);

            // act
            var sv = splitter.Split(set, "F1");

            // assert
            Assert.IsNull(sv);
        }
예제 #3
0
        public void GetSeparateValue_ItemSetFeatures2Items5_ReturnsSeparateValue()
        {
            // arrange
            string f1 = "F1";
            string f2 = "F2";
            FeatureNumericalManager featureManager = new FeatureNumericalManager();

            featureManager.Add(new FeatureNumerical(f1));
            featureManager.Add(new FeatureNumerical(f2));
            _set = new ItemNumericalSet(featureManager);

            int[] a1 = new int[5] {
                1, 2, 3, 4, 5
            };
            float[] a2 = new float[5] {
                1f, 0.2f, 2.3f, 4.1f, 4f
            };
            for (int i = 0; i < 5; i++)
            {
                ItemNumerical item = _set.CreateItem();
                item.SetValue(f1, a1[i]);
                item.SetValue(f2, a2[i]);
                _set.AddItem(item);
            }

            ISplitter splitter = new SplitterRss();

            // act
            FeatureNumericalValue sv = splitter.Split(_set, "F1");
            double fv = Math.Round(sv.FeatureValue, 2);

            // assert
            Assert.IsNotNull(sv);
            //Assert.AreEqual(3.15, fv);
            Assert.AreEqual(1.65, fv);
        }