{
using System;
using System.Collections.Generic;
- using NUnit.Framework;
+ using Microsoft.VisualStudio.TestTools.UnitTesting;
/// <summary>
/// <see cref="Validate"/>のテストクラスです。
/// </summary>
- [TestFixture]
+ [TestClass]
internal class ValidateTest
{
#region NotNullメソッドテストケース
/// <summary>
/// <see cref="Validate.NotNull<T>(T, string)"/>メソッドテストケース(正常系)。
/// </summary>
- [Test]
+ [TestMethod]
public void TestNotNull()
{
// パラメータ名指定無し
- Assert.AreEqual(String.Empty, Validate.NotNull(String.Empty));
+ Assert.AreEqual(string.Empty, Validate.NotNull(string.Empty));
Assert.AreEqual("not null", Validate.NotNull("not null"));
// パラメータ名指定有り
- Assert.AreEqual(String.Empty, Validate.NotNull(String.Empty, null));
- Assert.AreEqual(String.Empty, Validate.NotNull(String.Empty, "test"));
+ Assert.AreEqual(string.Empty, Validate.NotNull(string.Empty, null));
+ Assert.AreEqual(string.Empty, Validate.NotNull(string.Empty, "test"));
Assert.AreEqual("not null", Validate.NotNull("not null", "test"));
}
/// <summary>
/// <see cref="Validate.NotNull<T>(T, string)"/>メソッドテストケース(異常系)。
/// </summary>
- [Test]
+ [TestMethod]
public void TestNotNullNg()
{
// obj = nullのチェック
/// <summary>
/// <see cref="Validate.NotEmpty(string, string)"/>メソッドテストケース(正常系)。
/// </summary>
- [Test]
+ [TestMethod]
public void TestNotEmpty()
{
// パラメータ名指定無し
/// <summary>
/// <see cref="Validate.NotEmpty(string, string)"/>メソッドテストケース(異常系)。
/// </summary>
- [Test]
+ [TestMethod]
public void TestNotEmptyNg()
{
// str = nullのチェック
try
{
// パラメータ名指定無し
- Validate.NotEmpty(String.Empty);
+ Validate.NotEmpty(string.Empty);
Assert.Fail("expected ArgumentException");
}
catch (ArgumentException ex)
try
{
// パラメータ名指定有り
- Validate.NotEmpty(String.Empty, "test");
+ Validate.NotEmpty(string.Empty, "test");
Assert.Fail("expected ArgumentException");
}
catch (ArgumentException ex)
/// <summary>
/// <see cref="Validate.NotBlank(string, string)"/>メソッドテストケース(正常系)。
/// </summary>
- [Test]
+ [TestMethod]
public void TestNotBlank()
{
// パラメータ名指定無し
/// <summary>
/// <see cref="Validate.NotBlank(string, string)"/>メソッドテストケース(異常系)。
/// </summary>
- [Test]
+ [TestMethod]
public void TestNotBlankNg()
{
// str = nullのチェック
/// <see cref="Validate.InRange(string, int, string, string)"/>
/// メソッドテストケース(正常系)。
/// </summary>
- [Test]
+ [TestMethod]
public void TestInRangeStr()
{
// ※ 例外が起きなければOK
/// <see cref="Validate.InRange(string, int, string, string)"/>
/// メソッドテストケース(異常系)。
/// </summary>
- [Test]
+ [TestMethod]
public void TestInRangeStrNg()
{
// str = nullのチェック
try
{
// パラメータ名指定無し
- Validate.InRange(String.Empty, 0);
+ Validate.InRange(string.Empty, 0);
Assert.Fail("expected ArgumentOutOfRangeException");
}
catch (ArgumentOutOfRangeException ex)
try
{
// パラメータ名指定有り
- Validate.InRange(String.Empty, 0, "test", "testindex");
+ Validate.InRange(string.Empty, 0, "test", "testindex");
Assert.Fail("expected ArgumentOutOfRangeException");
}
catch (ArgumentOutOfRangeException ex)
try
{
// パラメータ名指定有りnull
- Validate.InRange(String.Empty, 0, null, null);
+ Validate.InRange(string.Empty, 0, null, null);
Assert.Fail("expected ArgumentOutOfRangeException");
}
catch (ArgumentOutOfRangeException ex)
/// <see cref="Validate.InRange<T>(IList<T>, int, string, string)"/>
/// メソッドテストケース(正常系)。
/// </summary>
- [Test]
+ [TestMethod]
public void TestInRangeIList()
{
// ※ 例外が起きなければOK
/// <see cref="Validate.InRange<T>(IList<T>, int, string, string)"/>
/// メソッドテストケース(異常系)。
/// </summary>
- [Test]
+ [TestMethod]
public void TestInRangeIListNg()
{
// list = nullのチェック