public void MustFailWithInvalidData() { var location = Assembly.GetAssembly(typeof(XmlTextResourceTests)).Location; var path = $@"{Path.GetDirectoryName(location)}\Text_Invalid.txt"; var sut = new XmlTextResource(path); sut.LoadText(); }
public void MustFailWithInvalidData() { var location = Assembly.GetAssembly(typeof(XmlTextResourceTests)).Location; var path = $@"{Path.GetDirectoryName(location)}\Text_Invalid.txt"; var stream = new FileStream(path, FileMode.Open, FileAccess.Read); var sut = new XmlTextResource(stream); sut.LoadText(); }
public void MustTrimValues() { var location = Assembly.GetAssembly(typeof(XmlTextResourceTests)).Location; var path = $@"{Path.GetDirectoryName(location)}\Text_Valid.xml"; var sut = new XmlTextResource(path); var text = sut.LoadText(); Assert.IsNotNull(text); Assert.AreEqual("Hello world", text[TextKey.Notification_AboutTooltip]); }
public void MustNeverSetNullValue() { var location = Assembly.GetAssembly(typeof(XmlTextResourceTests)).Location; var path = $@"{Path.GetDirectoryName(location)}\Text_Valid.xml"; var sut = new XmlTextResource(path); var text = sut.LoadText(); Assert.IsNotNull(text); Assert.AreEqual(string.Empty, text[TextKey.Notification_LogTooltip]); }
public void MustNeverReturnNull() { var location = Assembly.GetAssembly(typeof(XmlTextResourceTests)).Location; var path = $@"{Path.GetDirectoryName(location)}\Text_Incompatible.xml"; var sut = new XmlTextResource(path); var text = sut.LoadText(); Assert.IsNotNull(text); Assert.IsTrue(text.Count == 0); }
public void MustCorrectlyLoadData() { var location = Assembly.GetAssembly(typeof(XmlTextResourceTests)).Location; var path = $@"{Path.GetDirectoryName(location)}\Text_Valid.xml"; var sut = new XmlTextResource(path); var text = sut.LoadText(); Assert.IsNotNull(text); Assert.IsTrue(text.Count == 4); Assert.AreEqual("Application Log", text[TextKey.LogWindow_Title]); Assert.AreEqual("Version", text[TextKey.Version]); }