Example #1
0
        public void CreateDataSetWithNullNameFails()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newDataSetName = null;

            Assert.Throws <ArgumentException>(() => rmsx.CreateDataSet(newDataSetName));
        }
Example #2
0
        public void DataSetGetNameShouldReturnName()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newDataSetName = "NewDataSet";
            DataSet ds             = rmsx.CreateDataSet(newDataSetName);

            Assert.That(ds.GetName(), Is.EqualTo(newDataSetName));
        }
Example #3
0
        public void CreateDataSetReturnsNewDataSet()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newDataSetName = "NewDataSet";
            DataSet dataSet        = rmsx.CreateDataSet(newDataSetName);

            Assert.That(dataSet.GetName(), Is.EqualTo(newDataSetName));
        }
Example #4
0
        public void DataSetDataPointAddReturnsNewDataPoint()
        {
            RuleMSX   rmsx             = new RuleMSX();
            string    newDataSetName   = "NewDataSet";
            string    newDataPointName = "NewDataPointName";
            DataSet   ds  = rmsx.CreateDataSet(newDataSetName);
            DataPoint dpo = ds.AddDataPoint(newDataPointName);

            Assert.That(dpo.GetName(), Is.EqualTo(newDataPointName));
        }
Example #5
0
        public void GetDataSetWithIncorrectNameReturnsNull()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newDataSetName = "NewDataSet";

            rmsx.CreateDataSet(newDataSetName);
            DataSet ds = rmsx.GetDataSet("SomeOtherName");

            Assert.IsNull(ds);
        }
Example #6
0
        public void GetDataSetByNameReturnsCorrectDataSet()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newDataSetName = "NewDataSet";

            rmsx.CreateDataSet(newDataSetName);
            DataSet ds = rmsx.GetDataSet(newDataSetName);

            Assert.That(ds.GetName(), Is.EqualTo(newDataSetName));
        }
Example #7
0
        public void GetDataSetsReturnsDataSetCollection()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newDataSetName = "NewDataSet";

            rmsx.CreateDataSet(newDataSetName);
            List <DataSet> dsl = rmsx.GetDataSets();
            DataSet        ds  = dsl[0];

            Assert.That(ds.GetName(), Is.EqualTo(newDataSetName));
        }
Example #8
0
        public void SetDataPointSourceAtDataPointCreateCheckSource()
        {
            RuleMSX         rmsx               = new RuleMSX();
            string          newDataSetName     = "NewDataSet";
            string          newDataPointName   = "NewDataPointName";
            string          testDataPointValue = "TestDataPointValue";
            DataSet         ds   = rmsx.CreateDataSet(newDataSetName);
            DataPointSource srci = new TestDataPointSource(testDataPointValue);
            DataPoint       dpo  = ds.AddDataPoint(newDataPointName, srci);
            DataPointSource srco = dpo.GetSource();

            Assert.That(srco.GetValue().ToString(), Is.EqualTo(testDataPointValue));
        }
Example #9
0
        public void GetDataPointsReturnsCorrectDictOfPoints()
        {
            RuleMSX   rmsx             = new RuleMSX();
            string    newDataSetName   = "NewDataSet";
            string    newDataPointName = "NewDataPointName";
            DataSet   ds  = rmsx.CreateDataSet(newDataSetName);
            DataPoint dpi = ds.AddDataPoint(newDataPointName);
            Dictionary <string, DataPoint> dpd = ds.GetDataPoints();
            DataPoint dpo;

            dpd.TryGetValue(newDataPointName, out dpo);
            Assert.That(dpo.GetName(), Is.EqualTo(newDataPointName));
        }
Example #10
0
        public void DataPointSourceSetStaleNoError()
        {
            // Call to SetStale() on DataPointSource should return no error
            RuleMSX         rmsx               = new RuleMSX();
            string          newDataSetName     = "NewDataSet";
            string          newDataPointName   = "NewDataPointName";
            string          testDataPointValue = "TestDataPointValue";
            DataSet         ds   = rmsx.CreateDataSet(newDataSetName);
            DataPoint       dpo  = ds.AddDataPoint(newDataPointName);
            DataPointSource srci = new TestDataPointSource(testDataPointValue);

            dpo.SetDataPointSource(srci);
            Assert.DoesNotThrow(() => srci.SetStale());
        }
Example #11
0
        public void RuleMSXStopShouldReturnTrueWithActiveRuleSet()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newRuleSetName = "NewRuleSet";
            string  newDataSetName = "NewDataSet";
            string  newRuleName    = "Rule1";
            RuleSet rs             = rmsx.CreateRuleSet(newRuleSetName);

            rs.AddRule(newRuleName);
            DataSet ds = rmsx.CreateDataSet(newDataSetName);

            rs.Execute(ds);
            Assert.That(rmsx.Stop(), Is.EqualTo(true));
        }
Example #12
0
        public void RuleMSXStopShouldReturnTrueWithUnexecutedRuleSet()
        {
            RuleMSX rmsx           = new RuleMSX();
            string  newRuleSetName = "NewRuleSet";
            string  newDataSetName = "NewDataSet";
            string  newRuleName    = "Rule1";
            RuleSet rs             = rmsx.CreateRuleSet(newRuleSetName);

            rs.AddRule(newRuleName);
            DataSet ds = rmsx.CreateDataSet(newDataSetName);

            // We are deliberately not executing the ruleset...
            //rs.Execute(ds);
            Assert.That(rmsx.Stop(), Is.EqualTo(true));
        }