public void FindNonExistentValueShouldFail() { InMemoryAccountTypeRepository subject = CreateSubject(); subject.Add(Key1, CreateTestData()); subject.Add(Key2, CreateTestData()); Engine.BankAccount.Account result = subject.Find(a => a.Name == "Key99"); Assert.IsNull(result); }
public void FindExistingValueShouldSucceed() { InMemoryAccountTypeRepository subject = CreateSubject(); subject.Add(Key1, CreateTestData()); subject.Add(Key2, CreateTestData()); Engine.BankAccount.Account result = subject.Find(a => a.Name == Key1); Assert.IsNotNull(result); }
public void AddingDuplicateEntryShouldNotThrow() { InMemoryAccountTypeRepository subject = CreateSubject(); ChequeAccount data = CreateTestData2(); subject.Add(Key1, data); ChequeAccount data2 = CreateTestData2(); subject.Add(Key1, data2); Assert.AreEqual(data.Name, subject.GetByKey(Key1).Name); }
public void AddingNullKeyEntryShouldThrow() { InMemoryAccountTypeRepository subject = CreateSubject(); subject.Add(null, CreateTestData()); Assert.Fail(); }
public void AddingNullEntryShouldThrow() { InMemoryAccountTypeRepository subject = CreateSubject(); subject.Add(Key1, null); Assert.Fail(); }
public void AddingNewEntryShouldBeRetrievableByKey() { InMemoryAccountTypeRepository subject = CreateSubject(); ChequeAccount data = CreateTestData2(); subject.Add(Key1, data); Assert.AreEqual(data.Name, subject.GetByKey(Key1).Name); }