// XmlUtilsのテストクラスソース。</summary>
//
// <copyright file="XmlUtilsTest.cs" company="honeplusのメモ帳">
-// Copyright (C) 2011 Honeplus. All rights reserved.</copyright>
+// Copyright (C) 2013 Honeplus. All rights reserved.</copyright>
// <author>
// Honeplus</author>
// ================================================================================================
{
using System;
using System.Xml;
+ using System.Xml.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
/// <summary>
#region null値許容メソッドテストケース
/// <summary>
- /// InnerTextメソッドテストケース。
+ /// <see cref="XmlUtils.InnerText(XmlNode)"/>,
+ /// <see cref="XmlUtils.InnerText(XmlNode, string)"/>
+ /// メソッドテストケース。
/// </summary>
[TestMethod]
public void TestInnerText()
}
/// <summary>
- /// InnerXmlメソッドテストケース。
+ /// <see cref="XmlUtils.InnerXml(XmlNode)"/>,
+ /// <see cref="XmlUtils.InnerXml(XmlNode, string)"/>
+ /// メソッドテストケース。
/// </summary>
[TestMethod]
public void TestInnerXml()
Assert.AreEqual("<test />", XmlUtils.InnerXml(new XmlDocument { InnerXml = "<test />" }));
// 引数二つ
- Assert.IsNull(XmlUtils.InnerText(null, null));
+ Assert.IsNull(XmlUtils.InnerXml(null, null));
Assert.AreEqual("<null />", XmlUtils.InnerXml(null, "<null />"));
Assert.AreEqual("<test />", XmlUtils.InnerXml(new XmlDocument { InnerXml = "<test />" }, "<null />"));
}
/// <summary>
- /// OuterXmlメソッドテストケース。
+ /// <see cref="XmlUtils.OuterXml(XmlNode)"/>,
+ /// <see cref="XmlUtils.OuterXml(XmlNode, string)"/>
+ /// メソッドテストケース。
/// </summary>
[TestMethod]
public void TestOuterXml()
Assert.AreEqual("<test />", XmlUtils.OuterXml(new XmlDocument { InnerXml = "<test />" }));
// 引数二つ
- Assert.IsNull(XmlUtils.InnerText(null, null));
+ Assert.IsNull(XmlUtils.OuterXml(null, null));
Assert.AreEqual("<null />", XmlUtils.OuterXml(null, "<null />"));
Assert.AreEqual("<test />", XmlUtils.OuterXml(new XmlDocument { InnerXml = "<test />" }, "<null />"));
}
+ /// <summary>
+ /// <see cref="XmlUtils.Value(XAttribute)"/>,
+ /// <see cref="XmlUtils.Value(XAttribute, string)"/>
+ /// メソッドテストケース。
+ /// </summary>
+ [TestMethod]
+ public void TestValue()
+ {
+ // 引数一つ
+ Assert.AreEqual(string.Empty, XmlUtils.Value(null));
+ Assert.AreEqual("100", XmlUtils.Value(new XAttribute("id", "100")));
+
+ // 引数二つ
+ Assert.IsNull(XmlUtils.Value(null, null));
+ Assert.AreEqual("abc", XmlUtils.Value(null, "abc"));
+ Assert.AreEqual("100", XmlUtils.Value(new XAttribute("id", "100"), "abc"));
+ }
+
#endregion
#region エンコード/デコードテストケース
/// <summary>
- /// XmlEncodeメソッドテストケース。
+ /// <see cref="XmlUtils.XmlEncode"/>メソッドテストケース。
/// </summary>
[TestMethod]
public void TestXmlEncode()
}
/// <summary>
- /// XmlEncodeメソッドテストケース(null)。
+ /// <see cref="XmlUtils.XmlEncode"/>メソッドテストケース(null)。
/// </summary>
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
}
/// <summary>
- /// XmlDecodeメソッドテストケース。
+ /// <see cref="XmlUtils.XmlDecode"/>メソッドテストケース。
/// </summary>
[TestMethod]
public void TestXmlDecode()
}
/// <summary>
- /// XmlDecodeメソッドテストケース(null)。
+ /// <see cref="XmlUtils.XmlDecode"/>メソッドテストケース(null)。
/// </summary>
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]