public async Task TestPutWord() { using (var context = new bookAPIContext(options)) { string newWord = "Harry"; // this will not test duplicate words because its replacing Word newword1 = context.Word.Where(x => x.Word1 == words[0].Word1).Single(); newword1.Word1 = newWord; // replacing word WordsController wordsController = new WordsController(context); IActionResult result = await wordsController.PutWord(newword1.WordId, newword1) as IActionResult; // making new controller object to test Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(NoContentResult)); // Put returns no content } }