コード例 #1
0
ファイル: Program.cs プロジェクト: matlus/MovieServiceYouTube
        static async Task Main(string[] args)
        {
            var domainFacade = new DomainFacade();
            var id           = await domainFacade.CreateMovie(new Movie("dfvbds", "http://www.somedomain.com", (Genre)1, 2021));

            var allMovies = await domainFacade.GetAllMovies();
        }
コード例 #2
0
        public override async Task <CreateMovieResponse> CreateMovie(MovieResource request, ServerCallContext context)
        {
            try
            {
                var id = await _domainFacade.CreateMovie(MapToMovie(request));

                return(new CreateMovieResponse {
                    Id = id
                });
            }
            catch (Exception e)
            {
                throw MapToRcpException(e);
            }
        }
コード例 #3
0
        public async Task CreateMovie_WhenCalledWithAValidMovieNonExistent_Succeed()
        {
            // Arrange
            var(domainFacade, _) = CreateDomainFacade();
            var expectedMovie = RandomMovieGenerator.GenerateRandomMovies(1).Single();

            try
            {
                // Act
                await domainFacade.CreateMovie(expectedMovie);

                // Assert
                var actualMovie = await MovieTestDataGenerator.RetrieveMovie(dbConnectionString, expectedMovie.Title);

                MovieAssertions.AssertMoviesAreEqual(new[] { expectedMovie }, new[] { actualMovie });
            }
            finally
            {
                domainFacade.Dispose();
            }
        }
コード例 #4
0
 protected virtual Task <int> CreateMovie(Movie movie)
 {
     return(_domainFacade.CreateMovie(movie));
 }