예제 #1
0
        public void Add_RepoContains1Person_PersonAddedToRepo()
        {
            var testObject = new PersonTestableObject();

            testObject.InMemoryCarRepository.Save(testObject.PersonJack);

            Assert.AreEqual(testObject.PersonJack, testObject.InMemoryCarRepository.FindById(testObject.PersonJack.Id));
        }
예제 #2
0
        private void CRUDmix()
        {
            var testObject = new PersonTestableObject();

            testObject.InMemoryCarRepository.Save(testObject.PersonJack);
            testObject.InMemoryCarRepository.Save(testObject.PersonRobert);

            testObject.InMemoryCarRepository.Delete(testObject.PersonJack.Id);
        }
예제 #3
0
        public void PerformDeleteOperation()
        {
            var testObject = new PersonTestableObject();

            testObject.InMemoryCarRepository.Save(testObject.PersonJack);
            testObject.InMemoryCarRepository.Save(testObject.PersonRobert);

            testObject.InMemoryCarRepository.Delete(testObject.PersonJack.Id);
        }
예제 #4
0
        public void PerformFindOperation()
        {
            var testObject = new PersonTestableObject();

            testObject.InMemoryCarRepository.Save(testObject.PersonJack);
            testObject.InMemoryCarRepository.Save(testObject.PersonRobert);

            var result = testObject.InMemoryCarRepository.FindById(testObject.PersonRobert.Id);
        }
예제 #5
0
        public void GetAll_Add2PersonsToRepo_RepoAllReturn2Persons()
        {
            var testObject = new PersonTestableObject();

            testObject.InMemoryCarRepository.Save(testObject.PersonJack);
            testObject.InMemoryCarRepository.Save(testObject.PersonRobert);

            Assert.AreEqual(2, testObject.InMemoryCarRepository.All().Count());
            Assert.AreEqual(testObject.PersonJack, testObject.InMemoryCarRepository.FindById(testObject.PersonJack.Id));
            Assert.AreEqual(testObject.PersonRobert, testObject.InMemoryCarRepository.FindById(testObject.PersonRobert.Id));
        }
예제 #6
0
        public void Delete_RepoNotContainsAddedPerson_TargetPersonRemoved()
        {
            var testObject = new PersonTestableObject();

            testObject.InMemoryCarRepository.Save(testObject.PersonJack);
            testObject.InMemoryCarRepository.Save(testObject.PersonRobert);

            testObject.InMemoryCarRepository.Delete(testObject.PersonJack.Id);

            Assert.IsNull(testObject.InMemoryCarRepository.FindById(testObject.PersonJack.Id));
            Assert.AreEqual(1, testObject.InMemoryCarRepository.All().Count());
        }
예제 #7
0
        public void Find_RepoContainsAddedPerson_AddedPersonReturned()
        {
            var testObject = new PersonTestableObject();

            testObject.InMemoryCarRepository.Save(testObject.PersonJack);
            testObject.InMemoryCarRepository.Save(testObject.PersonRobert);

            var targetElement = testObject.InMemoryCarRepository.FindById(testObject.PersonJack.Id);
            var emptyElement  = testObject.InMemoryCarRepository.FindById(String.Empty);

            Assert.NotNull(targetElement);
            Assert.IsNull(emptyElement);
        }
예제 #8
0
        public void Update_RepoContainsUpdateCar_UpdatedCarReturned()
        {
            var testObject = new PersonTestableObject();

            testObject.InMemoryCarRepository.Save(testObject.PersonJack);
            testObject.InMemoryCarRepository.Save(testObject.PersonRobert);

            var targetElement   = testObject.InMemoryCarRepository.FindById(testObject.PersonJack.Id);
            var NameOfNewPerson = "Ben";

            targetElement.FirstName = NameOfNewPerson;
            testObject.InMemoryCarRepository.Save(targetElement);

            Assert.AreEqual(NameOfNewPerson, testObject.InMemoryCarRepository.FindById(testObject.PersonJack.Id).FirstName);
        }
예제 #9
0
        public void PerformAddOperation()
        {
            var testObject = new PersonTestableObject();

            testObject.InMemoryCarRepository.Save(testObject.PersonJack);
        }