public static async Task Assert(this ProjectionTestSpecification <IAsyncDocumentSession> specification) { if (specification == null) { throw new ArgumentNullException("specification"); } using (var store = new EmbeddableDocumentStore { RunInMemory = true, DataDirectory = Path.GetTempPath() }) { store.Configuration.Storage.Voron.AllowOn32Bits = true; store.Initialize(); using (var session = store.OpenAsyncSession()) { await new Projector <IAsyncDocumentSession>(specification.Resolver). ProjectAsync(session, specification.Messages); await session.SaveChangesAsync(); var result = await specification.Verification(session, CancellationToken.None); if (result.Failed) { throw new AssertionException(result.Message); } } } }
public static async Task Assert(this ProjectionTestSpecification <MemoryCache> specification) { if (specification == null) { throw new ArgumentNullException("specification"); } using (var cache = new MemoryCache(new Random().Next().ToString())) { await new Projector <MemoryCache>(specification.Resolver). ProjectAsync(cache, specification.Messages); var result = await specification.Verification(cache, CancellationToken.None); if (result.Failed) { throw new AssertionException(result.Message); } } }