public void Context()
        {
            _country = new CountryBuilder()
                       .WithCountryCode("some country code")
                       .Build();
            UnitOfWork.Save(_country);

            var cinema = new CinemaBuilder().Build();

            UnitOfWork.Save(cinema);

            _film = new FilmBuilder()
                    .WithFilmRatings(
                new FilmRatingArgs
            {
                Source = RatingSource.Imdb,
                Rating = 8.2m,
                Url    = "imdb url"
            },
                new FilmRatingArgs
            {
                Source = RatingSource.Csfd,
                Rating = 82m,
                Url    = "csfd url"
            }
                )
                    .Build();
            UnitOfWork.Save(_film);

            _location = new LocationBuilder()
                        .WithCountry(_country)
                        .WithNameOrPostCode("some location name or post code")
                        .WithLocationFilms(new LocationFilmArgs
            {
                Film    = _film,
                Cinemas = new[]
                {
                    new LocationFilmCinemaArgs {
                        Cinema = cinema
                    }
                }
            })
                        .Build();
            UnitOfWork.Save(_location);

            UnitOfWork.Clear();

            var locationFilmId = _location.Films.Single().Id;

            _locationFilmDto = UnitOfWork.Session.QueryOver <LocationFilmDto>()
                               .Where(x => x.Id == locationFilmId)
                               .List().SingleOrDefault();
        }
Esempio n. 2
0
        public void Context()
        {
            var country = new CountryBuilder().Build();

            UnitOfWork.Save(country);

            var cinema = new CinemaBuilder().Build();

            UnitOfWork.Save(cinema);

            _film = new FilmBuilder().Build();
            UnitOfWork.Save(_film);

            var location = new LocationBuilder()
                           .WithCountry(country)
                           .WithLocationFilms(new LocationFilmArgs
            {
                Film    = _film,
                Cinemas = new[]
                {
                    new LocationFilmCinemaArgs {
                        Cinema = cinema
                    }
                }
            })
                           .Build();

            UnitOfWork.Save(location);

            UnitOfWork.Clear();

            var locationFilmId = location.Films.Single().Id;

            _filmRatingDto = UnitOfWork.Session.QueryOver <LocationFilmDto>()
                             .Where(x => x.Id == locationFilmId)
                             .List().Single()
                             .Ratings.SingleOrDefault();
        }