public void ShouldReturnNullIfNoGeneratorSet() { // arrange NavBarWidget widget = new NavBarWidget(null); // act IEnumerable<Hyperlink> links = widget.GenerateHyperlinks(); // assert Assert.AreEqual(null, links); }
public void ShouldInvokeCreateMethod() { // arrange Mock<IHyperlinkGenerator> generator = new Mock<IHyperlinkGenerator>(); generator.Setup(x => x.Create(It.IsAny<IHyperlinkGeneratorArguments>())).Returns<IEnumerable<Hyperlink>>(null); NavBarWidget widget = new NavBarWidget(generator.Object); // act IEnumerable<Hyperlink> links = widget.GenerateHyperlinks(); // assert generator.Verify(x => x.Create(It.IsAny<IHyperlinkGeneratorArguments>())); Assert.AreEqual(null, links); }