示例#1
0
        public void First_ExecuteAsync(bool async)
        {
            try
            {
                var expectedMovie = _movieList.First();
                TestCluster.PrimeFluent(
                    b => b.WhenQuery(
                        "SELECT \"director\", \"list\", \"mainGuy\", \"movie_maker\", \"unique_movie_title\", \"yearMade\" " +
                        $"FROM \"{Movie.TableName}\" WHERE \"unique_movie_title\" = ? AND \"movie_maker\" = ? LIMIT ? ALLOW FILTERING",
                        rows => rows.WithParams(expectedMovie.Title, expectedMovie.MovieMaker, 1))
                    .ThenRowsSuccess(expectedMovie.CreateRowsResult()));

                var actualMovieQuery =
                    _movieTable.First(m => m.Title == expectedMovie.Title && m.MovieMaker == expectedMovie.MovieMaker);

                var actualMovie = async ? actualMovieQuery.ExecuteAsync().Result : actualMovieQuery.Execute();
                Movie.AssertEquals(expectedMovie, actualMovie);
            }
            catch (Exception ex)
            {
                Assert.Fail(
                    string.Join(",", typeof(Movie).GetFields().Select(f => f.Name)
                                .Union(typeof(Movie).GetProperties().Select(p => p.Name))) +
                    ex + Environment.NewLine + JsonConvert.SerializeObject(TestCluster.GetLogs()));
            }
        }