Ejemplo n.º 1
0
        public async Task When_Executing_command_events_should_be_projected()
        {
            var autoTestDb = ConnectionStrings.AutoTestDb;

            var dbOptions = new DbContextOptionsBuilder <BalloonContext>().UseSqlServer(autoTestDb).Options;

            //warm up EF
            using (var context = new BalloonContext(dbOptions))
            {
                context.BalloonCatalog.Add(new BalloonCatalogItem()
                {
                    BalloonId = Guid.NewGuid().ToString(), LastChanged = DateTime.UtcNow, Title = "WarmUp"
                });
                await context.SaveChangesAsync();
            }

            await TestDbTools.Truncate(autoTestDb, "BalloonCatalog");

            var cmd = new InflateNewBallonCommand(123, Guid.NewGuid().ToString());
            await Node.Prepare(cmd)
            .Expect <BalloonCreatedNotification>()
            .Execute(TimeSpan.FromSeconds(30));

            using (var context = new BalloonContext(dbOptions))
            {
                var catalogItem = await context.BalloonCatalog.FindAsync(cmd.AggregateId);

                Assert.Equal(cmd.Title.ToString(), catalogItem.Title);
            }
        }
        public static async Task ClearDomainData(ISqlNodeDbConfiguration nodeConf)
        {
            await TestDbTools.Truncate(nodeConf.SnapshotConnectionString.Replace("\\\\", "\\"), nodeConf.SnapshotTableName);

            await TestDbTools.Truncate(nodeConf.JournalConnectionString.Replace("\\\\", "\\"),
                                       nodeConf.JournalTableName,
                                       nodeConf.MetadataTableName);
        }
        public override void Setup(BenchmarkContext context)
        {
            base.Setup(context);
            //warm up EF
            using (var ctx = new BalloonContext(DbContextOptions))
            {
                ctx.BalloonCatalog.Add(new BalloonCatalogItem()
                {
                    BalloonId = Guid.NewGuid().ToString(), LastChanged = DateTime.UtcNow, Title = "WarmUp"
                });
                ctx.SaveChanges();
            }

            TestDbTools.Truncate(ReadDbReadModelConnectionString, "BalloonCatalog")
            .Wait();
        }
Ejemplo n.º 4
0
        public virtual void Init(IActorRef notifyActor)
        {
            var autoTestGridDomainConfiguration = new AutoTestLocalDbConfiguration();

            TestDbTools.ClearData(autoTestGridDomainConfiguration);

            var system    = CreateSystem(AkkaConfig);
            var container = new UnityContainer();

            system.AddDependencyResolver(new UnityDependencyResolver(container, system));

            InitContainer(container, notifyActor);
            var routingActor = CreateRoutingActor(system);

            Router = new ActorMessagesRouter(routingActor);
        }
 public static async Task ClearQuartzData(string connectionString)
 {
     await TestDbTools.Delete(connectionString,
                              "QRTZ_FIRED_TRIGGERS",
                              "QRTZ_SIMPLE_TRIGGERS",
                              "QRTZ_SIMPROP_TRIGGERS",
                              "QRTZ_CRON_TRIGGERS",
                              "QRTZ_BLOB_TRIGGERS",
                              "QRTZ_TRIGGERS",
                              "QRTZ_JOB_DETAILS",
                              "QRTZ_CALENDARS",
                              "QRTZ_PAUSED_TRIGGER_GRPS",
                              "QRTZ_LOCKS",
                              "QRTZ_SCHEDULER_STATE",
                              "QRTZ_JOB_LISTENERS",
                              "QRTZ_TRIGGER_LISTENERS");
 }