public void ReturnsCorrectType()
        {
            var dataAccess = new Mock<IAllReadyDataAccess>();
            dataAccess.Setup(x => x.GetEvent(It.IsAny<int>())).Returns(new Models.Event());
            var sut = new EventByIdQueryHandler(dataAccess.Object);
            var result = sut.Handle(new EventByIdQuery());

            Assert.IsType<Models.Event>(result);
        }
        public void CallsGetEventWithTheCorrectEventId()
        {
            var message = new EventByIdQuery { EventId = 1 };
            var dataAccess = new Mock<IAllReadyDataAccess>();

            var sut = new EventByIdQueryHandler(dataAccess.Object);
            sut.Handle(message);

            dataAccess.Verify(x => x.GetEvent(message.EventId), Times.Once());
        }
Beispiel #3
0
        public void ReturnsCorrectType()
        {
            var dataAccess = new Mock <IAllReadyDataAccess>();

            dataAccess.Setup(x => x.GetEvent(It.IsAny <int>())).Returns(new Models.Event());
            var sut    = new EventByIdQueryHandler(dataAccess.Object);
            var result = sut.Handle(new EventByIdQuery());

            Assert.IsType <Models.Event>(result);
        }
Beispiel #4
0
        public void CallsGetEventWithTheCorrectEventId()
        {
            var message = new EventByIdQuery {
                EventId = 1
            };
            var dataAccess = new Mock <IAllReadyDataAccess>();

            var sut = new EventByIdQueryHandler(dataAccess.Object);

            sut.Handle(message);

            dataAccess.Verify(x => x.GetEvent(message.EventId), Times.Once());
        }
Beispiel #5
0
        public async Task CallsGetEventWithTheCorrectEventId()
        {
            var options = this.CreateNewContextOptions();

            const int eventId = 1;
            var       message = new EventByIdQuery {
                EventId = eventId
            };

            using (var context = new AllReadyContext(options)) {
                context.Events.Add(new Event {
                    Id = eventId
                });
                await context.SaveChangesAsync();
            }

            using (var context = new AllReadyContext(options)) {
                var sut = new EventByIdQueryHandler(context);
                var e   = sut.Handle(message);

                Assert.Equal(e.Id, eventId);
            }
        }