public void Create_Should_Check_Access_To_Referred_BranchOffice() { // Given _branchOfficeRepository.SetupRepositoryWithEntity(_branch); // When var newDep = new Department { Name = "Operations department", BranchOfficeId = _branch.Id }; _serviceUnderTest.AddAsync(newDep).Wait(); // Then _branchOfficeRepository.Received().GetAsync(newDep.BranchOfficeId); _deptRepo.Received().Add(newDep); _deptRepo.Received().SaveChangesAsync(); }