Skip to content

Commit 3ce8d89

Browse files
committed
Refactor: Restructure EntityFrameworkCore files into logical namespaces and directories for clarity
1 parent 440824f commit 3ce8d89

File tree

9 files changed

+55
-54
lines changed

9 files changed

+55
-54
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=contracts/@EntryIndexedValue">True</s:Boolean>
3-
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=linq/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
3+
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=linq/@EntryIndexedValue">True</s:Boolean>
4+
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=unitofwork/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

tests/Tests.CodeOfChaos.Extensions.EntityFrameworkCore/LinqExtensionTests.cs renamed to tests/Tests.CodeOfChaos.Extensions.EntityFrameworkCore/Linq/LinqExtensionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Microsoft.EntityFrameworkCore;
66
using System.Linq.Expressions;
77

8-
namespace Tests.CodeOfChaos.Extensions.EntityFrameworkCore;
8+
namespace Tests.CodeOfChaos.Extensions.EntityFrameworkCore.Linq;
99
// ---------------------------------------------------------------------------------------------------------------------
1010
// Code
1111
// ---------------------------------------------------------------------------------------------------------------------
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
// ---------------------------------------------------------------------------------------------------------------------
2-
// Imports
3-
// ---------------------------------------------------------------------------------------------------------------------
4-
using Microsoft.EntityFrameworkCore;
5-
6-
namespace Tests.CodeOfChaos.Extensions.EntityFrameworkCore;
7-
// ---------------------------------------------------------------------------------------------------------------------
8-
// Code
9-
// ---------------------------------------------------------------------------------------------------------------------
10-
public class LinqWithQueryTests {
11-
[Test]
12-
[Arguments("a", new[] { "a", "b", "c" }, new[] { "a" })]
13-
[Arguments("b", new[] { "a", "b", "c" }, new[] { "b" })]
14-
[Arguments("c", new[] { "a", "b", "c" }, new[] { "c" })]
15-
public async Task ConditionalInclude_ShouldReturnSourceAsIs(string filter, IEnumerable<string> input, IEnumerable<string> expected) {
16-
// Arrange
17-
IQueryable<string> source = input.AsQueryable();
18-
19-
// Act
20-
IQueryable<string> output = source.With(WhereArg, filter);
21-
22-
// Assert
23-
await Assert.That(output).IsEquivalentTo(expected);
24-
return;
25-
26-
IQueryable<string> WhereArg(IQueryable<string> s, string f) {
27-
return source.Where(x => x == f);
28-
}
29-
}
30-
31-
[Test]
32-
[Arguments("a", "c", new[] { "a", "b", "c" }, new[] { "a", "c" })]
33-
[Arguments("b", "", new[] { "a", "b", "c" }, new[] { "b" })]
34-
[Arguments("c", "c", new[] { "a", "b", "c" }, new[] { "c" })]
35-
public async Task ConditionalInclude_ShouldReturnSourceAsIs(string arg0, string arg1, IEnumerable<string> input, IEnumerable<string> expected) {
36-
// Arrange
37-
IQueryable<string> source = input.AsQueryable();
38-
39-
// Act
40-
IQueryable<string> output = source.With(WhereArg, arg0, arg1);
41-
42-
// Assert
43-
await Assert.That(output).IsEquivalentTo(expected);
44-
return;
45-
46-
IQueryable<string> WhereArg(IQueryable<string> s, string a0, string a1) {
47-
return source.Where(x =>
48-
!string.IsNullOrWhiteSpace(a1) && (x == a0 || x == a1)
49-
|| string.IsNullOrWhiteSpace(a1) && x == a0);
50-
}
51-
}
52-
}
1+
// ---------------------------------------------------------------------------------------------------------------------
2+
// Imports
3+
// ---------------------------------------------------------------------------------------------------------------------
4+
using Microsoft.EntityFrameworkCore;
5+
6+
namespace Tests.CodeOfChaos.Extensions.EntityFrameworkCore.Linq;
7+
// ---------------------------------------------------------------------------------------------------------------------
8+
// Code
9+
// ---------------------------------------------------------------------------------------------------------------------
10+
public class LinqWithQueryTests {
11+
[Test]
12+
[Arguments("a", new[] { "a", "b", "c" }, new[] { "a" })]
13+
[Arguments("b", new[] { "a", "b", "c" }, new[] { "b" })]
14+
[Arguments("c", new[] { "a", "b", "c" }, new[] { "c" })]
15+
public async Task ConditionalInclude_ShouldReturnSourceAsIs(string filter, IEnumerable<string> input, IEnumerable<string> expected) {
16+
// Arrange
17+
IQueryable<string> source = input.AsQueryable();
18+
19+
// Act
20+
IQueryable<string> output = source.With(WhereArg, filter);
21+
22+
// Assert
23+
await Assert.That(output).IsEquivalentTo(expected);
24+
return;
25+
26+
IQueryable<string> WhereArg(IQueryable<string> s, string f) {
27+
return source.Where(x => x == f);
28+
}
29+
}
30+
31+
[Test]
32+
[Arguments("a", "c", new[] { "a", "b", "c" }, new[] { "a", "c" })]
33+
[Arguments("b", "", new[] { "a", "b", "c" }, new[] { "b" })]
34+
[Arguments("c", "c", new[] { "a", "b", "c" }, new[] { "c" })]
35+
public async Task ConditionalInclude_ShouldReturnSourceAsIs(string arg0, string arg1, IEnumerable<string> input, IEnumerable<string> expected) {
36+
// Arrange
37+
IQueryable<string> source = input.AsQueryable();
38+
39+
// Act
40+
IQueryable<string> output = source.With(WhereArg, arg0, arg1);
41+
42+
// Assert
43+
await Assert.That(output).IsEquivalentTo(expected);
44+
return;
45+
46+
IQueryable<string> WhereArg(IQueryable<string> s, string a0, string a1) {
47+
return source.Where(x =>
48+
!string.IsNullOrWhiteSpace(a1) && (x == a0 || x == a1)
49+
|| string.IsNullOrWhiteSpace(a1) && x == a0);
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)