Пример #1
0
        public void SaveMovie()
        {
            //Arrange
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(Directory.GetCurrentDirectory())
                                .AddJsonFile("appsettings.json").Build();

            var options = new DbContextOptionsBuilder <MovieContext>()
                          .UseCosmos(configuration["CosmosDBSetting:DbUri"], configuration["CosmosDBSetting:PrimaryKey"], "MovieDB")
                          .Options;


            IMovieProvider movieProvider = new MovieProvider(new MovieRepository(new MovieContext(options)));

            var director = Builder <DirectorDto> .CreateNew().Build();

            var producer = Builder <ProducerDto> .CreateNew().Build();

            var movie = Builder <MovieDto> .CreateNew().Build();

            movie.Director = director;
            movie.Producer = producer;

            //Act
            movieProvider.SaveMovie(movie);

            //Assert
        }