Exemplo n.º 1
0
 public static T FindInContext <T>(Guid id) where T : class
 {
     using (var context = new ConferenceRegistrationDbContext(ConferenceRegistrationDbContext.SchemaName))
     {
         return(context.Find <T>(id));
     }
 }
        public void when_conference_updated_then_conference_dto_populated()
        {
            var startDate = new DateTimeOffset(2012, 04, 20, 15, 0, 0, TimeSpan.FromHours(-8));

            sut.Handle(new ConferenceUpdated {
                Name        = "newname",
                Description = "newdescription",
                Slug        = "newtest",
                Owner       = new Owner {
                    Name  = "owner",
                    Email = "*****@*****.**"
                },
                SourceId  = conferenceId,
                StartDate = startDate.UtcDateTime,
                EndDate   = DateTime.UtcNow.Date
            });

            using (var context = new ConferenceRegistrationDbContext(dbName)) {
                var dto = context.Find <Registration.ReadModel.Conference>(conferenceId);

                Assert.NotNull(dto);
                Assert.Equal("newname", dto.Name);
                Assert.Equal("newdescription", dto.Description);
                Assert.Equal("newtest", dto.Code);
                Assert.Equal(startDate, dto.StartDate);
            }
        }
Exemplo n.º 3
0
        public void When_conference_created_then_conference_dto_populated()
        {
            var conferenceId = Guid.NewGuid();

            this._sut.Handle(new ConferenceCreated {
                Name        = "name",
                Description = "description",
                Slug        = "test",
                Owner       = new Owner {
                    Name  = "owner",
                    Email = "*****@*****.**",
                },
                SourceId  = conferenceId,
                StartDate = DateTime.UtcNow.Date,
                EndDate   = DateTime.UtcNow.Date,
            });

            using (var context = new ConferenceRegistrationDbContext(_dbName)) {
                var dto = context.Find <Conference>(conferenceId);

                Assert.NotNull(dto);
                Assert.AreEqual("name", dto.Name);
                Assert.AreEqual("description", dto.Description);
                Assert.AreEqual("test", dto.Code);
            }
        }
        public void when_conference_created_then_conference_dto_populated()
        {
            var conferenceId = Guid.NewGuid();

            this.sut.Handle(new ConferenceCreated
            {
                Name = "name",
                Description = "description",
                Slug = "test",
                Owner = new Owner
                {
                    Name = "owner",
                    Email = "*****@*****.**",
                },
                SourceId = conferenceId,
                StartDate = DateTime.UtcNow.Date,
                EndDate = DateTime.UtcNow.Date,
            });

            using (var context = new ConferenceRegistrationDbContext(dbName))
            {
                var dto = context.Find<Conference>(conferenceId);

                Assert.NotNull(dto);
                Assert.Equal("name", dto.Name);
                Assert.Equal("description", dto.Description);
                Assert.Equal("test", dto.Code);
            }
        }
        public void when_conference_published_then_conference_dto_updated()
        {
            var startDate = new DateTimeOffset(2012, 04, 20, 15, 0, 0, TimeSpan.FromHours(-8));

            sut.Handle(new ConferencePublished {
                SourceId = conferenceId
            });

            using (var context = new ConferenceRegistrationDbContext(dbName)) {
                var dto = context.Find <Registration.ReadModel.Conference>(conferenceId);

                Assert.NotNull(dto);
                Assert.Equal(true, dto.IsPublished);
            }
        }
Exemplo n.º 6
0
        public void When_published_conference_unpublished_then_conference_dto_updated()
        {
            this._sut.Handle(new ConferencePublished {
                SourceId = _conferenceId,
            });
            this._sut.Handle(new ConferenceUnpublished {
                SourceId = _conferenceId,
            });

            using (var context = new ConferenceRegistrationDbContext(_dbName)) {
                var dto = context.Find <Conference>(_conferenceId);

                Assert.NotNull(dto);
                Assert.AreEqual(false, dto.IsPublished);
            }
        }
        public void when_published_conference_unpublished_then_conference_dto_updated()
        {
            var startDate = new DateTimeOffset(2012, 04, 20, 15, 0, 0, TimeSpan.FromHours(-8));
            this.sut.Handle(new ConferencePublished
            {
                SourceId = conferenceId,
            });
            this.sut.Handle(new ConferenceUnpublished
            {
                SourceId = conferenceId,
            });

            using (var context = new ConferenceRegistrationDbContext(dbName))
            {
                var dto = context.Find<Conference>(conferenceId);

                Assert.NotNull(dto);
                Assert.Equal(false, dto.IsPublished);
            }
        }
        public void when_conference_updated_then_conference_dto_populated()
        {
            var startDate = new DateTimeOffset(2012, 04, 20, 15, 0, 0, TimeSpan.FromHours(-8));
            this.sut.Handle(new ConferenceUpdated
            {
                Name = "newname",
                Description = "newdescription",
                Slug = "newtest",
                Owner = new Owner
                {
                    Name = "owner",
                    Email = "*****@*****.**",
                },
                SourceId = conferenceId,
                StartDate = startDate.UtcDateTime,
                EndDate = DateTime.UtcNow.Date,
            });

            using (var context = new ConferenceRegistrationDbContext(dbName))
            {
                var dto = context.Find<Conference>(conferenceId);

                Assert.NotNull(dto);
                Assert.Equal("newname", dto.Name);
                Assert.Equal("newdescription", dto.Description);
                Assert.Equal("newtest", dto.Code);
                Assert.Equal(startDate, dto.StartDate);
            }
        }