public async Task UserByUserIdQueryHandlerInvokesGetUserWithTheCorrectUserId() { var options = CreateNewContextOptions(); const string userId = "1"; var message = new UserByUserIdQuery { UserId = userId }; using (var context = new AllReadyContext(options)) { context.Users.Add(new ApplicationUser { Id = userId }); await context.SaveChangesAsync(); } using (var context = new AllReadyContext(options)) { var sut = new UserByUserIdQueryHandler(context); var user = await sut.Handle(message); Assert.Equal(user.Id, userId); } }
public void UserByUserIdQueryHandlerInvokesGetUserWithTheCorrectUserId() { var message = new UserByUserIdQuery { UserId = "1" }; var dataAccess = new Mock<IAllReadyDataAccess>(); var sut = new UserByUserIdQueryHandler(dataAccess.Object); sut.Handle(message); dataAccess.Verify(x => x.GetUser(message.UserId), Times.Once); }
public void UserByUserIdQueryHandlerInvokesGetUserWithTheCorrectUserId() { var message = new UserByUserIdQuery { UserId = "1" }; var dataAccess = new Mock <IAllReadyDataAccess>(); var sut = new UserByUserIdQueryHandler(dataAccess.Object); sut.Handle(message); dataAccess.Verify(x => x.GetUser(message.UserId), Times.Once); }