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(); }
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); } }
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(); } }
protected virtual Task <int> CreateMovie(Movie movie) { return(_domainFacade.CreateMovie(movie)); }