Esempio n. 1
0
        public void CanAddTheNumbersOfElementsSpecifiedInConstructor()
        {
            var set = new Set(5);

            set.Add(1);
            set.Add(2);
            set.Add(3);
            set.Add(4);
            set.Add(5);

            Assert.AreEqual(5, set.Get());
            Assert.AreEqual(4, set.Get());
            Assert.AreEqual(3, set.Get());
            Assert.AreEqual(2, set.Get());
            Assert.AreEqual(1, set.Get());
        }
Esempio n. 2
0
        public void ICanAddAnElement_ThenICanGetItBack()
        {
            const int four = 4;
            var set = new Set(1);

            set.Add(four);
            Assert.AreEqual(four, set.Get());
        }
Esempio n. 3
0
        public void CanAddFloatNumbers()
        {
            var four = 4.0f;
            var set = new Set(1);

            set.Add(four);

            Assert.IsFalse(set.IsEmpty());
            Assert.AreEqual(four, set.Get());
        }
Esempio n. 4
0
        public void IfIAddFiveFour_ThenIShouldGetFourFive()
        {
            const int four = 4;
            const int five = 5;

            var set = new Set(2);

            set.Add(five);
            set.Add(four);
            Assert.AreEqual(four, set.Get());
            Assert.AreEqual(five, set.Get());
        }
Esempio n. 5
0
        public void IfITryAddTheSameNumberManyTimes_ThenItShouldNotBeAdded()
        {
            const int four = 4;
            var set = new Set(5);

            set.Add(four);
            set.Add(four);
            set.Add(four);
            set.Add(four);
            set.Add(four);

            Assert.IsFalse(set.IsEmpty());
            Assert.AreEqual(null, set.Get());
            Assert.AreEqual(null, set.Get());
            Assert.AreEqual(null, set.Get());
            Assert.AreEqual(null, set.Get());
            Assert.AreEqual(four, set.Get());
        }