Beispiel #1
0
        public void AggregateTermRowConstructorSetsProperties()
        {
            var actual = new AggregateTermRow(ExpectedKey, expectedFields);

            Assert.Same(ExpectedKey, actual.Key);
            Assert.Equal(expectedFields.ToArray(), actual.Fields);
        }
Beispiel #2
0
        public void AggregateTermRowGetValueDefaultsIntValue()
        {
            var row = new AggregateTermRow(ExpectedKey, expectedFields);

            var actual = row.GetValue("missing", "int", typeof(int));

            Assert.Equal(default(int), actual);
        }
Beispiel #3
0
        public void AggregateRowGetKeyReturnsKeyForTermRow()
        {
            var row = new AggregateTermRow("rowKey", new[] { new AggregateField("field1", "eq", new JObject()) });

            var key = AggregateRow.GetKey(row);

            Assert.Equal(row.Key, key);
        }
Beispiel #4
0
        public void AggregateTermRowGetValueParsesIntValue()
        {
            var expected = expectedFields[1];
            var row      = new AggregateTermRow(ExpectedKey, expectedFields);

            var actual = row.GetValue(expected.Name, expected.Operation, typeof(int));

            Assert.Equal(5, actual);
        }
Beispiel #5
0
        public void AggregateTermRowGetValueParsesStringValue()
        {
            var expected = expectedFields[0];
            var row      = new AggregateTermRow(ExpectedKey, expectedFields);

            var actual = row.GetValue(expected.Name, expected.Operation, typeof(string));

            Assert.Equal("mower", actual);
        }
Beispiel #6
0
        public void AggregateRowGetValueReturnsValueForTermRow()
        {
            var expectedName      = "aField";
            var expectedOperation = "count";
            var expectedValue     = "aValue";

            var row = new AggregateTermRow("rowKey", new[] { new AggregateField(expectedName, expectedOperation, new JValue(expectedValue)) });

            var actual = AggregateRow.GetValue(row, expectedName, expectedOperation, expectedValue.GetType());

            Assert.Equal(expectedValue, actual);
        }