示例#1
0
		public void LongitudeValueTest()
		{
			GeoAnchor target = new GeoAnchor(); 
			float expected = 1F; 
			target.LongitudeValue = expected;
			float actual = target.LongitudeValue;
			Assert.AreEqual(expected, actual);
		}
示例#2
0
		public void GeoAnchorConstructorTest()
		{
			string latitudeAttr = string.Empty; 
			float latitudeVal = 0F; 
			string longitudeAttr = string.Empty; 
			float longitudeVal = 0F; 
			GeoAnchor target = new GeoAnchor(latitudeAttr, latitudeVal, longitudeAttr, longitudeVal);
			Assert.AreEqual(latitudeAttr, target.LatitudeAttributeName);
			Assert.AreEqual(latitudeVal, target.LatitudeValue);
			Assert.AreEqual(longitudeAttr, target.LongitudeAttributeName);
			Assert.AreEqual(longitudeVal, target.LongitudeValue);
		}
示例#3
0
        /// <summary>
        /// Serialize query parameters to specified writer
        /// </summary>
        /// <param name="writer"><see cref="IBinaryWriter"/> writer used to serialize data to underlying stream.</param>
        internal void Serialize(IBinaryWriter writer)
        {
            // offset, limits and match mode
            writer.Write(Offset);
            writer.Write(Limit);
            writer.Write((int)MatchMode);

            writer.Write((int)RankingMode);
            if (RankingMode == MatchRankMode.Expression)
            {
                writer.Write(RankingExpression);
            }

            // sorting
            writer.Write((int)SortMode);
            writer.Write(SortBy);
            writer.Write(Query);

            // NOTE: don't use deprecated per-field weights list, use FieldWeights instead
            writer.Write(0);

            Indexes.Serialize(writer);

            // documents id range
            writer.Write((int)IdSize);
            writer.Write(MinDocumentId);
            writer.Write(MaxDocumentId);

            // filters
            AttributeFilters.Serialize(writer);

            // grouping
            writer.Write((int)GroupFunc);
            writer.Write(GroupBy);
            writer.Write(MaxMatches);
            writer.Write(GroupSort);

            // cutoff
            writer.Write(Cutoff);

            // retry
            writer.Write(RetryCount);
            writer.Write(RetryDelay);

            // group distinct
            writer.Write(GroupDistinct);

            // geo anchor
            GeoAnchor.Serialize(writer);

            // index weights
            IndexWeights.Serialize(writer);

            // max query time
            writer.Write(MaxQueryTime);

            // per-field weights
            FieldWeights.Serialize(writer);

            // comment
            writer.Write(Comment);

            // attribute overrides
            AttributeOverrides.Serialize(writer);

            // select clause
            writer.Write(Select);
        }
示例#4
0
		public void LongitudeAttributeNameTest()
		{
			GeoAnchor target = new GeoAnchor(); 
			string expected = string.Empty; 
			target.LongitudeAttributeName = expected;
			string actual = target.LongitudeAttributeName;
			Assert.AreEqual(expected, actual);
		}
示例#5
0
		public void GeoAnchorConstructorTest1()
		{
			GeoAnchor target = new GeoAnchor();
		}
示例#6
0
		public void SerializeTest()
		{
			GeoAnchor target = new GeoAnchor(); 
			ArrayList list = new ArrayList();
			ArrayListWriterMock writer = new ArrayListWriterMock(list);

			target.Serialize(writer);
			CollectionAssert.AreEqual(list, new [] { false });

			writer.Reset();

			target.LatitudeAttributeName = "test";
			target.Serialize(writer);
			CollectionAssert.AreEqual(list, new object[] { true, target.LatitudeAttributeName, target.LongitudeAttributeName, target.LatitudeValue, target.LongitudeValue });
		}
示例#7
0
		public void IsNotEmptyTest()
		{
			GeoAnchor target = new GeoAnchor();
			PrivateObject po = new PrivateObject(target);
			GeoAnchor_Accessor targetAccessor = new GeoAnchor_Accessor(po);

			Assert.IsFalse(targetAccessor.IsNotEmpty);
			target.LatitudeAttributeName = "test";
			Assert.IsTrue(targetAccessor.IsNotEmpty);
		}