public void TestAcquiringOfImport() { var url = new Import(); string fileUrl = GetUrl("CoreTags/import.txt"); url.Url = new MockAttribute(new Constant(fileUrl)); Assert.That(url.Evaluate(new TagModel(this)), Is.EqualTo("some text")); }
public void TestAcquiringOfImportNotFound() { var url = new Import(); string fileUrl = GetUrl("CoreTags/import_nonexisting.txt"); url.Url = new MockAttribute(new Constant(fileUrl)); try { url.Evaluate(new TagModel(this)); Assert.Fail("Expected exception"); } catch (WebException) { } }
public void CheckUrlRequired() { var tag = new Import(); try { RequiredAttribute.Check(tag); Assert.Fail("Expected exception"); } catch (TagException Te) { Assert.That(Te.Message, Is.EqualTo(TagException.MissingRequiredAttribute(typeof (Import), "Url").Message)); } tag.Url = new MockAttribute(new Constant("www.sharptiles.org")); RequiredAttribute.Check(tag); }
public void TestAcquiringOfParamsImportInVariableInDifferentScope() { var url = new Import(); string fileUrl = GetUrl("CoreTags/import.txt"); url.Url = new MockAttribute(new Constant(fileUrl)); url.Var = new MockAttribute(new Constant("target")); url.Scope = new MockAttribute(new Constant("Session")); var model = new TagModel(this, new MockSessionState()); Assert.That(url.Evaluate(model), Is.EqualTo(String.Empty)); Assert.That(model.Session["target"], Is.EqualTo("some text")); }