public async Task Remove_watchers_by_costId() { // Arrange var costId = Guid.NewGuid(); var cost = new Cost { Id = costId, CostNumber = "Test101" }; var firstUserId = Guid.NewGuid(); var secondUserId = Guid.NewGuid(); var notificationSubscribers = new List <NotificationSubscriber> { new NotificationSubscriber { Id = Guid.NewGuid(), CostId = costId, CostUserId = firstUserId, CostUser = new CostUser { Id = firstUserId, FirstName = "Clark", LastName = "Kent", UserBusinessRoles = new List <UserBusinessRole> { new UserBusinessRole { BusinessRole = new BusinessRole { Value = "Super Man" } } } } }, new NotificationSubscriber { Id = Guid.NewGuid(), CostId = costId, CostUserId = secondUserId, CostUser = new CostUser { Id = secondUserId, FirstName = "Bruce", LastName = "Wayne", UserBusinessRoles = new List <UserBusinessRole> { new UserBusinessRole { BusinessRole = new BusinessRole { Value = "Bat Man" } } } } } }; EFContext.Cost.Add(cost); EFContext.NotificationSubscriber.AddRange(notificationSubscribers); await EFContext.SaveChangesAsync(); Mapper.Setup(m => m.Map <List <CostWatcherModel> >(It.IsAny <List <NotificationSubscriber> >())).Returns(new List <CostWatcherModel> { new CostWatcherModel { BusinessRoles = new List <BusinessRoleModel> { new BusinessRoleModel { Value = "Bat Man" } }, CostId = costId, FullName = "Bruce Wayne", UserId = secondUserId, Owner = false } }); // Act var watchers = await CostService.RemoveCostWatchers(costId, new List <Guid> { firstUserId }, User); // Assert watchers.Count.Should().Be(1); watchers.First().CostId.Should().Be(costId); watchers.First().UserId.Should().Be(secondUserId); EFContext.NotificationSubscriber.First().CostId.Should().Be(costId); EFContext.NotificationSubscriber.First().CostUserId.Should().Be(secondUserId); }