public void SubsectionRepository_CanStore() { var repo = new SubsectionRepository(); var subsection = new Subsection("第一款"); repo.Store(subsection); // without error }
public void SubsectionRepository_CanRetrieve() { var repo = new SubsectionRepository(); var subsection = new Subsection("第一款"); repo.Store(subsection); var actual = repo.Retrieve(subsection.Id); Assert.AreEqual(subsection, actual); }
public void SubsectionRepository_CanRetrieveBySpecification() { var repo = new SubsectionRepository(); repo.Empty(); var subsection = new Subsection("第一款"); repo.Store(subsection); var specification = new SubsectionHasTitle("第一款"); var actual = repo.Retrieve(specification); Assert.AreEqual(subsection, actual.Single()); }
public void SubsectionRepository_CanRetrieveMultipleItemsBySpecification() { var repo = new SubsectionRepository(); repo.Empty(); var subsection1 = new Subsection("第一款"); repo.Store(subsection1); var subsection2 = new Subsection("第二款"); repo.Store(subsection2); var specification = new SubsectionTitleContains("第"); var actual = repo.Retrieve(specification); CollectionAssert.AreEquivalent(new[] { subsection1, subsection2 }, actual.ToArray()); }
public void SubsectionRepository_EmptyIfNoItemsFoundBySpecification() { var repo = new SubsectionRepository(); repo.Empty(); var subsection1 = new Subsection("第一款"); repo.Store(subsection1); var subsection2 = new Subsection("第二款"); repo.Store(subsection2); var specification = new SubsectionTitleContains("Subsection"); var actual = repo.Retrieve(specification); CollectionAssert.AreEquivalent(new Subsection[0], actual.ToArray()); }