public async Task Exclude_DeleteReferenseTeacher() { // Arrange var groupId = new Guid(GroupId); GroupEntity testEntity = null; var teacher = new EmployeeEntity { Id = new Guid(TeacherId) }; teacher.Groups.Add(groupId); var mockEmployee = new Mock <IEmployeeService>(); var mockStudent = new Mock <IStudentService>(); var mockRepo = new Mock <IGroupRepository>(); mockRepo.Setup(repo => repo.GetByIdAsync(groupId)).Returns(Task.FromResult(GetGroups().First())); mockRepo.Setup(repo => repo.UpdateAsync(groupId, It.IsAny <GroupEntity>())) .Callback((Guid id, GroupEntity entity) => { testEntity = entity; }); var mockUnitOfWork = new Mock <IUnitOfWork>(); mockUnitOfWork.Setup(uow => uow.Groups).Returns(mockRepo.Object); var provider = new GroupProvider(mockUnitOfWork.Object, mockStudent.Object, mockEmployee.Object, CreateMapper()); // Act await provider.Exclude(g => g.DeleteReferenseTeacher(), teacher); // Assert Assert.Equal(default, testEntity.TeacherId);