Example #1
0
 public static FacetType Fake(
     EFacetType facetTypeId = EFacetType.Discrete
     ) => new FacetType
 {
     FacetTypeId   = facetTypeId,
     FacetTypeName = Guid.NewGuid().ToString()
 };
Example #2
0
 public static CategoryCountSqlCompilerMatcher Create(EFacetType facetType)
 {
     if (facetType == EFacetType.Range)
     {
         return(new RangeCategoryCountSqlCompilerMatcher());
     }
     return(new DiscreteCategoryCountSqlCompilerMatcher());
 }
        public void HasPicks_VariousFacetsConfig_ExpectedBehavior(string uri, EFacetType facetType, bool hasPicks)
        {
            // Arrange
            var facetsConfig = FakeFacetsConfig(uri);

            // Act
            var result = facetsConfig.HasPicks(facetType);

            // Assert
            Assert.Equal(hasPicks, result);
        }
        public void Find_WhenCalleWithExistingId_ReturnsType(EFacetType facetType)
        {
            // Arrange
            var repository = new Repository <FacetType, EFacetType>(FacetContext);

            // Act
            var result = repository.Get(facetType);

            // Assert
            Assert.Equal(facetType, result.FacetTypeId);
        }
Example #5
0
        private Facet MockFacet(string facetCode, EFacetType facetType, List <FacetTable> tables, List <FacetClause> clauses)
        {
            var facet = new Facet()
            {
                FacetId      = 1,
                FacetCode    = facetCode,
                DisplayTitle = "Dummy title",
                FacetGroupId = 1,
                FacetGroup   = new FacetGroup {
                    FacetGroupId  = 1,
                    FacetGroupKey = "1",
                    Description   = "Dummy group",
                    DisplayTitle  = "Dummy group",
                    IsApplicable  = true,
                    IsDefault     = true
                },
                FacetTypeId = facetType,
                FacetType   = new FacetType {
                    FacetTypeId    = facetType,
                    FacetTypeName  = "Dummy type",
                    ReloadAsTarget = facetType == EFacetType.Range
                },
                CategoryIdExpr   = "A.a_id",
                CategoryNameExpr = "A.a_name",
                SortExpr         = "A.a_name",
                IsApplicable     = true,
                IsDefault        = false,
                AggregateType    = "count",
                AggregateTitle   = "Number of dummies",
                AggregateFacetId = 1,
                Tables           = tables,
                Clauses          = clauses
            };

            return(facet);
        }
Example #6
0
 public virtual IFacetContentService Locate(EFacetType facetType)
 {
     return(Services[facetType]);
 }
 public virtual ICategoryCountService Locate(EFacetType facetType)
 {
     return(Services[facetType]);
 }
Example #8
0
 public virtual IPickFilterCompiler Locate(EFacetType facetType)
 {
     return(PickCompilers[(int)facetType]);
 }
Example #9
0
 public IEnumerable <Facet> GetOfType(EFacetType type)
 => Find(z => z.FacetTypeId == type);