-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
migrate odata client tests to xUnit #1759
migrate odata client tests to xUnit #1759
Conversation
800d9b6
to
e95fef9
Compare
b55c943
to
162362e
Compare
162362e
to
9790cf2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rebase to latest master, make build pass and merge with squash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non blockers but worth reviewing
@@ -105,7 +105,7 @@ public async Task SaveChangesTest() | |||
customers.Add(c2); | |||
|
|||
var dataServiceResponse = await context.SaveChangesAsync(SaveChangesOptions.BatchWithIndependentOperations | SaveChangesOptions.UseRelativeUri); | |||
Assert.Equal((dataServiceResponse.First() as ChangeOperationResponse).StatusCode, 201); | |||
Assert.Equal(201, (dataServiceResponse.First() as ChangeOperationResponse).StatusCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're here, you might want to use the HttpStatusCode
Enum, for readability
https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode
#else | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
#endif | ||
#if !PORTABLELIB && !SILVERLIGHT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible to remove these portablelib silverlight references while you are doing this?
Assert.AreEqual(string.Format("{0}.AddressType", TestModelNameSpace), annotationOnHomeAddress.Name); | ||
Assert.AreEqual("Home", (annotationOnHomeAddress.Value as ODataPrimitiveValue).Value); | ||
Assert.Equal(string.Format("{0}.AddressType", TestModelNameSpace), annotationOnHomeAddress.Name); | ||
Assert.Equal("Home", (annotationOnHomeAddress.Value as ODataPrimitiveValue).Value); | ||
|
||
// TODO : Fix #625 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you check on this issue and probably close if it's been resolved?
...dToEndTests/Tests/Client/Build.Desktop/BatchRequestTests/BatchRequestWithRelativeUriTests.cs
Show resolved
Hide resolved
test/EndToEndTests/Tests/Client/Build.Desktop/ClientTests/ClientUpdateTests.cs
Show resolved
Hide resolved
test/EndToEndTests/Tests/Client/Build.Desktop/ClientTests/ClientUpdateTests.cs
Show resolved
Hide resolved
public void ServiceOperationFeedQuery() | ||
{ | ||
var contextWrapper = this.CreateContext(); | ||
var queryResult = contextWrapper.Execute<Customer>(new Uri(this.ServiceUri.OriginalString + "/GetSpecificCustomer?Name='enumeratetrademarkexecutionbrfalsenesteddupoverflowspacebarseekietfbeforeobservedstart'"), "GET", true).ToArray(); | ||
Assert.AreEqual(1, queryResult.Count(), "Expected a single Customer return"); | ||
Assert.Equal(1, queryResult.Count()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assert.Equal(1, queryResult.Count()); | |
Assert.Single(queryResult); | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xunit recommends the use of Single for a collection with a count of 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that what this is? Or does it have to be a List (with a .Count
prop) as opposed to just an IEnumerable
?
} | ||
} | ||
} | ||
|
||
private static void AssertODataCollectionValueAreEqual(ODataCollectionValue expectedCollectionValue, ODataCollectionValue actualCollectionValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to change Method name also (doesnt harm though)? I guess you would have done a Cntrl+H ?
14d8b45
to
2828009
Compare
Issues
This pull request fixes issue #xxx.
Description
Briefly describe the changes of this pull request.
Checklist (Uncheck if it is not completed)
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.