Skip to content

Commit

Permalink
loses subsonic#148 - test and Territory class added to verify fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adam7 authored and adam7 committed Mar 6, 2010
1 parent be8a730 commit 7101d3d
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 2 deletions.
3 changes: 1 addition & 2 deletions SubSonic.Core/Linq/Structure/QueryMapping.cs
Expand Up @@ -98,8 +98,7 @@ public QueryLanguage Language
/// <returns></returns>
public virtual IEnumerable<MemberInfo> GetMappedMembers(Type rowType)
{
HashSet<MemberInfo> members = new HashSet<MemberInfo>(rowType.GetFields().Cast<MemberInfo>().Where(m => this.IsMapped(m)));
members.UnionWith(rowType.GetProperties().Cast<MemberInfo>().Where(m => this.IsMapped(m)));
HashSet<MemberInfo> members = new HashSet<MemberInfo>(rowType.GetProperties().Cast<MemberInfo>().Where(m => this.IsMapped(m)));
return members.OrderBy(m => m.Name);
}

Expand Down
14 changes: 14 additions & 0 deletions SubSonic.Tests/BugReports/ActiveRecord.cs
Expand Up @@ -4,6 +4,8 @@
using System.Text;
using Xunit;
using SouthWind;
using SubSonic.Tests.Linq.TestBases;
using SubSonic.Linq.Structure;

namespace SubSonic.Tests.BugReports {

Expand Down Expand Up @@ -97,6 +99,18 @@ public void Issue158_GetPaged_With_SortOrder_Should_Not_Expect_Case_Sensitive_Or

Assert.Equal("Seafood", paged[0].CategoryName);
}

[Fact]
public void Issue148_TestMode_Field_Should_Not_Be_Included_In_Query()
{
var value = from employees in Employee.All()
join employeeTerritories in EmployeeTerritory.All() on employees.EmployeeID equals employeeTerritories.EmployeeID
join territories in Territory.All() on employeeTerritories.TerritoryID equals territories.TerritoryID
select territories.Region;


Assert.DoesNotContain("TestMode", (value as Query<Region>).QueryText);
}
}

}
18 changes: 18 additions & 0 deletions SubSonic.Tests/BugReports/Generated/Territory.cs
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SouthWind
{
/// <summary>
/// Added to enable test Issue148_TestMode_Field_Should_Not_Be_Included_In_Query
/// </summary>
public partial class Territory
{
public Region Region
{
get { return Regions.FirstOrDefault(); }
}
}
}
Binary file modified SubSonic.Tests/Migrations/Migrations.db
Binary file not shown.
Binary file modified SubSonic.Tests/Repositories/RepoTests.db
Binary file not shown.
1 change: 1 addition & 0 deletions SubSonic.Tests/SubSonic.Tests.csproj
Expand Up @@ -78,6 +78,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Structs.tt</DependentUpon>
</Compile>
<Compile Include="BugReports\Generated\Territory.cs" />
<Compile Include="BugReports\Linq.cs" />
<Compile Include="BugReports\LinqGeneratorBugs.cs" />
<Compile Include="BugReports\Update.cs" />
Expand Down
Binary file modified SubSonic.Tests/TestClasses/SubSonic.db
Binary file not shown.

0 comments on commit 7101d3d

Please sign in to comment.