public async Task UniqueNameTest() { var test = CreateTest("testname"); string userName = "******"; ApplicationUser user = new ApplicationUser() { Email = userName, UserName = userName }; await _userManager.CreateAsync(user); var applicationUser = await _userManager.FindByEmailAsync(user.Email); await _testRepository.CreateTestAsync(test, applicationUser.Id); var name = "nameOfTest"; var id = 0; bool isExist = await _testRepository.IsTestNameUniqueAsync(name, id); Assert.True(isExist); }
public async Task <bool> IsTestNameUnique([FromRoute] string testName, [FromRoute] int id) { // verifying the test name is unique or not return(await _testRepository.IsTestNameUniqueAsync(testName, id)); }