public void GenericDomainSourceOfComposableFunctionIsCorrect() { var domain = new TestDomain(); var arguments = new object[0]; var source = domain.Source <DateTime>( "Namespace", "Function", arguments); Assert.Equal(typeof(DateTime), source.ElementType); Assert.True(source.Expression is MethodCallExpression); var methodCall = source.Expression as MethodCallExpression; Assert.Null(methodCall.Object); Assert.Equal(typeof(DomainData), methodCall.Method.DeclaringType); Assert.Equal("Source", methodCall.Method.Name); Assert.Equal(typeof(DateTime), methodCall.Method.GetGenericArguments()[0]); Assert.Equal(3, methodCall.Arguments.Count); Assert.True(methodCall.Arguments[0] is ConstantExpression); Assert.Equal("Namespace", (methodCall.Arguments[0] as ConstantExpression).Value); Assert.True(methodCall.Arguments[1] is ConstantExpression); Assert.Equal("Function", (methodCall.Arguments[1] as ConstantExpression).Value); Assert.True(methodCall.Arguments[2] is ConstantExpression); Assert.Equal(arguments, (methodCall.Arguments[2] as ConstantExpression).Value); Assert.Equal(source.Expression.ToString(), source.ToString()); }
public async Task DomainQueryAsyncWithSingletonQueryReturnsResult() { var domain = new TestDomain(); var result = await domain.QueryAsync( domain.Source <string>("Test"), q => q.Single()); Assert.Equal("Test", result); }
public async Task DomainQueryAsyncWithQueryReturnsResults() { var domain = new TestDomain(); var results = await domain.QueryAsync( domain.Source <string>("Test")); Assert.True(results.SequenceEqual(new string[] { "Test" })); }
public async Task DomainQueryAsyncCorrectlyForwardsCall() { var domain = new TestDomain(); var queryRequest = new QueryRequest( domain.Source <string>("Test"), true); var queryResult = await domain.QueryAsync(queryRequest); Assert.True(queryResult.Results.Cast <string>() .SequenceEqual(new string[] { "Test" })); }
public void GenericDomainSourceOfEntityContainerElementIsCorrect() { var domain = new TestDomain(); var arguments = new object[0]; var source = domain.Source <string>("Test", arguments); Assert.Equal(typeof(string), source.ElementType); Assert.True(source.Expression is MethodCallExpression); var methodCall = source.Expression as MethodCallExpression; Assert.Null(methodCall.Object); Assert.Equal(typeof(DomainData), methodCall.Method.DeclaringType); Assert.Equal("Source", methodCall.Method.Name); Assert.Equal(typeof(string), methodCall.Method.GetGenericArguments()[0]); Assert.Equal(2, methodCall.Arguments.Count); Assert.True(methodCall.Arguments[0] is ConstantExpression); Assert.Equal("Test", (methodCall.Arguments[0] as ConstantExpression).Value); Assert.True(methodCall.Arguments[1] is ConstantExpression); Assert.Equal(arguments, (methodCall.Arguments[1] as ConstantExpression).Value); Assert.Equal(source.Expression.ToString(), source.ToString()); }