public void ShouldThrowGivenInvalidChain() { //Arrange ChainValidation subject = new ChainValidation(); subject.Add <LinkA>().Add <LinkA>(); //Act Action action = () => subject.AssertExpectedChain(new LinkHead()); //Assert action.Should().Throw <Exception>().WithMessage("Expected [name=_nextAction] to be of [type=LinkA] but found [type=LinkB]"); }
public void ShouldAcceptCustomNames() { //Arrange ChainValidation subject = new ChainValidation(); subject.Add <LinkC>().Add <LinkA>("_someOtherName"); //Act Action action = () => subject.AssertExpectedChain(new LinkCustom()); //Assert action.Should().Throw <Exception>().WithMessage("Expected [name=_someOtherName] to be of [type=LinkA] but found [type=LinkB]"); }
public void ShouldNotThrowGivenValidChain() { //Arrange ChainValidation subject = new ChainValidation(); subject.Add <LinkA>().Add <LinkB>(); //Act Action action = () => subject.AssertExpectedChain(new LinkHead()); //Assert action.Should().NotThrow(); }