public MovieWithPageSizeController(MovieDbContext context) : base() { Repository = new EntityTableRepository <EFMovie>(context); Options = new TableControllerOptions { PageSize = 25 }; }
public SUnitsController(E2EDbContext context) { TableControllerOptions = new TableControllerOptions <SUnit> { SoftDeleteEnabled = true }; TableRepository = new EntityTableRepository <SUnit>(context); }
public RMoviesController(E2EDbContext context) { TableControllerOptions = new TableControllerOptions <RMovie> { SoftDeleteEnabled = true }; TableRepository = new EntityTableRepository <RMovie>(context); }
public SoftController(MovieDbContext context) : base() { Repository = new EntityTableRepository <EFMovie>(context); Options = new TableControllerOptions { EnableSoftDelete = true }; }
public LegalMoviesController(MovieDbContext context) : base() { Repository = new EntityTableRepository <EFMovie>(context); AccessControlProvider = this; Options = new TableControllerOptions { UnauthorizedStatusCode = StatusCodes.Status451UnavailableForLegalReasons }; }
public MoviesController(TableServiceContext dbContext) { TableControllerOptions = new TableControllerOptions <Movie>() { MaxTop = 1000 }; TableRepository = new EntityTableRepository <Movie>(dbContext); }
public void AsQueryable_CanCountItems() { var dbcontext = InMemoryContext.GetDbContext(); var repository = new EntityTableRepository <Movie>(dbcontext); var actual = repository.AsQueryable().Count(); Assert.AreEqual(TestData.Movies.Length, actual); }
public async Task DeleteAsync_ThrowsOnNullId() { var dbcontext = InMemoryContext.GetDbContext(); var repository = new EntityTableRepository <Movie>(dbcontext); await repository.DeleteAsync(null); Assert.Fail("ArgumentNullException expected"); }
public SoftLoggedController(MovieDbContext context, ILogger <EFMovie> logger) : base() { Repository = new EntityTableRepository <EFMovie>(context); Options = new TableControllerOptions { EnableSoftDelete = true }; Logger = logger; }
public async Task ReplaceAsync_ThrowsOnMissingEntity() { var dbcontext = InMemoryContext.GetDbContext(); var repository = new EntityTableRepository <Movie>(dbcontext); var item = new Movie(); await repository.ReplaceAsync(item); Assert.Fail("EntityDoesNotExistException expected"); }
public async Task CreateAsync_Duplicate_Throws() { var dbcontext = InMemoryContext.GetDbContext(); var repository = new EntityTableRepository <Movie>(dbcontext); var testItem = RandomMovie(); var actual = await repository.CreateAsync(testItem); Assert.Fail("EntityExistsException expected"); }
public async Task LookupAsync_ReturnsNullOnMissingData() { var dbcontext = InMemoryContext.GetDbContext(); var repository = new EntityTableRepository <Movie>(dbcontext); var testId = "random-invalid-id"; var actual = await repository.LookupAsync(testId); Assert.IsNull(actual); }
public async Task DeleteAsync_ThrowsOnMissingData() { var dbcontext = InMemoryContext.GetDbContext(); var repository = new EntityTableRepository <Movie>(dbcontext); var testId = "random-invalid-id"; await repository.DeleteAsync(testId); Assert.Fail("EntityDoesNotExistException expected"); }
public async Task LookupAsync_ReturnsValidData() { var dbcontext = InMemoryContext.GetDbContext(); var repository = new EntityTableRepository <Movie>(dbcontext); var testItem = RandomMovie(); var actual = await repository.LookupAsync(testItem.Id); Assert.IsNotNull(actual); Assert.AreEqual(testItem.Title, actual.Title); }
public async Task DeleteAsync_DeletesValidData() { var dbcontext = InMemoryContext.GetDbContext(); var repository = new EntityTableRepository <Movie>(dbcontext); var testItem = RandomMovie(); await repository.DeleteAsync(testItem.Id); var actual = repository.AsQueryable().Count(); Assert.AreEqual(TestData.Movies.Length - 1, actual); }
public async Task ReplaceAsync_ThrowsOnNullId() { var dbcontext = InMemoryContext.GetDbContext(); var repository = new EntityTableRepository <Movie>(dbcontext); var item = new Movie() { Id = null }; await repository.ReplaceAsync(item); Assert.Fail("ArgumentNullException expected"); }
public async Task ReplaceAsync_ReplacesExistingItem() { var dbcontext = InMemoryContext.GetDbContext(); var repository = new EntityTableRepository <Movie>(dbcontext); var original = RandomMovie(); original.Title = "Test Data"; var actual = await repository.ReplaceAsync(original); Assert.IsNotNull(actual); Assert.AreEqual(original.Id, actual.Id); Assert.IsTrue(DateTimeOffset.UtcNow.Subtract(actual.UpdatedAt).TotalMilliseconds < 500); CollectionAssert.AreEqual(original.Version, actual.Version); Assert.AreEqual("Test Data", actual.Title); Assert.AreEqual(original.ReleaseDate, actual.ReleaseDate); }
public async Task CreateAsync_CreatesNewItem() { var dbcontext = InMemoryContext.GetDbContext(); var dataset = dbcontext.Set <Movie>(); var repository = new EntityTableRepository <Movie>(dbcontext); var newItem = new Movie() { Title = "Test Item" }; var actual = await repository.CreateAsync(newItem); Assert.IsNotNull(actual); Assert.AreEqual(32, actual.Id.Length); Assert.AreEqual(1, dataset.Count(m => m.Id == actual.Id)); Assert.IsTrue(DateTimeOffset.UtcNow.Subtract(actual.UpdatedAt).TotalMilliseconds < 500); Assert.IsNotNull(actual.Version); Assert.AreEqual("Test Item", actual.Title); }
public BlogCommentsController(E2EDbContext context) { TableRepository = new EntityTableRepository <BlogComment>(context); }
public RRatedMoviesController(MovieDbContext context, ILogger <EFMovie> logger) : base() { Repository = new EntityTableRepository <EFMovie>(context); AccessControlProvider = this; Logger = logger; }
public MovieController(MovieDbContext context, ILogger <EFMovie> logger) : base() { Repository = new EntityTableRepository <EFMovie>(context); Logger = logger; }
public UnauthorizedController(E2EDbContext context) { TableRepository = new EntityTableRepository <Movie>(context); }
public UnitsController(E2EDbContext context) { TableRepository = new EntityTableRepository <Unit>(context); }
public OfflineReadyController(TableServiceContext dbContext) { TableRepository = new EntityTableRepository <OfflineReady>(dbContext); }
public MoviesController(E2EDbContext context) { TableRepository = new EntityTableRepository <Movie>(context); }
public BlogPostsController(TableServiceContext dbContext) { TableRepository = new EntityTableRepository <BlogPost>(dbContext); }