-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from MicrosoftEdge/release/8.1.0
Release/8.1.0
- Loading branch information
Showing
9 changed files
with
250 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
test/Qwiq.Integration.Tests/Mapper/AttributeMapperTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Should; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace Microsoft.Qwiq.Mapper | ||
{ | ||
[TestClass] | ||
public class | ||
Given_an_AttributeMapper_with_a_WorkItemStore_DefaultFields_without_TeamProject_and_WorkItemType_specified : | ||
WiqlAttributeMapperContextSpecification | ||
{ | ||
[TestMethod] | ||
[TestCategory("localOnly")] | ||
[TestCategory("REST")] | ||
public void The_work_items_are_mapped_to_their_model() | ||
{ | ||
Bugs.ToList().Count.ShouldEqual(1); | ||
} | ||
|
||
protected override void ConfigureOptions() | ||
{ | ||
WorkItemStore.Configuration.DefaultFields = new[] | ||
{ | ||
//CoreFieldRefNames.TeamProject, | ||
//CoreFieldRefNames.WorkItemType, | ||
CoreFieldRefNames.Id, | ||
CoreFieldRefNames.State | ||
}; | ||
} | ||
} | ||
|
||
[TestClass] | ||
public class | ||
Given_an_AttributeMapper_with_a_WorkItemStore_DefaultFields_without_TeamProject_and_WorkItemType_specified_Eager : | ||
Given_an_AttributeMapper_with_a_WorkItemStore_DefaultFields_without_TeamProject_and_WorkItemType_specified | ||
{ | ||
[TestMethod] | ||
[TestCategory("localOnly")] | ||
[TestCategory("REST")] | ||
[ExpectedException(typeof(InvalidOperationException), "The fields '" + CoreFieldRefNames.TeamProject + "' and '" + CoreFieldRefNames.WorkItemType + "' are required to load the Type property.")] | ||
public new void The_work_items_are_mapped_to_their_model() | ||
{ | ||
Bugs.ToList().Count.ShouldEqual(1); | ||
} | ||
|
||
protected override void ConfigureOptions() | ||
{ | ||
base.ConfigureOptions(); | ||
WorkItemStore.Configuration.LazyLoadingEnabled = false; | ||
} | ||
} | ||
|
||
[TestClass] | ||
public class | ||
Given_an_AttributeMapper_with_a_WorkItemStore_DefaultFields_without_WorkItemType_specified : | ||
WiqlAttributeMapperContextSpecification | ||
{ | ||
[TestMethod] | ||
[TestCategory("localOnly")] | ||
[TestCategory("REST")] | ||
public void The_work_items_are_mapped_to_their_model() | ||
{ | ||
Bugs.ToList().Count.ShouldEqual(1); | ||
} | ||
|
||
protected override void ConfigureOptions() | ||
{ | ||
WorkItemStore.Configuration.DefaultFields = new[] | ||
{ | ||
CoreFieldRefNames.TeamProject, | ||
//CoreFieldRefNames.WorkItemType, | ||
CoreFieldRefNames.Id, | ||
CoreFieldRefNames.State | ||
}; | ||
} | ||
} | ||
[TestClass] | ||
public class | ||
Given_an_AttributeMapper_with_a_WorkItemStore_DefaultFields_without_WorkItemType_specified_Eager : | ||
Given_an_AttributeMapper_with_a_WorkItemStore_DefaultFields_without_WorkItemType_specified | ||
{ | ||
[TestMethod] | ||
[TestCategory("localOnly")] | ||
[TestCategory("REST")] | ||
[ExpectedException(typeof(InvalidOperationException), "The fields '" + CoreFieldRefNames.TeamProject + "' and '" + CoreFieldRefNames.WorkItemType + "' are required to load the Type property.")] | ||
public new void The_work_items_are_mapped_to_their_model() | ||
{ | ||
Bugs.ToList().Count.ShouldEqual(1); | ||
} | ||
|
||
protected override void ConfigureOptions() | ||
{ | ||
base.ConfigureOptions(); | ||
WorkItemStore.Configuration.LazyLoadingEnabled = false; | ||
} | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
test/Qwiq.Integration.Tests/Mapper/WiqlAttributeMapperContextSpecification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using Microsoft.Qwiq.Linq; | ||
using Microsoft.Qwiq.Linq.Visitors; | ||
using Microsoft.Qwiq.Mapper.Attributes; | ||
using Microsoft.Qwiq.Tests.Common; | ||
using System.Linq; | ||
|
||
namespace Microsoft.Qwiq.Mapper | ||
{ | ||
public abstract class WiqlAttributeMapperContextSpecification : TimedContextSpecification | ||
{ | ||
private int[] _ids; | ||
public IQueryable<Bug> Bugs { get; set; } | ||
protected IWorkItemStore WorkItemStore { get; private set; } | ||
private Query<Bug> Query { get; set; } | ||
public override void Cleanup() | ||
{ | ||
WorkItemStore?.Dispose(); | ||
base.Cleanup(); | ||
} | ||
|
||
public override void Given() | ||
{ | ||
base.Given(); | ||
|
||
WorkItemStore = TimedAction(() => IntegrationSettings.CreateRestStore(), "REST", "WIS Create"); | ||
|
||
ConfigureOptions(); | ||
|
||
var pr = new PropertyReflector(); | ||
var pi = new PropertyInspector(pr); | ||
var attMapper = new AttributeMapperStrategy(pi); | ||
var mapper = new WorkItemMapper(new IWorkItemMapperStrategy[] { attMapper }); | ||
var translator = new WiqlTranslator(); | ||
var pe = new PartialEvaluator(); | ||
var qr = new QueryRewriter(); | ||
var wqb = new WiqlQueryBuilder(translator, pe, qr); | ||
var qp = new MapperTeamFoundationServerWorkItemQueryProvider( | ||
WorkItemStore, | ||
wqb, | ||
mapper); | ||
|
||
Query = new Query<Bug>(qp, wqb); | ||
|
||
_ids = new[] | ||
{ | ||
8663955 | ||
}; | ||
} | ||
|
||
public override void When() | ||
{ | ||
Bugs = Query.Where(b => _ids.Contains(b.Id.Value)); | ||
} | ||
|
||
protected abstract void ConfigureOptions(); | ||
[WorkItemType("Bug")] | ||
public class Bug : IIdentifiable<int?> | ||
{ | ||
[FieldDefinition(CoreFieldRefNames.Id, true)] | ||
public int? Id { get; set; } | ||
|
||
[FieldDefinition(CoreFieldRefNames.State)] | ||
public string State { get; set; } | ||
|
||
[FieldDefinition("InvalidField")] | ||
public string Invalid { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.