Пример #1
0
 public TestRunner(
     EnvelopeFactory envelopeFactory,
     ILogger <TestRunner> logger,
     ConnectedProjection <TestDbContext> projection) :
     base(
         Name,
         envelopeFactory,
         logger,
         projection)
 {
 }
 public LastChangedListRunner(
     string name,
     ConnectedProjection <LastChangedListContext> projections,
     EnvelopeFactory envelopeFactory,
     ILogger logger)
     : base(name,
            envelopeFactory,
            logger,
            projections.Handlers)
 {
 }
Пример #3
0
        private Func <TestMessage, Task <AppendResult> > CreateMessageStorerAndStartHandling(ConnectedProjection <TestDbContext> projection)
        {
            var eventMapping =
                new EventMapping(EventMapping.DiscoverEventNamesInAssembly(typeof(RunnerTests).Assembly));
            var testRunner =
                new TestRunner(
                    new EnvelopeFactory(
                        eventMapping,
                        new EventDeserializer(JsonConvert.DeserializeObject)),
                    new Logger <TestRunner>(new LoggerFactory()),
                    projection);

            var options = new DbContextOptionsBuilder <TestDbContext>()
                          .UseInMemoryDatabase("testing")
                          .Options;

            using (var testDbContext = new TestDbContext(options))
            {
                testDbContext.Database.EnsureDeleted();
            }

            var inMemoryStreamStore = new InMemoryStreamStore(() => DateTime.UtcNow);

            testRunner.Handle(
                inMemoryStreamStore,
                () => new Owned <TestDbContext>(new TestDbContext(options), this));

            return(async message => await inMemoryStreamStore.AppendToStream(new StreamId("Bla"), ExpectedVersion.Any,
                                                                             new NewStreamMessage(Guid.NewGuid(), eventMapping.GetEventName(typeof(TestMessage)), JsonConvert.SerializeObject(message))));
        }
 public static ConnectedProjectionScenario <BackofficeContext> Scenario(this ConnectedProjection <BackofficeContext> projection) =>
 new ConnectedProjectionScenario <BackofficeContext>(Resolve.WhenEqualToHandlerMessageType(projection.Handlers));
 public void SetUp()
 {
     _sut = new WithoutHandlers();
 }
 public void SetUp()
 {
     _sut = new Any();
 }