public void InsertMemberFacetList() { var member = CreateBob(); var listFacet = FacetSetUpHelper.CreateListFacet(); var facet = CreateListMemberFacet(member, listFacet); Assert.AreNotEqual(0, facet.Id); Assert.AreEqual(listFacet.Id, facet.FacetId); Assert.AreEqual(2, facet.Values.Count); Assert.AreEqual(listFacet.Values.First().Id, facet.Values.First().FacetValueId); Assert.AreEqual(listFacet.Values.Last().Id, facet.Values.Last().FacetValueId); }
public void InsertListFacet() { var facet = FacetSetUpHelper.CreateListFacet(); Assert.AreNotEqual(0, facet.Id); Assert.AreEqual(FacetType.List, facet.Type); Assert.AreEqual("ListTest", facet.Name); Assert.IsNotNull(facet.Values); Assert.AreEqual(1, facet.Values.Count(v => v.Value == "One")); Assert.AreEqual(1, facet.Values.Count(v => v.Value == "Two")); foreach (var value in facet.Values) { Assert.AreEqual(facet.Id, value.FacetId); Assert.AreNotEqual(0, value.Id); } }
public void AllMemberFacets() { var member = CreateBob(); var listFacet = FacetSetUpHelper.CreateListFacet(); var textFacet = FacetSetUpHelper.CreateFreeTextFacet(); var expectedMemberListFacet = CreateListMemberFacet(member, listFacet); var expectedMemberTextFacet = CreateFreeTextMemberFacet(member, textFacet); var facets = new MemberFacets().ForMember(member.Id).ToList(); var actualMemberListFacet = facets.OfType <MemberFacetList>().FirstOrDefault(); Assert.IsNotNull(actualMemberListFacet); Assert.AreEqual(2, actualMemberListFacet.Values.Count); var actualMemberTextFacet = facets.OfType <MemberFacetFreeText>().FirstOrDefault(); Assert.IsNotNull(actualMemberTextFacet); }
public void AllFacets() { FacetSetUpHelper.CreateFreeTextFacet(); FacetSetUpHelper.CreateListFacet(); var facet = new Facets().GetAll().FirstOrDefault(f => f.Type == FacetType.FreeText); Assert.IsNotNull(facet); Assert.AreEqual("FreeTextTest", facet.Name); facet = new Facets().GetAll().FirstOrDefault(f => f.Type == FacetType.List); Assert.IsNotNull(facet); Assert.AreNotEqual(0, facet.Id); Assert.AreEqual(FacetType.List, facet.Type); Assert.AreEqual("ListTest", facet.Name); Assert.IsNotNull(facet.Values); Assert.AreEqual(1, facet.Values.Count(v => v.Value == "One")); Assert.AreEqual(1, facet.Values.Count(v => v.Value == "Two")); foreach (var value in facet.Values) { Assert.AreEqual(facet.Id, value.FacetId); Assert.AreNotEqual(0, value.Id); } }