예제 #1
0
        public void CalculateNegativeIndex_Success()
        {
            //test proves that no matter how much you subtract form zero the index is -100
            List <int> indicators = new List <int>();

            indicators.Clear();
            indicators.Add(-1);
            indicators.Add(-1);
            indicators.Add(-1);
            Assert.AreEqual(-100, HappyIndexCalculator.Calculate(indicators));
            indicators.Add(-1);
            indicators.Add(-1);
            indicators.Add(-1);
            Assert.AreEqual(-100, HappyIndexCalculator.Calculate(indicators));
            indicators.Add(-1);
            indicators.Add(-1);
            indicators.Add(-1);
            Assert.AreEqual(-100, HappyIndexCalculator.Calculate(indicators));
        }
예제 #2
0
        public void CalculateIndex_Success()
        {
            List <int> indicators = new List <int>();

            indicators.Clear();
            indicators.Add(1);
            Assert.AreEqual(100, HappyIndexCalculator.Calculate(indicators));

            indicators.Clear();
            indicators.Add(1);
            indicators.Add(1);
            indicators.Add(1);
            indicators.Add(1);
            indicators.Add(-1);
            indicators.Add(-1);
            Assert.AreEqual(33, HappyIndexCalculator.Calculate(indicators));

            indicators.Clear();
            indicators.Add(1);
            indicators.Add(1);
            indicators.Add(1);
            indicators.Add(-1);
            indicators.Add(-1);
            indicators.Add(-1);
            Assert.AreEqual(0, HappyIndexCalculator.Calculate(indicators));

            indicators.Clear();
            indicators.Add(-1);
            indicators.Add(-1);
            indicators.Add(-1);
            Assert.AreEqual(-100, HappyIndexCalculator.Calculate(indicators));
            indicators.Add(-1);
            indicators.Add(-1);
            indicators.Add(-1);
            Assert.AreEqual(-100, HappyIndexCalculator.Calculate(indicators));
            indicators.Add(-1);
            indicators.Add(-1);
            indicators.Add(-1);
            Assert.AreEqual(-100, HappyIndexCalculator.Calculate(indicators));
        }