Skip to content

Commit

Permalink
Merge pull request #17 from Linq2GraphQL/add-favicon
Browse files Browse the repository at this point in the history
added icons
  • Loading branch information
joadan committed Oct 25, 2023
2 parents b6f5472 + ad91a69 commit 7c64961
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 22 deletions.
4 changes: 3 additions & 1 deletion docs/Linq2GraphQL.Docs/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

@* <PageTitle>Index</PageTitle> *@

<h1>Linq2GraphQL Docs</h1>
<h1>Linq2GraphQL Documentation</h1>

<img src="img/logo.svg" alt="Logo">



Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Linq2GraphQL.Docs/wwwroot/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Linq2GraphQL.Docs/wwwroot/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Linq2GraphQL.Docs/wwwroot/favicon.ico
Binary file not shown.
Binary file removed docs/Linq2GraphQL.Docs/wwwroot/favicon.png
Binary file not shown.
Binary file removed docs/Linq2GraphQL.Docs/wwwroot/icon-192.png
Binary file not shown.
1 change: 1 addition & 0 deletions docs/Linq2GraphQL.Docs/wwwroot/img/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions docs/Linq2GraphQL.Docs/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Linq2GraphQL.Docs</title>
<title>Linq2GraphQL Documentation</title>
<base href="/" />

<link rel="stylesheet" href="https://unpkg.com/@tabler/core@1.0.0-beta20/dist/css/tabler.min.css">
<link rel="stylesheet" href="_content/TabBlazor/css/tabblazor.min.css" />
<script src="_content/TabBlazor/js/tabblazor.js"></script>

<link href="css/app.css" rel="stylesheet" />
<link rel="icon" type="image/png" href="favicon.png" />

<link href="Linq2GraphQL.Docs.styles.css" rel="stylesheet" />

<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">

</head>

<body>
Expand Down
1 change: 0 additions & 1 deletion src/Linq2GraphQL.Client/GraphQuery.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Linq.Expressions;
using System.Xml.Linq;

namespace Linq2GraphQL.Client;

Expand Down
19 changes: 1 addition & 18 deletions src/Linq2GraphQL.Client/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,6 @@ private static void ParseExpressionInternal(Expression body, QueryNode parent)
{
ParseExpressionInternal(argument, parent);
}

//foreach (var argument in newExpression.Arguments)
//{
// switch (argument)
// {
// case MethodCallExpression methodCallExp:
// ParseMethodCallExpression(parent, methodCallExp);
// break;
// }
//}

//foreach (var argument in newExpression.Arguments.OfType<MemberExpression>())
//{
// var (ParentNode, _) = GetMemberQueryNode(argument);
// parent.AddChildNode(ParentNode);
//}

break;
}
}
Expand Down Expand Up @@ -105,7 +88,7 @@ private static void ParseMethodCallExpression(QueryNode parent, MethodCallExpres
if (methodCallExp.Arguments[0] is MemberExpression memberExpr)
{
var (ParentNode, LastNode) = GetMemberQueryNode(memberExpr);
ParseExpressionInternal(methodCallExp.Arguments[1], LastNode);
ParseExpressionInternal(methodCallExp.Arguments[1], LastNode);
parent.AddChildNode(ParentNode);
}
else
Expand Down
97 changes: 97 additions & 0 deletions test/Linq2GraphQL.Tests/QueryIncludeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using GreenDonut;
using Linq2GraphQL.TestClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Linq2GraphQL.Tests
{

public class QueryIncludeTests : IClassFixture<SampleClientFixture>
{
private readonly SampleClient sampleClient;

public QueryIncludeTests(SampleClientFixture safeModeClient)
{
sampleClient = safeModeClient.sampleClient;
}

[Fact]
public async Task IncludePrimitives()
{
var result = await sampleClient
.Query
.Orders()
.Select(e => e.Nodes)
.ExecuteAsync();

Assert.NotEqual(Guid.Empty, result.First().OrderId);

Assert.Null(result.First().Address);
}


[Fact]
public async Task IncludePrimitives_MultipleLevels()
{
var query = sampleClient
.Query
.Orders(first: 1)
//.Include(e => e.Nodes.Select(e => e.Customer)) //TODO Should this be loaded automatically because it is chained in orders?
.Include(e => e.Nodes.Select(e => e.Customer.Orders))
.Select(e => e.Nodes);


var result = await query.ExecuteAsync();

var order = result.First();
Assert.NotEqual(Guid.Empty, order.OrderId);

Assert.NotNull(order.Customer);
Assert.NotNull(order.Customer.CustomerName);
Assert.NotNull(order.Customer.Orders);
}

[Fact]
public async Task IncludePrimitives_AnomousResult()
{
var query = sampleClient
.Query
.Orders()
.Select(e => e.Nodes.Select(n => new
{
n.OrderId,
Hello = n.OrderHello("Peter", 1234),
DeliveryAddress = n.OrderAddress(AddressType.Delivery),
InvoiceAddress = n.OrderAddress(AddressType.Invoice),
Cust = new
{
n.Customer.CustomerName,
n.Customer.Orders
}
}));


var order = (await query.ExecuteAsync()).First();

Assert.NotNull(order.Cust?.CustomerName);
Assert.NotNull(order.Cust?.Orders);
Assert.NotNull(order.Hello);
Assert.NotEqual(Guid.Empty, order.Cust?.Orders.First().OrderId);
Assert.NotEqual(Guid.Empty, order.OrderId);

//Check no over fetch
var baseResult = query.BaseResult;
Assert.Equal(0, baseResult.TotalCount);
Assert.Equal(DateTimeOffset.MinValue, baseResult.Nodes.First().OrderDate);


}



}

}

0 comments on commit 7c64961

Please sign in to comment.