コード例 #1
0
ファイル: FacetsTest.cs プロジェクト: sjoerdteunisse/GiveCRM
        public void InsertFreeTextFacet()
        {
            var facet = FacetSetUpHelper.CreateFreeTextFacet();

            facet = new Facets().GetById(facet.Id);
            Assert.AreNotEqual(0, facet.Id);
            Assert.AreEqual(FacetType.FreeText, facet.Type);
            Assert.AreEqual("FreeTextTest", facet.Name);
        }
コード例 #2
0
        public void InsertMemberFacetFreeText()
        {
            var member = CreateBob();

            var textFacet = FacetSetUpHelper.CreateFreeTextFacet();

            var facet = CreateFreeTextMemberFacet(member, textFacet);

            Assert.AreNotEqual(0, facet.Id);
            Assert.AreEqual(textFacet.Id, facet.FacetId);
            Assert.AreEqual("Aardvark", facet.FreeTextValue);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: FacetsTest.cs プロジェクト: sjoerdteunisse/GiveCRM
        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);
            }
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: FacetsTest.cs プロジェクト: sjoerdteunisse/GiveCRM
        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);
            }
        }