コード例 #1
0
 public void CalendarBookingsCanBePublished()
 {
     DateTime start = DateTime.Now;
     DateTime end = start.AddHours(1);
     var cEvent = new CalendarBooking(start, end, _user.Id, _venue);
     Assert.True(cEvent.PublishState == PublishState.Draft);
     Assert.True(cEvent.PublishDate == DateTime.MinValue);
     cEvent.Publish();
     Assert.True(cEvent.PublishState == PublishState.Published);
     Assert.True(cEvent.PublishDate != DateTime.MinValue);
 }
コード例 #2
0
        public void ChangingEventPropertiesChangesPublishStateAndModifiedDate()
        {
            DateTime start = DateTime.Now;
            DateTime end = start.AddHours(1);
            var cEvent = new CalendarBooking(start, end, _user.Id, _venue);
            cEvent.Publish();
            Assert.True(cEvent.PublishState == PublishState.Published);
            var lastModifiedDate = cEvent.LastModified;

            var venue = new Venue();
            cEvent.Venue = venue;
            Assert.Equal(cEvent.PublishState,PublishState.Draft);
            var updatedLastModifiedDate = cEvent.LastModified;
            //Assert.True(updatedLastModifiedDate > lastModifiedDate);
            cEvent.Publish();
            Assert.True(cEvent.PublishDate >= lastModifiedDate);
            Assert.Equal(cEvent.PublishState, PublishState.Published);

            cEvent.Venue = venue;
            Assert.Equal(cEvent.PublishState,PublishState.Published);
            Assert.Equal(cEvent.LastModified, updatedLastModifiedDate);
        }
コード例 #3
0
        public void PublishingRaisesPublishEvent()
        {
            var start = DateTime.Now;
            var end = start.AddHours(1);
            var cEvent = new CalendarBooking(start, end, _user.Id, _venue);

            CalendarBooking publishedBooking = null;
            DomainEvents.Register<BookingPublishedEvent>(p => publishedBooking = p.PublishedBooking);
            cEvent.Publish();

            Assert.Equal(publishedBooking,cEvent);
        }