public void TestGetCssMarkRemovalScript() { string cssSelector = Some.String(); string markerClass = Some.String(); var sut = new ScriptLoader(); var result = sut.GetCssMarkRemovalScript(cssSelector, markerClass); Assert.IsTrue(result.Length > 10); }
public void TestInitialize_createsAClassConstraint() { string markerClass = Some.String(); var sut = new CssSelectorConstraint(null, null); sut.Initialize(null, markerClass); AttributeConstraint constraint = sut.ActualConstraint as AttributeConstraint; Assert.That(constraint.AttributeName.Equals("class")); }
public void TestEnterMatch_ensuresJQueryIsAvailable() { string jQueryInstallScript = Some.String(); Mock <IScriptLoader> scriptLoader = new Mock <IScriptLoader>(); Mock <WatiN.Core.DomContainer> domContainer = new Mock <DomContainer>(); scriptLoader.Setup(s => s.GetJQueryInstallScript()).Returns(jQueryInstallScript); domContainer.Setup(s => s.Eval(jQueryInstallScript)).Verifiable(); var sut = new CssSelectorConstraint(scriptLoader.Object, domContainer.Object); sut.EnterMatch(); domContainer.Verify(); }
public void TestEnterMatch_usesCssSelectorToAddCssClass() { string cssSelector = Some.String(); string markerClass = Some.String(); string markingScript = Some.String(); Mock <IScriptLoader> scriptLoader = new Mock <IScriptLoader>(); Mock <WatiN.Core.DomContainer> domContainer = new Mock <DomContainer>(); scriptLoader.Setup(s => s.GetCssMarkingScript(cssSelector, markerClass)).Returns(markingScript); domContainer.Setup(d => d.Eval(markingScript)).Verifiable(); var sut = new CssSelectorConstraint(scriptLoader.Object, domContainer.Object); sut.Initialize(cssSelector, markerClass); sut.EnterMatch(); domContainer.Verify(); }
public void TestWriteDescriptionTo() { string cssSelector = Some.String(); string markerClass = Some.String(); Mock <System.IO.TextWriter> textWriter = new Mock <TextWriter>(); textWriter.Setup(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); sut.Initialize(cssSelector, markerClass); sut.WriteDescriptionTo(textWriter.Object); textWriter.Verify(); }