Esempio n. 1
0
        public void AggregateTermRowConstructorSetsProperties()
        {
            var actual = new AggregateTermRow(ExpectedKey, expectedFields);

            Assert.Same(ExpectedKey, actual.Key);
            Assert.Equal(expectedFields.ToArray(), actual.Fields);
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public void AggregateTermRowGetValueDefaultsIntValue()
        {
            var row = new AggregateTermRow(ExpectedKey, expectedFields);

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

            Assert.Equal(default(int), actual);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }