コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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]);
        }
コード例 #4
0
        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]);
        }
コード例 #5
0
        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);
        }
コード例 #6
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]);
        }