public async Task ReplaceAsync_ThrowsOnNull()
        {
            var dbcontext  = InMemoryContext.GetDbContext();
            var repository = new EntityTableRepository <Movie>(dbcontext);

            await repository.ReplaceAsync(null);

            Assert.Fail("ArgumentNullException expected");
        }
        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 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);
        }