Beispiel #1
0
        public void CostructorWithCollectionEqualIdShouldInvalidOperationExceptionWhit()
        {
            ICollection <IPerson> people = new List <IPerson>();

            for (int i = 0; i < 20; i++)
            {
                FakeFirstPerson fakeFirstPerson = new FakeFirstPerson(3 + i, (string.Concat("Gosho"), 5).ToString());
                people.Add(fakeFirstPerson);
            }

            Assert.Throws <InvalidOperationException>(() => database = new Database(people.ToArray()));
        }
Beispiel #2
0
        public void AddWhitVeryElementsShouldInvalidOperationExceptionWhit()
        {
            for (int i = 0; i < 15; i++)
            {
                FakeFirstPerson fakeFirstPerson = new FakeFirstPerson(3 + i, (string.Concat("Gosho"), i).ToString());

                if (i == 14)
                {
                    Assert.Throws <InvalidOperationException>(() => database.Add(fakeFirstPerson));
                }
                else
                {
                    database.Add(fakeFirstPerson);
                }
            }
        }
Beispiel #3
0
        public void ChecksForTheExistenceWithIncorectlyId()
        {
            var fakePerson = new FakeFirstPerson(1, "Pesho");

            bool isPossible = database.ChecksForTheExistenceOfThisPerson(fakePerson);

            Assert.AreEqual(false, database.ChecksForTheExistenceOfThisPerson(fakePerson));
        }
Beispiel #4
0
        public void ChecksForTheExistenceWithCorrectlyId()
        {
            var fakePerson = new FakeFirstPerson(3, "Gosho");

            bool isPossible = database.ChecksForTheExistenceOfThisPerson(fakePerson);

            Assert.AreEqual(true, database.ChecksForTheExistenceOfThisPerson(fakePerson));
        }
Beispiel #5
0
        public void AddShouldCorrectly()
        {
            FakeFirstPerson fakeFirstPerson = new FakeFirstPerson(5, "Gosho");

            database.Add(fakeFirstPerson);
            IPerson person = database.DatabaseElements[2];

            Assert.AreEqual(fakeFirstPerson.Id, person.Id);
            Assert.AreEqual(fakeFirstPerson.Name, person.Name);
        }
Beispiel #6
0
        public void CostructorWithCollectionWhitEqalNameShouldInvalidOperationExceptionWhit()
        {
            ICollection <IPerson> people = new List <IPerson>();

            for (int i = 0; i < 2; i++)
            {
                FakeFirstPerson fakeFirstPerson = new FakeFirstPerson(3 + i, "Gosho");
                people.Add(fakeFirstPerson);
            }

            Assert.Throws <InvalidOperationException>(() => database = new Database(people.ToArray()));
        }
Beispiel #7
0
        public void AddWhitIncorectIdElementsShouldInvalidOperationExceptionWhit()
        {
            FakeFirstPerson person = new FakeFirstPerson(1, "Ana");

            Assert.Throws <InvalidOperationException>(() => database.Add(person));
        }