Raven.Tests.Faceted.FacetedIndexTestHelper.GetCameras C# (CSharp) Method

GetCameras() public static method

public static GetCameras ( int numCameras ) : IList
numCameras int
return IList
		public static IList<Camera> GetCameras(int numCameras)
		{
			var cameraList = new List<Camera>(numCameras);

			for (int i = 1; i <= numCameras; i++)
			{
				cameraList.Add(new Camera
				{
					Id = i,
					DateOfListing = new DateTime(1980 + random.Next(1, 30), random.Next(1, 12), random.Next(1, 27)),
					Manufacturer = Manufacturers[(int)(random.NextDouble() * Manufacturers.Count)],
					Model = "blah",
					Cost = (decimal)((random.NextDouble() * 900.0) + 100.0),    //100.0 to 1000.0
					Zoom = (int)(random.NextDouble() * 12) + 2,                 //2.0 to 12.0
					Megapixels = (decimal)((random.NextDouble() * 10.0) + 1.0), //1.0 to 11.0
					ImageStabiliser = random.NextDouble() > 0.6,
					AdvancedFeatures = new List<string> { "??" }
				});
			}

			return cameraList;           
		}                		
	}   

Usage Example

Exemplo n.º 1
0
        public FacetedIndex()
        {
            _data = FacetedIndexTestHelper.GetCameras(NumCameras);

            _facets = new List <Facet>
            {
                new Facet {
                    Name = "Manufacturer"
                },
                //default is term query
                //In Lucene [ is inclusive, { is exclusive
                new Facet
                {
                    Name   = "Cost_Range",
                    Mode   = FacetMode.Ranges,
                    Ranges =
                    {
                        "[NULL TO Dx200.0]",
                        "[Dx200.0 TO Dx400.0]",
                        "[Dx400.0 TO Dx600.0]",
                        "[Dx600.0 TO Dx800.0]",
                        "[Dx800.0 TO NULL]",
                    }
                },
                new Facet
                {
                    Name   = "Megapixels_Range",
                    Mode   = FacetMode.Ranges,
                    Ranges =
                    {
                        "[NULL TO Dx3.0]",
                        "[Dx3.0 TO Dx7.0]",
                        "[Dx7.0 TO Dx10.0]",
                        "[Dx10.0 TO NULL]",
                    }
                }
            };
        }
All Usage Examples Of Raven.Tests.Faceted.FacetedIndexTestHelper::GetCameras
FacetedIndexTestHelper