Skip to content

Commit 75d485b

Browse files
committed
#27 building and 23 tests failing
1 parent faa6309 commit 75d485b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+374
-494
lines changed

SubSonic.Extensions.SqlServer/Infrastructure/DbSubSonicCommandQueryProcedure.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using System.Data;
3+
using System.Linq;
34

45
namespace SubSonic.Infrastructure
56
{

SubSonic.Tests/DAL/DbContext/DbContextTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ public void ShouldBeAbleToDeleteRecordsUsingCQRS()
224224
.Where(x => x.ID == 1)
225225
.Single();
226226

227+
property.Should().NotBeNull();
228+
227229
((IEntityProxy)property).IsDeleted.Should().BeFalse();
228230

229231
Context.RealEstateProperties.Delete(property);

SubSonic.Tests/DAL/DbContext/DbDeleteTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using FluentAssertions;
33
using System;
44
using System.Collections.Generic;
5-
using System.Text;
5+
using System.Linq;
66
using System.Data;
77
using System.Data.Common;
88

SubSonic.Tests/DAL/DbContext/DbUpdateTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using FluentAssertions;
33
using System;
44
using System.Collections.Generic;
5-
using System.Text;
5+
using System.Linq;
66
using System.Data;
77
using System.Data.Common;
88

SubSonic.Tests/DAL/DbSetCollection/DbSetCollectionTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
using FluentAssertions;
22
using NUnit.Framework;
3-
using SubSonic.Extensions.Test;
4-
using SubSonic.Extensions.Test.Models;
5-
using SubSonic.Infrastructure;
6-
using SubSonic.Linq;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Linq.Expressions;
76

87
namespace SubSonic.Tests.DAL.DbSetCollection
98
{
10-
using SubSonic.Data.Caching;
11-
using SubSonic.Data.DynamicProxies;
9+
using Data.Caching;
10+
using Data.DynamicProxies;
11+
using Extensions.Test;
12+
using Extensions.Test.Models;
13+
using Infrastructure;
1214
using SUT;
13-
using System.Collections.Generic;
14-
using System.Linq.Expressions;
1515

1616
[TestFixture]
1717
public class DbSetCollectionTests

SubSonic.Tests/DAL/SUT/DbTestCase.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
using System;
22
using System.Collections;
33
using System.Collections.Generic;
4+
using System.Linq;
45
using System.Linq.Expressions;
5-
using System.Text;
66

77
namespace SubSonic.Tests.DAL
88
{
9-
using Infrastructure.Schema;
109
using Extensions.Test;
1110
using Infrastructure;
12-
using Linq;
11+
using Infrastructure.Schema;
1312
using SysLinq = System.Linq;
1413

1514
public class DbTestCase<TModel>

SubSonic.Tests/DAL/ScalarFunctions/ScalarFunctionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
using FluentAssertions;
22
using Microsoft.Extensions.Logging;
33
using NUnit.Framework;
4+
using System.Linq;
45
using System.Linq.Expressions;
56

67
namespace SubSonic.Tests.DAL.ScalarFunctions
78
{
89
using Extensions.Test.Data.Functions;
910
using Infrastructure;
1011
using Infrastructure.Logging;
11-
using Linq;
1212
using Linq.Expressions;
1313
using SubSonic.Extensions.Test.Models;
1414
using SUT;

SubSonic.Tests/DAL/SqlQueryProvider/SqlGeneratorTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using FluentAssertions;
22
using Microsoft.Extensions.Logging;
33
using NUnit.Framework;
4-
using SubSonic.Tests.DAL.SUT;
54
using System;
65
using System.Data;
6+
using System.Linq;
77
using System.Linq.Expressions;
88

99
namespace SubSonic.Tests.DAL.SqlQueryProvider
@@ -13,9 +13,9 @@ namespace SubSonic.Tests.DAL.SqlQueryProvider
1313
using Extensions.Test.Models;
1414
using Infrastructure;
1515
using Infrastructure.Logging;
16-
using Infrastructure.Schema;
1716
using Linq;
1817
using Linq.Expressions;
18+
using Tests.DAL.SUT;
1919

2020
[TestFixture]
2121
public partial class SqlQueryProviderTests
@@ -946,7 +946,7 @@ INNER JOIN page
946946
.Where((property) =>
947947
property.HasParallelPowerGeneration == true)
948948
.OrderBy((property) => property.ID)
949-
.ThenOrderBy((property) => property.StatusID)
949+
.ThenBy((property) => property.StatusID)
950950
.Page(default(int), 5)
951951
.Expression;
952952

@@ -998,7 +998,7 @@ INNER JOIN page
998998
.Where((property) =>
999999
property.HasParallelPowerGeneration == true)
10001000
.OrderByDescending((property) => property.ID)
1001-
.ThenOrderByDescending((property) => property.StatusID)
1001+
.ThenByDescending((property) => property.StatusID)
10021002
.Page(default(int), 5)
10031003
.Expression;
10041004

SubSonic/Data/ChangeTracking/ChangeTrackerCollection.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
using Microsoft.Extensions.Logging;
2-
using SubSonic.Infrastructure;
3-
using SubSonic.Infrastructure.Logging;
4-
using SubSonic.Linq;
52
using System;
63
using System.Collections;
74
using System.Collections.Generic;
85
using System.Collections.ObjectModel;
6+
using System.Linq;
97
using System.Linq.Expressions;
108
using System.Text;
119

1210
namespace SubSonic.Data.Caching
1311
{
12+
using Infrastructure;
13+
using Infrastructure.Logging;
14+
using Linq;
15+
1416
public class ChangeTrackerCollection
1517
: IEnumerable<KeyValuePair<Type, IEnumerable<IEntityProxy>>>
1618
{
@@ -109,7 +111,7 @@ public bool SaveChanges(out string feedback)
109111

110112
string error_feedback = "";
111113

112-
if (insert.Count() > 0)
114+
if (insert.Any())
113115
{
114116
success &= collection[dataset.Key].SaveChanges(DbQueryType.Insert, insert, out error_feedback);
115117
if (!success && error_feedback.IsNotNullOrEmpty())
@@ -120,7 +122,7 @@ public bool SaveChanges(out string feedback)
120122
}
121123
}
122124

123-
if (update.Count() > 0)
125+
if (update.Any())
124126
{
125127
success &= collection[dataset.Key].SaveChanges(DbQueryType.Update, update, out error_feedback);
126128
if (!success && error_feedback.IsNotNullOrEmpty())
@@ -131,7 +133,7 @@ public bool SaveChanges(out string feedback)
131133
}
132134
}
133135

134-
if (delete.Count() > 0)
136+
if (delete.Any())
135137
{
136138
success &= collection[dataset.Key].SaveChanges(DbQueryType.Delete, delete, out error_feedback);
137139
if (!success && error_feedback.IsNotNullOrEmpty())

SubSonic/Data/ChangeTracking/ChangeTrackerElement.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
using SubSonic.Infrastructure;
2-
using SubSonic.Infrastructure.Logging;
3-
using SubSonic.Infrastructure.Schema;
4-
using SubSonic.Linq;
5-
using SubSonic.Linq.Expressions;
6-
using System;
1+
using System;
72
using System.Collections;
83
using System.Collections.Generic;
94
using System.Collections.ObjectModel;
105
using System.Data;
6+
using System.Linq;
117
using System.Linq.Expressions;
12-
using System.Text;
138
using System.Threading.Tasks;
149

1510
namespace SubSonic.Data.Caching
1611
{
12+
using Infrastructure;
13+
using Infrastructure.Logging;
14+
using Infrastructure.Schema;
15+
using Linq;
16+
using Linq.Expressions;
17+
1718
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1710:Identifiers should have correct suffix", Justification = "It is getting to wordy if I do this")]
1819
public class ChangeTrackerElement<TEntity>
1920
: ChangeTrackerElement, IEnumerable<TEntity>
@@ -38,7 +39,7 @@ public override void Add(object record)
3839
{
3940
if(record is IEntityProxy<TEntity> entity)
4041
{
41-
if (cache.Count(x => x.IsNew == false && x.KeyData.IsSameAs(entity.KeyData)) == 0)
42+
if (cache.Any(x => x.IsNew == false && x.KeyData.IsSameAs(entity.KeyData)))
4243
{
4344
cache.Add(entity);
4445
}
@@ -79,7 +80,7 @@ public override int Count(Expression expression)
7980
return 0;
8081
}
8182

82-
results = results.Where((Expression<Func<TEntity, bool>>)where.LambdaPredicate);
83+
results = results.Where(((Expression<Func<TEntity, bool>>)where.LambdaPredicate).Compile());
8384
}
8485

8586
return results.Count();
@@ -272,7 +273,7 @@ public override bool SaveChanges(DbQueryType queryType, IEnumerable<IEntityProxy
272273
}
273274
}
274275

275-
public override TResult Where<TResult>(System.Linq.IQueryProvider provider, Expression expression)
276+
public override TResult Where<TResult>(IQueryProvider provider, Expression expression)
276277
{
277278
if (Cache is ObservableCollection<IEntityProxy<TEntity>> cache)
278279
{
@@ -284,7 +285,7 @@ public override TResult Where<TResult>(System.Linq.IQueryProvider provider, Expr
284285

285286
if (select.Where is DbWhereExpression where)
286287
{
287-
results = results.Where((Expression<Func<TEntity, bool>>)where.LambdaPredicate);
288+
results = results.Where(((Expression<Func<TEntity, bool>>)where.LambdaPredicate).Compile());
288289
}
289290

290291
if (typeof(TResult).IsEnumerable())

0 commit comments

Comments
 (0)