public void QueryParameter002() { // Arrange var expressionCache = new ExpressionCache <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(expressionCache); var parameter = new QueryParameter <TestDocument>(expressionBuilder); // Act / Assert Assert.Throws <ArgumentNullException>(() => parameter.Configure(null)); }
public void QueryParameter001() { // Arrange var container = new List <string>(); var expressionCache = new ExpressionCache <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(expressionCache); var parameter = new QueryParameter <TestDocument>(expressionBuilder); parameter.Configure(new Single <TestDocument>(q => q.Id, "ITEM01")); // Act parameter.Execute(container); // Assert Assert.Equal(1, container.Count); Assert.Equal("q=_id_:ITEM01", container[0]); }
public void QueryParameter001() { // Arrange var expected = JObject.Parse(@" { ""query"": ""_id_:ITEM01"" }"); string actual; var jObject = new JObject(); var expressionCache = new ExpressionCache <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(expressionCache); var parameter = new QueryParameter <TestDocument>(expressionBuilder); parameter.Configure(new Single <TestDocument>(q => q.Id, "ITEM01")); // Act parameter.Execute(jObject); actual = jObject.ToString(); // Assert Assert.Equal(expected.ToString(), actual); }