Skip to content

Commit 7588b31

Browse files
committed
WIP
1 parent 89d94d9 commit 7588b31

File tree

3 files changed

+43
-44
lines changed

3 files changed

+43
-44
lines changed

src/NSwag.CodeGeneration.CSharp.Tests/CSharpCompiler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ static CSharpCompiler()
2323
.Append(MetadataReference.CreateFromFile(typeof(System.Runtime.Serialization.EnumMemberAttribute).Assembly.Location))
2424
.Append(MetadataReference.CreateFromFile(typeof(System.Text.Json.Serialization.JsonConverter).Assembly.Location))
2525
.Append(MetadataReference.CreateFromFile(typeof(Microsoft.Extensions.Primitives.StringValues).Assembly.Location))
26+
.Append(MetadataReference.CreateFromFile(typeof(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo).Assembly.Location))
2627
.ToList();
2728
}
2829

src/NSwag.CodeGeneration.CSharp.Tests/ControllerGenerationFormatTests.cs

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -519,48 +519,47 @@ public async Task When_controller_has_operation_with_header_parameter_then_parti
519519
// Assert
520520
await VerifyHelper.Verify(code);
521521

522-
// error CS0656: Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create']
523-
//// CSharpCompiler.AssertCompile(code + @"
524-
////namespace System.Web.Http
525-
////{
526-
//// public class ApiController { }
527-
//// public abstract class ParameterBindingAttribute : global::System.Attribute
528-
//// {
529-
//// public abstract System.Web.Http.Controllers.HttpParameterBinding GetBinding(global::System.Web.Http.Controllers.HttpParameterDescriptor parameter);
530-
//// }
531-
//// public class HttpGet : global::System.Attribute { }
532-
//// public class HttpPost : global::System.Attribute { }
533-
//// public class FromUri : global::System.Attribute { }
534-
//// public class FromBody : global::System.Attribute { }
535-
//// public class Route : global::System.Attribute
536-
//// {
537-
//// public Route(string template) { }
538-
//// }
539-
////}
540-
////namespace System.Web.Http.Controllers
541-
////{
542-
//// public abstract class HttpParameterBinding
543-
//// {
544-
//// protected HttpParameterBinding(global::System.Web.Http.Controllers.HttpParameterDescriptor parameter) { }
545-
//// public dynamic ActionArguments { get; }
546-
//// public dynamic Descriptor { get; }
547-
//// public abstract System.Threading.Tasks.Task ExecuteBindingAsync(global::System.Web.Http.Metadata.ModelMetadataProvider metadataProvider, global::System.Web.Http.Controllers.HttpActionContext actionContext, global::System.Threading.CancellationToken cancellationToken);
548-
//// }
549-
//// public abstract class HttpParameterDescriptor
550-
//// {
551-
//// public string ParameterName { get; }
552-
//// public dynamic ActionArguments { get; }
553-
//// }
554-
//// public abstract class HttpActionContext
555-
//// {
556-
//// public dynamic ActionArguments { get; }
557-
//// public dynamic Request { get; }
558-
//// }
559-
////}
560-
////namespace System.Web.Http.Metadata
561-
////{
562-
//// public abstract class ModelMetadataProvider { }
563-
////}");
522+
CSharpCompiler.AssertCompile(code + @"
523+
namespace System.Web.Http
524+
{
525+
public class ApiController { }
526+
public abstract class ParameterBindingAttribute : global::System.Attribute
527+
{
528+
public abstract System.Web.Http.Controllers.HttpParameterBinding GetBinding(global::System.Web.Http.Controllers.HttpParameterDescriptor parameter);
529+
}
530+
public class HttpGet : global::System.Attribute { }
531+
public class HttpPost : global::System.Attribute { }
532+
public class FromUri : global::System.Attribute { }
533+
public class FromBody : global::System.Attribute { }
534+
public class Route : global::System.Attribute
535+
{
536+
public Route(string template) { }
537+
}
538+
}
539+
namespace System.Web.Http.Controllers
540+
{
541+
public abstract class HttpParameterBinding
542+
{
543+
protected HttpParameterBinding(global::System.Web.Http.Controllers.HttpParameterDescriptor parameter) { }
544+
public dynamic ActionArguments { get; }
545+
public dynamic Descriptor { get; }
546+
public abstract System.Threading.Tasks.Task ExecuteBindingAsync(global::System.Web.Http.Metadata.ModelMetadataProvider metadataProvider, global::System.Web.Http.Controllers.HttpActionContext actionContext, global::System.Threading.CancellationToken cancellationToken);
547+
}
548+
public abstract class HttpParameterDescriptor
549+
{
550+
public string ParameterName { get; }
551+
public dynamic ActionArguments { get; }
552+
}
553+
public abstract class HttpActionContext
554+
{
555+
public dynamic ActionArguments { get; }
556+
public dynamic Request { get; }
557+
}
558+
}
559+
namespace System.Web.Http.Metadata
560+
{
561+
public abstract class ModelMetadataProvider { }
562+
}");
564563
}
565564
}
566565
}

src/NSwag.CodeGeneration.CSharp.Tests/RequiredParameterTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ public async Task When_setting_is_enabled_properties_with_required_keyword_shoul
6767

6868
// Assert
6969
await VerifyHelper.Verify(code);
70-
// (143,17): error CS0656: Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'
71-
////CSharpCompiler.AssertCompile(code);
70+
CSharpCompiler.AssertCompile(code);
7271
}
7372

7473
[Fact]

0 commit comments

Comments
 (0)