public async Task GetProjectTotals_WhenInputIsValid_ShouldSearchCostsByProjectIdAndUserId() { // Arrange var projectId = Guid.NewGuid(); var userId = Guid.NewGuid(); var userIdentity = new UserIdentity { Id = userId }; _efContext.Project.Add(new Project { Id = projectId, CreatedBy = new CostUser { Agency = new Agency() }, Brand = new Brand(), }); _efContext.CostUser.Add(new CostUser { Id = userId, Agency = new Agency() }); _efContext.SaveChanges(); // Act await _projectDataService.GetProjectTotals(projectId, userIdentity); // Assert _elasticSearchServiceMock.Verify(es => es.SearchCosts(It.Is <CostQuery>(q => q.ProjectId == projectId.ToString()), userId), Times.Once); }