Example #1
0
        public void Update_FromSeeded_DoesNotThrow()
        {
            //Arrange
            var person = PersonMapper.MapToDetailModel(Seed.RandalKleiser);

            person.FirstName = "Changed first name";
            //Act & Assert
            person = _personRepositorySUT.InsertOrUpdate(person);
        }
Example #2
0
        public void GetById_SeededPerson()
        {
            var person2 = _personRepositorySUT.GetById(Seed.JohnTravolta.Id);
            var person  = PersonMapper.MapToDetailModel(Seed.JohnTravolta);

            Assert.Equal(person, person2, PersonDetailModel.PersonDetailModelComparer);
            Assert.Equal(person.ActedInFilms, person2.ActedInFilms,
                         ActedInFilmDetailModel.ActedInFilmDetailModelComparer);
            Assert.Equal(person.DirectedFilms, person2.DirectedFilms,
                         DirectedFilmDetailModel.DirectedFilmDetailModelComparer);
        }
Example #3
0
        public void Update_Name_FromSeeded_CheckUpdated()
        {
            //Arrange
            var person = PersonMapper.MapToDetailModel(Seed.RandalKleiser);

            person.FirstName = "Changed first name to joe";
            //Act & Assert
            person = _personRepositorySUT.InsertOrUpdate(person);
            var person2 = _personRepositorySUT.GetById(person.Id);

            Assert.Equal(person, person2, PersonDetailModel.PersonDetailModelComparer);
        }
Example #4
0
        public void Update_RemovePerson_fromSeeded_CheckUpdated()
        {
            //Arrange
            var person = PersonMapper.MapToDetailModel(Seed.JohnTravolta);

            person.ActedInFilms.Clear();
            //Act
            person = _personRepositorySUT.InsertOrUpdate(person);
            //Assert
            var person2 = _personRepositorySUT.GetById(person.Id);

            Assert.Equal(person, person2, PersonDetailModel.PersonDetailModelComparer);
            Assert.Equal(person.ActedInFilms, person2.ActedInFilms,
                         ActedInFilmDetailModel.ActedInFilmDetailModelComparer);
            Assert.Equal(person.DirectedFilms, person2.DirectedFilms,
                         DirectedFilmDetailModel.DirectedFilmDetailModelComparer);
        }