/// <summary> /// <see cref="JsonStaticRepository"/> の新しいインスタンスを生成します。 /// </summary> /// <param name="staticRootDirectoryPath">JSON ファイル形式の静的データが格納されたルート フォルダーのパス。</param> public JsonStaticRepository(string staticRootDirectoryPath) { var directory = new DirectoryInfo(staticRootDirectoryPath); if (!directory.Exists) { throw new DirectoryNotFoundException($"静的データのルート フォルダー '{directory.FullName}' は存在しません。"); } Species = LoadAsKeyRecordCollection <Species>(Path.Combine(directory.FullName, "Natures.json")); }
public void TestNew2() { IEnumerable <TestKeyRecord> collection = new[] { new TestKeyRecord("A"), new TestKeyRecord("B"), new TestKeyRecord("AA"), new TestKeyRecord("C"), new TestKeyRecord("B"), }; Assert.That(() => { var c = new KeyRecordCollection <TestKeyRecord>(collection); }, Throws.ArgumentException); }
public void TestThis1() { var c = new KeyRecordCollection <TestKeyRecord>(collection); Assert.That(c[Item0Key], Is.EqualTo(item0)); Assert.That(c[Item1Key], Is.EqualTo(item1)); Assert.That(c[Item2Key], Is.EqualTo(item2)); Assert.That(c[Item3Key], Is.EqualTo(item3)); Assert.That(c[Item4Key], Is.EqualTo(item4)); Assert.That(c[Item0Key].Key, Is.EqualTo(Item0Key)); Assert.That(c[Item1Key].Key, Is.EqualTo(Item1Key)); Assert.That(c[Item2Key].Key, Is.EqualTo(Item2Key)); Assert.That(c[Item3Key].Key, Is.EqualTo(Item3Key)); Assert.That(c[Item4Key].Key, Is.EqualTo(Item4Key)); }
public void TestThis2() { var c = new KeyRecordCollection <TestKeyRecord>(collection); Assert.That(() => { TestKeyRecord r = c["197"]; }, Throws.TypeOf <IndexOutOfRangeException>()); }
public void TestNew3() { Assert.That(() => { var c = new KeyRecordCollection <TestKeyRecord>(collection); }, Throws.Nothing); }
public void TestNew1() { IEnumerable <TestKeyRecord> collection = Array.Empty <TestKeyRecord>(); Assert.That(() => { var c = new KeyRecordCollection <TestKeyRecord>(collection); }, Throws.Nothing); }