public void the_new_provider_is_used_after_assignment() { var provider = Substitute.For <IMappingProvider>(); var expected = Substitute.For <ICrudEntityMapper <string> >(); provider.Get <string>().Returns(expected); EntityMappingProvider.Provider = provider; var actual = EntityMappingProvider.GetMapper <string>(); actual.Should().Be(expected); }
/// <summary> /// Paging of a command /// </summary> /// <typeparam name="TEntity">Database entity</typeparam> /// <param name="cmd">Command to apply paging to</param> /// <param name="pageNumber">One based index.</param> /// <param name="itemsPerPage">Number of items in each page.</param> public static void Paging <TEntity>(this IDbCommand cmd, int pageNumber, int itemsPerPage) { if (cmd == null) { throw new ArgumentNullException("cmd"); } if (pageNumber <= 0) { throw new ArgumentOutOfRangeException("pageNumber"); } if (itemsPerPage <= 0) { throw new ArgumentOutOfRangeException("itemsPerPage"); } var mapper = EntityMappingProvider.GetMapper <TEntity>(); var db = new SqliteCommandBuilder(mapper); db.Paging(cmd, pageNumber, itemsPerPage); }