Skip to content

Commit

Permalink
Add Scenarios test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzhg committed Dec 15, 2020
1 parent faf5a64 commit 76c833e
Show file tree
Hide file tree
Showing 5 changed files with 1,542 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http;
using System.Text;

namespace Microsoft.AspNetCore.OData.TestCommon
{
public class StringContentWithLength : StringContent
{
public StringContentWithLength(string content)
: base(content)
{
EnsureContentLength();
}

public StringContentWithLength(string content, Encoding encoding)
: base(content, encoding)
{
EnsureContentLength();
}

public StringContentWithLength(string content, Encoding encoding, string mediaType)
: base(content, encoding, mediaType)
{
EnsureContentLength();
}

public StringContentWithLength(string content, string unvalidatedContentType)
: base(content)
{
Headers.TryAddWithoutValidation("Content-Type", unvalidatedContentType);
EnsureContentLength();
}

private void EnsureContentLength()
{
// See: https://github.com/dotnet/aspnetcore/issues/18463
_ = Headers.ContentLength;
}
}
}
15 changes: 0 additions & 15 deletions test/Microsoft.AspNetCore.OData.TestCommon/TestServerUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,6 @@ public static TestServer Create(Action<ODataOptions> setupConfig, params Type[]
return new TestServer(builder);
}

/// <summary>
/// Creates the Test server using the service config and application builder action.
/// </summary>
/// <param name="configureServices">The service config.</param>
/// <param name="configureApp">The application builder.</param>
/// <returns>The created test server.</returns>
public static TestServer Create(Action<IServiceCollection> configureServices, Action<IApplicationBuilder> configureApp)
{
var builder = new WebHostBuilder()
.ConfigureServices(configureServices)
.Configure(configureApp);

return new TestServer(builder);
}

/// <summary>
/// Creates the Test server using the startup class.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,25 @@

using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Microsoft.OData.ModelBuilder;

namespace Microsoft.AspNetCore.OData.Tests.Models
{
public class SimpleOpenCustomer
{
[Key]
public int CustomerId { get; set; }

public string Name { get; set; }

public SimpleOpenAddress Address { get; set; }

public string Website { get; set; }

public List<SimpleOpenOrder> Orders { get; set; }

public IDictionary<string, object> CustomerProperties { get; set; }

public ODataInstanceAnnotationContainer InstanceAnnotations { get; set; }
}
}
Loading

0 comments on commit 76c833e

Please sign in to comment.