public async Task Handle_GivenNullRequest_ShouldThrowArgumentNullException() { // Arrange var sut = new GetNotificationsForPlayerQueryHandler(It.IsAny <IDeletableEntityRepository <Notification> >(), It.IsAny <IMapper>()); // Act & Assert await Should.ThrowAsync <ArgumentNullException>(sut.Handle(null, It.IsAny <CancellationToken>())); }
public async Task Handle_GivenValidRequest_ShouldReturnViewModel() { // Arrange var query = new GetNotificationsForPlayerQuery { UserId = "Foo1" }; var sut = new GetNotificationsForPlayerQueryHandler(this.deletableEntityRepository, this.mapper); this.dbContext.Notifications.Add(new Notification { PlayerId = "Foo1", Content = "TestContent", Header = "TestHeader", Type = Domain.Entities.Enums.NotificationType.Info }); this.dbContext.SaveChanges(); // Act var viewModel = await sut.Handle(query, It.IsAny <CancellationToken>()); // Assert viewModel.ShouldNotBeNull(); viewModel.Notifications.Count().ShouldBe(1); }