1 // ================================================================================================
3 // Websiteのテストクラスソース。</summary>
5 // <copyright file="WebsiteTest.cs" company="honeplusのメモ帳">
6 // Copyright (C) 2012 Honeplus. All rights reserved.</copyright>
9 // ================================================================================================
11 namespace Honememo.Wptscs.Websites
14 using Honememo.Wptscs.Models;
15 using Honememo.Wptscs.Utilities;
16 using Microsoft.VisualStudio.TestTools.UnitTesting;
19 /// <see cref="Website"/>のテストクラスです。
22 public class WebsiteTest
27 /// <see cref="Website.Location"/>プロパティテストケース。
30 public void TestLocation()
32 DummySite site = new DummySite();
33 site.Location = "test";
34 Assert.AreEqual("test", site.Location);
38 /// <see cref="Website.Location"/>プロパティテストケース(null)。
41 [ExpectedException(typeof(ArgumentNullException))]
42 public void TestLocationNull()
44 new DummySite().Location = null;
48 /// <see cref="Website.Location"/>プロパティテストケース(空)。
51 [ExpectedException(typeof(ArgumentException))]
52 public void TestLocationBlank()
54 new DummySite().Location = " ";
58 /// <see cref="Website.Language"/>プロパティテストケース。
61 public void TestLanguage()
63 DummySite site = new DummySite();
64 site.Language = new Language("ja");
65 Assert.AreEqual("ja", site.Language.Code);
69 /// <see cref="Website.Language"/>プロパティテストケース(null)。
72 [ExpectedException(typeof(ArgumentNullException))]
73 public void TestLanguageNull()
75 new DummySite().Language = null;
79 /// <see cref="Website.WebProxy"/>プロパティテストケース。
82 public void TestWebProxy()
84 DummySite site = new DummySite();
86 // デフォルトでオブジェクトが格納されている
87 Assert.IsNotNull(site.WebProxy);
90 IWebProxy proxy = new AppConfigWebProxy();
91 site.WebProxy = proxy;
92 Assert.AreSame(proxy, site.WebProxy);
96 /// <see cref="Website.WebProxy"/>プロパティテストケース(null)。
99 [ExpectedException(typeof(ArgumentNullException))]
100 public void TestWebProxyNull()
102 new DummySite().WebProxy = null;
110 /// <see cref="Website"/>テスト用のモッククラスです。
112 private class DummySite : Website
114 #region 非公開プロパティテスト用のオーラーライドプロパティ
119 public new Language Language
123 return base.Language;
128 base.Language = value;
139 /// <param name="title">ページタイトル。</param>
140 /// <returns><c>null</c>。</returns>
141 public override Page GetPage(string title)