sdk/dotnet/test/Datasync.Common.Test/BaseTest.cs
/// <summary>
/// Creates a paging response for a list of movies, with an updatedAt set.
/// </summary>
/// <param name="count">Count of items</param>
/// <param name="lastUpdatedAt">The last updated at to use.</param>
/// <param name="nDeleted">Number of deleted items</param>
/// <param name="noUpdatedAt">Don't include the updatedAt field.</param>
/// <returns></returns>
Creates a paging response for a list of movies, with an updatedAt set.
Creates a paging response for a list of movies with an updatedAt set .
protected List<JObject> CreatePageOfMovies(int count, DateTimeOffset lastUpdatedAt, int nDeleted = 0)
        {
            List<EFMovie> movies = TestData.Movies.OfType<EFMovie>().Take(count).ToList();
            for (int i = 0; i < count; i++)
            {
                int offset = count - i - 1; 
                movies[i].UpdatedAt = lastUpdatedAt.AddDays(-offset);
            }
            while (nDeleted > 0)
            {
                movies[nDeleted--].Deleted = true;
            }
            var page = new Page<EFMovie> { Items = movies };
            MockHandler.AddResponse(HttpStatusCode.OK, page);
            return movies.ConvertAll(m => (JObject)GetMockClient().Serializer.Serialize(m));
        }
protected List < JObject > CreatePageOfMovies ( int count , DateTimeOffset lastUpdatedAt , int nDeleted = 0 ) { List < EFMovie > movies = TestData . Movies . OfType < EFMovie > ( ) . Take ( count ) . ToList ( ) ; for ( int i = 0 ; i < count ; i ++ ) { int offset = count - i - 1 ; movies [ i ] . UpdatedAt = lastUpdatedAt . AddDays ( - offset ) ; } while ( nDeleted > 0 ) { movies [ nDeleted -- ] . Deleted = true ; } var page = new Page < EFMovie > { Items = movies } ; MockHandler . AddResponse ( HttpStatusCode . OK , page ) ; return movies . ConvertAll ( m => ( JObject ) GetMockClient ( ) . Serializer . Serialize ( m ) ) ; }
Creates a paging response for a list of movies, with an updatedAt set.
Creates a paging response for a list of movies with an updatedAt set .
// Number of days offset.
None
count
int
Count of items
Count of items
lastUpdatedAt
DateTimeOffset
The last updated at to use.
The last updated at to use .
nDeleted
int
Number of deleted items
Number of deleted items
noUpdatedAt
Don't include the updatedAt field.
Don ' t include the updatedAt field .