예제 #1
0
        public TestData()
        {
            fixture.Behaviors.Add(new OmitOnRecursionBehavior());

            CreateTestMovies();

            CreateTestRelatedData();

            CreateTestOneToOneData();

            CreateTestManyToManyData();

            CreateFillerData();

            TestMovieSeededWithRelatedInfo.LastUpdatedDetails = DateTime.Now;
            InitialMoviesInDb.Add(TestMovieSeededWithoutRelatedInfo);
            InitialMoviesInDb.Add(TestMovieSeededWithRelatedInfo);
        }
예제 #2
0
        private void CreateFillerData()
        {
            for (int i = 0; i < 3; i++)
            {
                var movie = CreateMovieWithoutRelatedInfo();
                InitialMoviesInDb.Add(movie);

                var similar = new MovieSimilar
                {
                    Movie     = TestMovieSeededWithRelatedInfo,
                    MovieId   = TestMovieSeededWithRelatedInfo.Id,
                    Similar   = movie,
                    SimilarId = movie.Id
                };

                TestMovieSeededWithRelatedInfo.Similars.Add(similar);
            }

            for (int i = 0; i < 3; i++)
            {
                var person = CreatePersonWithoutRelatedInfo();
                PeopleList.Add(person);

                TestMovieSeededWithRelatedInfo.ActorList.Add(new MovieActor
                {
                    Movie    = TestMovieSeededWithRelatedInfo,
                    MovieId  = TestMovieSeededWithRelatedInfo.Id,
                    Person   = person,
                    PersonId = person.Id
                });
            }

            for (int i = 0; i < 3; i++)
            {
                var person = CreatePersonWithoutRelatedInfo();
                PeopleList.Add(person);

                TestMovieSeededWithRelatedInfo.DirectorList.Add(new MovieDirector
                {
                    Movie    = TestMovieSeededWithRelatedInfo,
                    MovieId  = TestMovieSeededWithRelatedInfo.Id,
                    Person   = person,
                    PersonId = person.Id
                });
            }

            for (int i = 0; i < 3; i++)
            {
                var person = CreatePersonWithoutRelatedInfo();
                PeopleList.Add(person);

                TestMovieSeededWithRelatedInfo.WriterList.Add(new MovieWriter
                {
                    Movie    = TestMovieSeededWithRelatedInfo,
                    MovieId  = TestMovieSeededWithRelatedInfo.Id,
                    Person   = person,
                    PersonId = person.Id
                });
            }

            for (int i = 0; i < 3; i++)
            {
                var company = CreateCompanyWithoutRelatedInfo();
                CompanyList.Add(company);

                TestMovieSeededWithRelatedInfo.CompanyList.Add(new MovieCompany
                {
                    Movie     = TestMovieSeededWithRelatedInfo,
                    MovieId   = TestMovieSeededWithRelatedInfo.Id,
                    Company   = company,
                    CompanyId = company.Id
                });
            }

            for (int i = 0; i < 3; i++)
            {
                var rating = fixture.Build <Rating>()
                             .With(x => x.Movie, TestMovieSeededWithRelatedInfo)
                             .With(x => x.MovieId, TestMovieSeededWithRelatedInfo.Id)
                             .Create();

                TestMovieSeededWithRelatedInfo.Ratings.Add(rating);
            }
        }