public void containsTypeTest() { IContentContainer container = getContainer(); TestContentType c = TestContentType.getARandomTestContentType(enforce_a_reference: false); Assert.IsFalse(container.ContainsType <TestContentType>()); container.Add(c); Assert.IsTrue(container.ContainsType <TestContentType>()); }
public void AddTest() { IContentContainer container = getContainer(); TestContentType c = TestContentType.getARandomTestContentType(enforce_a_reference: true); container.Add(c.single_reference.value); foreach (var r in c.multi_reference) { container.Add(r.value); } container.Add(c); Guid guid = c.guid; var back_from_container = container.GetContent <TestContentType>(guid); Assert.AreEqual(c.guid, back_from_container.guid); Assert.IsTrue(c.samePropertiesValue(back_from_container)); Assert.AreEqual(c.GetType(), back_from_container.GetType()); }
public void getLightContentRerefereceTest() { using (WebActionExecutor executor = new WebActionExecutor()) { IContentContainer container = getContainer(); TestContentType c = TestContentType.getARandomTestContentType(enforce_a_reference: false); container.Add(c); LightContentReferece light_reference = container.GetLightContentRereferece <TestContentType>().FirstOrDefault(); Assert.AreEqual(light_reference.ReferenceText, c.ReferenceText); Assert.AreEqual(light_reference.guid, c.guid); } }
public void RemoveTest() { using (WebActionExecutor executor = new WebActionExecutor()) { IContentContainer container = getContainer(); TestContentType c = TestContentType.getARandomTestContentType(enforce_a_reference: false); container.Add(c); Assert.IsTrue(container.Remove(c)); c = TestContentType.getARandomTestContentType(enforce_a_reference: false); Assert.IsFalse(container.Remove(c)); Assert.AreEqual(container.Count, 0); } }
public void Add(IContent item) { _storage.Add(item); }