Example #1
0
 public void NullMakeValueList()
 {
     var oldState = new SensorState(_testSensor, DateTime.Now, new Dictionary<DateTime, float>(), null);
     oldState.MakeValue(null, 5, new ChangeReason(0, "Test"));
 }
Example #2
0
        public void SingleValueMadeDifferentValue()
        {
            // TODO: could move these to SetUp
            var date = new DateTime(2011, 7, 7, 12, 15, 0);

            var list = new List<DateTime>();
            list.Add(date);

            var oldState = new SensorState(_testSensor, DateTime.Now, new Dictionary<DateTime, float>(), null);
            var newState = oldState.MakeValue(list, 5, new ChangeReason(0, "Test"));

            Assert.AreEqual(5, newState.Values[date]);
        }
Example #3
0
        public void MultipleValuesMadeDifferentValue()
        {
            var date = new DateTime(2011, 7, 7, 12, 15, 0);

            var list = new List<DateTime>();
            list.Add(date.AddMinutes(15));
            list.Add(date.AddMinutes(30));
            list.Add(date.AddMinutes(45));

            var oldState = new SensorState(_testSensor, DateTime.Now, new Dictionary<DateTime, float>(), null);
            oldState.Values.Add(date, 5000);

            var newState = oldState.MakeValue(list, 20, new ChangeReason(0, "Test"));

            Assert.AreNotEqual(20, newState.Values[date]);
            Assert.AreEqual(20, newState.Values[list[0]]);
            Assert.AreEqual(20, newState.Values[list[1]]);
            Assert.AreEqual(20, newState.Values[list[2]]);
        }