Пример #1
0
        public void PushesChangesSinceLastPushWhenMultipleRemotes()
        {
            Emit(new RemoteCalendarAdded(
                     new FakeRemote
            {
                Id = NewId <RemoteCalendar>()
            }));

            var created1 = new CalendarItemCreated("hash1", new CalendarItem("1234"));

            Emit(created1);

            Emit(new PushedToRemote(Id <RemoteCalendar>(), created1.ChangeId));

            var created2 = new CalendarItemCreated("hash2", new CalendarItem("4321"));

            Emit(created2);

            When(new Push(storeFactory)
            {
                CalendarId = Id <LocalCalendar>(),
                RemoteId   = Id <RemoteCalendar>(2)
            });

            Then(new PushedToRemote(Id <RemoteCalendar>(2), created1.ChangeId));
            Then(new PushedToRemote(Id <RemoteCalendar>(2), created2.ChangeId));
        }
Пример #2
0
 public void Apply(CalendarItemCreated @event)
 {
     service.Events.Insert(new Event
     {
         ICalUID     = @event.Item.Id,
         Summary     = @event.Item.Title,
         Description = @event.Item.Note,
         Location    = @event.Item.Location,
         Start       = ToGoogleEventDateTime(@event.Item.Start, @event.Item.IsAllDay),
         End         = ToGoogleEventDateTime(@event.Item.End, @event.Item.IsAllDay)
     }, calendarId).Execute();
 }
Пример #3
0
        public void PushesChanges()
        {
            var created = new CalendarItemCreated("hash1", new CalendarItem("1234"));
            var changed = new CalendarItemChanged("hash2", "1234", "Title", "Asger");
            var removed = new CalendarItemRemoved("hash3", "1234");

            Emit(Id <LocalCalendar>(), created, changed, removed);

            When(new Push(storeFactory)
            {
                CalendarId = Id <LocalCalendar>(),
                RemoteId   = Id <RemoteCalendar>()
            });

            Then(new PushedToRemote(Id <RemoteCalendar>(), created.ChangeId));
            Then(new PushedToRemote(Id <RemoteCalendar>(), changed.ChangeId));
            Then(new PushedToRemote(Id <RemoteCalendar>(), removed.ChangeId));
        }
Пример #4
0
        public void AppliesChangesToStore()
        {
            var created = new CalendarItemCreated("hash1", new CalendarItem("1234"));
            var changed = new CalendarItemChanged("hash2", "1234", "Title", "Asger");
            var removed = new CalendarItemRemoved("hash3", "1234");

            Emit(Id <LocalCalendar>(), created, changed, removed);

            When(new Push(storeFactory)
            {
                CalendarId = Id <LocalCalendar>(),
                RemoteId   = Id <RemoteCalendar>()
            });

            Then <PushedToRemote>();
            Then <PushedToRemote>();
            Then <PushedToRemote>();

            store.Events[0].ShouldBeOfType <CalendarItemCreated>().Item.Id.ShouldBe("1234");
            store.Events[1].ShouldBeOfType <CalendarItemChanged>().ItemId.ShouldBe("1234");
            store.Events[2].ShouldBeOfType <CalendarItemRemoved>().ItemId.ShouldBe("1234");
        }
Пример #5
0
 public void Apply(CalendarItemCreated @event)
 {
     Events.Add(@event);
 }