Ejemplo n.º 1
0
        public void Add_IfCountLessThan16_ShouldAddPersonAsLast()
        {
            var expected = new Person(3, "c");
            var db       = new ExtendedDatabase(new Person(1, "a"), new Person(2, "b"));

            db.Add(new Person(3, "c"));

            Assert.AreEqual(expected, db.Fetch()[db.Count - 1]);
        }
Ejemplo n.º 2
0
        public void Remove_IfCountMoreThan0_ShouldRemoveLastPerson()
        {
            var db   = new ExtendedDatabase(new Person(1, "a"), new Person(2, "b"), new Person(3, "c"));
            var last = new Person(3, "c");

            db.Remove();

            Assert.That(!db.Fetch().Contains(last));
        }
Ejemplo n.º 3
0
        public void Fetch_ReturnFullCollection()
        {
            var db   = new ExtendedDatabase(new Person(1, "a"), new Person(2, "b"), new Person(3, "c"));
            var list = new List <Person> {
                new Person(1, "a"), new Person(2, "b"), new Person(3, "c")
            };

            Assert.That(db.Fetch(), Is.EqualTo(list));
        }
        public void Fetch_ShouldWorkCorrectly(int amount)
        {
            var arr = new Person[amount];

            for (int i = 0; i < amount; i++)
            {
                arr[i] = new Person(i, i.ToString());
            }

            ExtendedDatabase db = new ExtendedDatabase(arr);

            var expectedResult = arr.Reverse().ToArray();

            var actualResult = db.Fetch();

            Assert.That(actualResult, Is.EqualTo(expectedResult));
        }
Ejemplo n.º 5
0
 public void DatabaseFetchesCorrectElements()
 {
     Assert.AreEqual(db.InnerCollection, db.Fetch());
 }