public void getAllTest() { using (WebActionExecutor executor = new WebActionExecutor()) { IContentContainer container = getContainer(); container.Clear(); List <IContent> contents = new List <IContent>(from int i in Enumerable.Range(0, rnd.Next(10) + 2) select TestContentType.getARandomTestContentType(enforce_a_reference: false)); container.AddContents(contents); List <IContent> type2 = new List <IContent>(from int i in Enumerable.Range(0, rnd.Next(10) + 2) select new TestContentType2()); container.AddContents(type2); Assert.IsTrue(container.GetAll <TestContentType2>().sameContents(type2)); Assert.IsTrue(container.GetAll <TestContentType>().sameContents(type2.Union(contents))); } }
public void addContentsTest() { IContentContainer container = getContainer(); List <IContent> contents = new List <IContent>(from int i in Enumerable.Range(0, rnd.Next(10) + 2) select TestContentType.getARandomTestContentType(enforce_a_reference: false)); container.AddContents(contents); Assert.AreEqual(container.Count, contents.Count); }
public void getAllByFilterTest() { using (WebActionExecutor executor = new WebActionExecutor()){ IContentContainer container = getContainer(); List <TestContentType> contents = new List <TestContentType>(from int i in Enumerable.Range(0, rnd.Next(10) + 2) select TestContentType.getARandomTestContentType(enforce_a_reference: false)); container.AddContents(contents); Assert.IsTrue(container.GetAllByFilter <TestContentType>( x => x.a_string == contents[0].a_string || x.a_string == contents[1].a_string) .sameContents(contents.Take(2))); } }
public void GetEnumeratorTest() { using (WebActionExecutor executor = new WebActionExecutor()) { IContentContainer container = getContainer(); List <TestContentType> contents = new List <TestContentType>(from int i in Enumerable.Range(0, rnd.Next(10) + 2) select TestContentType.getARandomTestContentType(enforce_a_reference: false)); container.AddContents(contents); int tot = 0; foreach (IContent c in container) { tot += 1; } Assert.AreEqual(contents.Count, tot); } }
public void AddContents(IEnumerable <IContent> contents) { _storage.AddContents(contents); }