public void GetAnagrams_WhenLongWords_DoesLog() { //Arrange IAnagramResolverService resolver = null; TestLogger logger = new TestLogger(); IAnagramResolverMetric metric = null; var objectUnderTest = new AnagramController(resolver, logger, metric); string word = "0123456789AB"; string language = "en"; //Act var actual = objectUnderTest.GetAnagrams(word, language).GetAwaiter().GetResult() as BadRequestObjectResult; //Assert Assert.AreEqual(true, logger.LogCalled); Assert.AreEqual(1, (actual.Value as string[]).Length); }
public void GetAnagrams_DoesLogExceptions_ButItDoesNotThrow() { //Arrange IAnagramResolverService resolver = new TestResolver(); TestLogger logger = new TestLogger(); IAnagramResolverMetric metric = null; var objectUnderTest = new AnagramController(resolver, logger, metric); string word = "ab"; string language = "en"; //Act var actual = objectUnderTest.GetAnagrams(word, language).GetAwaiter().GetResult() as BadRequestObjectResult; //Assert Assert.AreEqual(true, logger.LogCalled); Assert.AreEqual("error", (actual.Value as string[]) [0]); }