public void TestWriteDescriptionTo_uninitialized() { Mock<System.IO.TextWriter> textWriter = new Mock<TextWriter>(); textWriter.Expect(tw => tw.Write(It.IsAny<string>())).Callback( delegate(string writtenText) { Assert.That(writtenText.Contains("CssSelectorConstraint")); } ).Verifiable(); var sut = new CssSelectorConstraint(null, null); sut.WriteDescriptionTo(textWriter.Object); textWriter.Verify(); }
public void TestWriteDescriptionTo() { string cssSelector = Some.String(); string markerClass = Some.String(); Mock<System.IO.TextWriter> textWriter = new Mock<TextWriter>(); textWriter.Expect(tw => tw.Write(It.IsAny<string>())).Callback( delegate(string writtenText) { Assert.That(writtenText.Contains("CssSelectorConstraint")); Assert.That(writtenText.Contains(cssSelector)); } ).Verifiable(); var sut = new CssSelectorConstraint(null, null, markerClass); sut.Initialize(cssSelector); sut.WriteDescriptionTo(textWriter.Object); textWriter.Verify(); }