This repository has been archived by the owner on Dec 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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 #2 from Net-Http-OData/develop
5.0.0
- Loading branch information
Showing
159 changed files
with
6,450 additions
and
3,956 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
96 changes: 96 additions & 0 deletions
96
Net.Http.OData.Tests/Metadata/ServiceDocumentProviderTests.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,96 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Net.Http.OData.Metadata; | ||
using Net.Http.OData.Model; | ||
using Xunit; | ||
|
||
namespace Net.Http.OData.Tests.Metadata | ||
{ | ||
public class ServiceDocumentProviderTests | ||
{ | ||
[Fact] | ||
public void Create_MetadataMinimum() | ||
{ | ||
TestHelper.EnsureEDM(); | ||
|
||
List<ServiceDocumentItem> serviceDocumentItems = ServiceDocumentProvider.Create( | ||
EntityDataModel.Current, | ||
new ODataRequestOptions(new Uri("https://services.odata.org/OData"), ODataIsolationLevel.None, ODataMetadataLevel.Minimal, ODataVersion.OData40, ODataVersion.OData40)) | ||
.ToList(); | ||
|
||
Assert.Equal(6, serviceDocumentItems.Count); | ||
|
||
Assert.Equal("EntitySet", serviceDocumentItems[0].Kind); | ||
Assert.Equal("Categories", serviceDocumentItems[0].Name); | ||
Assert.Equal("Categories", serviceDocumentItems[0].Url.ToString()); | ||
|
||
Assert.Equal("EntitySet", serviceDocumentItems[1].Kind); | ||
Assert.Equal("Customers", serviceDocumentItems[1].Name); | ||
Assert.Equal("Customers", serviceDocumentItems[1].Url.ToString()); | ||
|
||
Assert.Equal("EntitySet", serviceDocumentItems[2].Kind); | ||
Assert.Equal("Employees", serviceDocumentItems[2].Name); | ||
Assert.Equal("Employees", serviceDocumentItems[2].Url.ToString()); | ||
|
||
Assert.Equal("EntitySet", serviceDocumentItems[3].Kind); | ||
Assert.Equal("Managers", serviceDocumentItems[3].Name); | ||
Assert.Equal("Managers", serviceDocumentItems[3].Url.ToString()); | ||
|
||
Assert.Equal("EntitySet", serviceDocumentItems[4].Kind); | ||
Assert.Equal("Orders", serviceDocumentItems[4].Name); | ||
Assert.Equal("Orders", serviceDocumentItems[4].Url.ToString()); | ||
|
||
Assert.Equal("EntitySet", serviceDocumentItems[5].Kind); | ||
Assert.Equal("Products", serviceDocumentItems[5].Name); | ||
Assert.Equal("Products", serviceDocumentItems[5].Url.ToString()); | ||
} | ||
|
||
[Fact] | ||
public void Create_MetadataNone() | ||
{ | ||
TestHelper.EnsureEDM(); | ||
|
||
List<ServiceDocumentItem> serviceDocumentItems = ServiceDocumentProvider.Create( | ||
EntityDataModel.Current, | ||
new ODataRequestOptions(new Uri("https://services.odata.org/OData/"), ODataIsolationLevel.None, ODataMetadataLevel.None, ODataVersion.OData40, ODataVersion.OData40)) | ||
.ToList(); | ||
|
||
Assert.Equal(6, serviceDocumentItems.Count); | ||
|
||
Assert.Equal("EntitySet", serviceDocumentItems[0].Kind); | ||
Assert.Equal("Categories", serviceDocumentItems[0].Name); | ||
Assert.Equal("https://services.odata.org/OData/Categories", serviceDocumentItems[0].Url.ToString()); | ||
|
||
Assert.Equal("EntitySet", serviceDocumentItems[1].Kind); | ||
Assert.Equal("Customers", serviceDocumentItems[1].Name); | ||
Assert.Equal("https://services.odata.org/OData/Customers", serviceDocumentItems[1].Url.ToString()); | ||
|
||
Assert.Equal("EntitySet", serviceDocumentItems[2].Kind); | ||
Assert.Equal("Employees", serviceDocumentItems[2].Name); | ||
Assert.Equal("https://services.odata.org/OData/Employees", serviceDocumentItems[2].Url.ToString()); | ||
|
||
Assert.Equal("EntitySet", serviceDocumentItems[3].Kind); | ||
Assert.Equal("Managers", serviceDocumentItems[3].Name); | ||
Assert.Equal("https://services.odata.org/OData/Managers", serviceDocumentItems[3].Url.ToString()); | ||
|
||
Assert.Equal("EntitySet", serviceDocumentItems[4].Kind); | ||
Assert.Equal("Orders", serviceDocumentItems[4].Name); | ||
Assert.Equal("https://services.odata.org/OData/Orders", serviceDocumentItems[4].Url.ToString()); | ||
|
||
Assert.Equal("EntitySet", serviceDocumentItems[5].Kind); | ||
Assert.Equal("Products", serviceDocumentItems[5].Name); | ||
Assert.Equal("https://services.odata.org/OData/Products", serviceDocumentItems[5].Url.ToString()); | ||
} | ||
|
||
[Fact] | ||
public void Create_Throws_ArgumentNullException_For_Null_EntityDataModel() | ||
=> Assert.Throws<ArgumentNullException>(() => ServiceDocumentProvider.Create( | ||
null, | ||
new ODataRequestOptions(new Uri("https://services.odata.org/OData"), ODataIsolationLevel.None, ODataMetadataLevel.Minimal, ODataVersion.OData40, ODataVersion.OData40))); | ||
|
||
[Fact] | ||
public void Create_Throws_ArgumentNullException_For_Null_ODataRequestOptions() | ||
=> Assert.Throws<ArgumentNullException>(() => ServiceDocumentProvider.Create(EntityDataModel.Current, null)); | ||
} | ||
} |
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
Oops, something went wrong.