示例#1
0
        public void SplitData_ValidData_ReturnsRebelList()
        {
            var rebelList = _rebelSplitter.SplitData(validData);

            Assert.IsNotNull(rebelList);
            Assert.AreEqual(validData.Count, rebelList.Count);
        }
 public IActionResult Post([FromBody] StringCollection value)
 {
     try
     {
         var rebelsCollection = _dataSplitter.SplitData(value);
         _repository.SaveData(rebelsCollection);
         return(Ok());
     }
     catch (ServiceException)
     {
         return(BadRequest("Error al obtener los datos"));
     }
     catch (RepositoryException)
     {
         return(BadRequest("Error al guardar los datos"));
     }
 }
        public void PerformMultiValueDiscreteDataSplit()
        {
            // Given
            var testData          = TestDataBuilder.ReadWeatherDataWithCategoricalAttributes();
            var splitParams       = new SplittingParams("Outlook", "Play");
            var expectedRowCounts = new Dictionary <object, int>
            {
                ["Sunny"]    = 5,
                ["Overcast"] = 4,
                ["Rainy"]    = 5
            };

            // When
            var splittedData = MultiValueDiscreteDataSplitter.SplitData(testData, splitParams);

            // Then
            Assert.AreEqual(expectedRowCounts.Count, splittedData.Count);
            foreach (var splittedResult in splittedData)
            {
                var expectedCount = expectedRowCounts[splittedResult.SplitLink.TestResult];
                Assert.AreEqual(expectedCount, splittedResult.SplittedDataFrame.RowCount);
                Assert.AreEqual(expectedCount, splittedResult.SplitLink.InstancesCount);
            }
        }