public async Task TestRemoveEmployeeAsync_NotHasInFavorites() { var target = new UserFavoriteAppService(statefulServiceContext, stateManager); var userId = Guid.NewGuid(); var result = await target.RemoveEmployeeAsync(userId, Guid.NewGuid()); Assert.AreEqual(true, result); }
public async Task TestRemoveEmployeeAsync_Correct() { var target = new UserFavoriteAppService(statefulServiceContext, stateManager); var userId = Guid.NewGuid(); var empId = Guid.NewGuid(); await target.AddEmployeeAsync(userId, empId); var beforRemoveResult = await target.GetEmployeesAsync(userId); await target.RemoveEmployeeAsync(userId, empId); var afterRemoveResult = await target.GetEmployeesAsync(userId); Assert.AreEqual(true, beforRemoveResult.Any()); Assert.AreEqual(true, !afterRemoveResult.Any()); }
public async Task TestRemoveEmployeeAsync_Batch() { var target = new UserFavoriteAppService(statefulServiceContext, stateManager); var userId = Guid.NewGuid(); var empIds = new Guid[] { Guid.NewGuid(), Guid.NewGuid() }; var results = new List <bool>(); foreach (var empId in empIds) { results.Add(await target.AddEmployeeAsync(userId, empId)); } var beforRemoveResult = await target.GetEmployeesAsync(userId); foreach (var empId in empIds) { await target.RemoveEmployeeAsync(userId, empId); } var afterRemoveResult = await target.GetEmployeesAsync(userId); Assert.AreEqual(true, beforRemoveResult.Any()); Assert.AreEqual(true, !afterRemoveResult.Any()); }