public void CheckParsingOfLocaleDefautScope() { var model = new TagModel(this); var tag = new SetLocale(); tag.Value = new MockAttribute(new Constant("nl-NL")); Assert.That(tag.Evaluate(model), Is.EqualTo(String.Empty)); Assert.That(model.Page[FormatConstants.LOCALE], Is.EqualTo(new CultureInfo("nl-NL"))); }
public void CheckParsingOfLocale() { var model = new TagModel(new Hashtable()); var tag = new SetLocale(); Assert.That(model[FormatConstants.LOCALE], Is.EqualTo(Thread.CurrentThread.CurrentCulture)); tag.Value = new MockAttribute(new Constant("nl-NL")); Assert.That(tag.Evaluate(model), Is.EqualTo(String.Empty)); Assert.That(model[FormatConstants.LOCALE], Is.EqualTo(new CultureInfo("nl-NL"))); }
public void CheckStoringOfLocaleInDifferentScope() { var model = new Hashtable(); var tagModel = new TagModel(model); var tag = new SetLocale(); tag.Value = new MockAttribute(new Constant("nl-NL")); tag.Scope = new MockAttribute(new Constant("Model")); Assert.That(tag.Evaluate(tagModel), Is.EqualTo(String.Empty)); Assert.That(tagModel[FormatConstants.LOCALE], Is.EqualTo(new CultureInfo("nl-NL"))); Assert.That(tagModel.Page[FormatConstants.LOCALE], Is.Null); Assert.That(tagModel.Model[FormatConstants.LOCALE], Is.EqualTo(new CultureInfo("nl-NL"))); }
public void CheckParsingOfWrongCulture() { var model = new TagModel(this); var tag = new SetLocale(); tag.Value = new MockAttribute(new Constant("wrong")); try { tag.Evaluate(model); Assert.Fail("Expected exception"); } catch (ArgumentException Ae) { Assert.That(Ae.Message.Contains("wrong"), Is.True); } }
public void CheckRequired() { var tag = new SetLocale(); try { RequiredAttribute.Check(tag); Assert.Fail("Expected Exception"); } catch (TagException Te) { Assert.That(Te.Message, Is.EqualTo(TagException.MissingRequiredAttribute(typeof(SetLocale), "Value").Message)); } tag.Value = new MockAttribute(new Constant("a")); RequiredAttribute.Check(tag); }