-
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.
- Loading branch information
1 parent
94458e6
commit 935bce8
Showing
10 changed files
with
195 additions
and
115 deletions.
There are no files selected for viewing
File renamed without changes.
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
29 changes: 29 additions & 0 deletions
29
.../Baselines/MainTests/ReturningMethod/Pretender_Creates_PretendISimpleInterface8199A3_g.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,29 @@ | ||
namespace System.Runtime.CompilerServices | ||
{ | ||
using System; | ||
using System.CodeDom.Compiler; | ||
|
||
[GeneratedCode("Pretender.SourceGenerator", "1.0.0.0")] | ||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] | ||
file sealed class InterceptsLocationAttribute : Attribute | ||
{ | ||
public InterceptsLocationAttribute(string filePath, int line, int column) | ||
{ | ||
} | ||
} | ||
} | ||
|
||
namespace Pretender.SourceGeneration | ||
{ | ||
using System.Runtime.CompilerServices; | ||
using Pretender; | ||
|
||
file static class CreateInterceptors | ||
{ | ||
[InterceptsLocation("MyTest.cs", 16, 38)] | ||
internal static global::ISimpleInterface Create0(this Pretend<global::ISimpleInterface> pretend) | ||
{ | ||
return new PretendISimpleInterface8199A3(pretend); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
test/SourceGeneratorTests/Baselines/MainTests/ReturningMethod/Pretender_Setups_g.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,36 @@ | ||
namespace System.Runtime.CompilerServices | ||
{ | ||
using System; | ||
using System.CodeDom.Compiler; | ||
|
||
[GeneratedCode("Pretender.SourceGenerator", "1.0.0.0")] | ||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] | ||
file sealed class InterceptsLocationAttribute : Attribute | ||
{ | ||
public InterceptsLocationAttribute(string filePath, int line, int column) | ||
{ | ||
} | ||
} | ||
} | ||
|
||
namespace Pretender.SourceGeneration | ||
{ | ||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Linq.Expressions; | ||
using System.Threading.Tasks; | ||
using Pretender; | ||
using Pretender.Internals; | ||
|
||
file static class SetupInterceptors | ||
{ | ||
[InterceptsLocation("MyTest.cs", 13, 6)] | ||
internal static IPretendSetup<global::ISimpleInterface, string> Setup0(this Pretend<global::ISimpleInterface> pretend, Func<global::ISimpleInterface, string> setupExpression) | ||
{ | ||
return pretend.GetOrCreateSetup<string>(0, static (pretend, expr) => | ||
{ | ||
return new ReturningCompiledSetup<global::ISimpleInterface, string>(pretend, PretendISimpleInterface8199A3.MethodInfo_get_Bar_3685A65, matcher: Cache.NoOpMatcher, expr.Target, defaultValue: default); | ||
}, setupExpression); | ||
} | ||
} | ||
} |
77 changes: 0 additions & 77 deletions
77
...aselines/MainTests/ReturningMethod/Pretender_Type_PretendISimpleInterface2AADE68_g_cs.txt
This file was deleted.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
...sts/Baselines/MainTests/ReturningMethod/Pretender_Type_PretendISimpleInterface8199A3_g.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,84 @@ | ||
// <auto-generated/> | ||
#nullable enable | ||
/// <inheritdoc/> | ||
namespace Pretender.SourceGeneration | ||
{ | ||
using System.Reflection; | ||
using Pretender; | ||
|
||
/// <inheritdoc/> | ||
internal class PretendISimpleInterface8199A3 : global::ISimpleInterface | ||
{ | ||
public static readonly MethodInfo MethodInfo_Foo_3EB6F56 = typeof(global::ISimpleInterface).GetMethod(nameof(Foo))!; | ||
public static readonly MethodInfo MethodInfo_VoidMethod_4CB5F7 = typeof(global::ISimpleInterface).GetMethod(nameof(VoidMethod))!; | ||
public static readonly MethodInfo MethodInfo_AsyncMethod_3177B39 = typeof(global::ISimpleInterface).GetMethod(nameof(AsyncMethod))!; | ||
public static readonly MethodInfo MethodInfo_AsyncReturningMethod_35E1C1E = typeof(global::ISimpleInterface).GetMethod(nameof(AsyncReturningMethod))!; | ||
public static readonly MethodInfo MethodInfo_TryParse_3859BF9 = typeof(global::ISimpleInterface).GetMethod(nameof(TryParse))!; | ||
public static readonly MethodInfo MethodInfo_get_Bar_3685A65 = typeof(global::ISimpleInterface).GetProperty(nameof(Bar)).GetMethod!; | ||
public static readonly MethodInfo MethodInfo_set_Bar_2D53694 = typeof(global::ISimpleInterface).GetProperty(nameof(Bar)).SetMethod!; | ||
private readonly Pretend<global::ISimpleInterface> _pretend; | ||
/// <inheritdoc/> | ||
public PretendISimpleInterface8199A3(Pretend<global::ISimpleInterface> pretend) | ||
{ | ||
_pretend = pretend; | ||
} | ||
|
||
public string? Foo(string? bar, int baz) | ||
{ | ||
object? [] __arguments = [bar, baz]; | ||
var __callInfo = new CallInfo(MethodInfo_Foo_3EB6F56, __arguments); | ||
_pretend.Handle(__callInfo); | ||
return (string? )__callInfo.ReturnValue; | ||
} | ||
|
||
public void VoidMethod(bool baz) | ||
{ | ||
object? [] __arguments = [baz]; | ||
var __callInfo = new CallInfo(MethodInfo_VoidMethod_4CB5F7, __arguments); | ||
_pretend.Handle(__callInfo); | ||
} | ||
|
||
public global::System.Threading.Tasks.Task AsyncMethod() | ||
{ | ||
object? [] __arguments = []; | ||
var __callInfo = new CallInfo(MethodInfo_AsyncMethod_3177B39, __arguments); | ||
_pretend.Handle(__callInfo); | ||
return (global::System.Threading.Tasks.Task)__callInfo.ReturnValue; | ||
} | ||
|
||
public global::System.Threading.Tasks.Task<string> AsyncReturningMethod(string bar) | ||
{ | ||
object? [] __arguments = [bar]; | ||
var __callInfo = new CallInfo(MethodInfo_AsyncReturningMethod_35E1C1E, __arguments); | ||
_pretend.Handle(__callInfo); | ||
return (global::System.Threading.Tasks.Task<string>)__callInfo.ReturnValue; | ||
} | ||
|
||
public bool TryParse(string thing, out bool myValue) | ||
{ | ||
object? [] __arguments = [thing, myValue]; | ||
var __callInfo = new CallInfo(MethodInfo_TryParse_3859BF9, __arguments); | ||
_pretend.Handle(__callInfo); | ||
myValue = __arguments[1]; | ||
return (bool)__callInfo.ReturnValue; | ||
} | ||
|
||
public string Bar | ||
{ | ||
get | ||
{ | ||
object? [] __arguments = []; | ||
var __callInfo = new CallInfo(MethodInfo_get_Bar_3685A65, __arguments); | ||
_pretend.Handle(__callInfo); | ||
return (string)__callInfo.ReturnValue; | ||
} | ||
|
||
set | ||
{ | ||
object? [] __arguments = [value]; | ||
var __callInfo = new CallInfo(MethodInfo_set_Bar_2D53694, __arguments); | ||
_pretend.Handle(__callInfo); | ||
} | ||
} | ||
} | ||
} |
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.