public void HasPicks_WhenRangeFacetHasPicks_IsTrue()
        {
            // Arrange
            var facetConfig2 = new FacetConfig2 {
                FacetCode = "dummy_code",
                Facet     = new Mock <Facet>().Object,
                Position  = 0,
                Picks     = FacetConfigPick.CreateLowerUpper(3M, 52M)
            };
            // Act
            var result = facetConfig2.HasPicks();

            // Assert
            Assert.True(result);
        }
        public void CreateLowerUpper_LowerUpper_ListOfTwoPicks()
        {
            // Arrange
            decimal lower = 5;
            decimal upper = 10;

            // Act
            var result = FacetConfigPick.CreateLowerUpper(lower, upper);

            // Assert
            Assert.Equal(2, result.Count);
            Assert.Equal(EPickType.lower, result[0].PickType);
            Assert.Equal(lower.ToString(), result[0].PickValue);
            Assert.Equal(EPickType.upper, result[1].PickType);
            Assert.Equal(upper.ToString(), result[1].PickValue);
        }
Exemplo n.º 3
0
        private List <FacetConfigPick> ParsePicks(string data)
        {
            var cultureInfo = new CultureInfo("en-US");

            Match m = tupleRegex.Match(data);

            if (m.Success && m.Groups.Count == 3)
            {
                var lower = Decimal.Parse(m.Groups[1].Value, NumberStyles.Any, cultureInfo);
                var upper = Decimal.Parse(m.Groups[2].Value, NumberStyles.Any, cultureInfo);

                return(FacetConfigPick.CreateLowerUpper(lower, upper));
            }

            return(data.Split(",").Select(z => new FacetConfigPick(EPickType.discrete, z)).ToList());
        }
Exemplo n.º 4
0
 public static FacetConfig2 Create(Facet facet, int position, decimal lower, decimal upper, string filter = "")
 {
     return(new FacetConfig2(facet, position, filter, FacetConfigPick.CreateLowerUpper(lower, upper)));
 }