Typo in Tutorial pages; removed unused parameter from IMethodStubber.SubMethod.
This commit is contained in:
Родитель
e934be1c66
Коммит
864a0eefb1
|
@ -168,7 +168,7 @@ stub.GetContactPhoneNumber((p1, p2) => 11122233, overwrite:true);
|
|||
|
||||
## Default behaviors
|
||||
|
||||
In the default ```MockBehavior.Stict``` mode, stubs that are called before their behaviors have been set will throw an exception. This can be changed—so that uninitialized stubs will return ```null``` or a default value—by using ```MockBehavior.Loose```:
|
||||
In the default ```MockBehavior.Strict``` mode, stubs that are called before their behaviors have been set will throw an exception. This can be changed—so that uninitialized stubs will return ```null``` or a default value—by using ```MockBehavior.Loose```:
|
||||
|
||||
```csharp
|
||||
var stub = new StubIPhoneBook()
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Etg.SimpleStubs.CodeGen
|
|||
/// </summary>
|
||||
internal class EventStubber : IMethodStubber
|
||||
{
|
||||
public ClassDeclarationSyntax StubMethod(CompilationUnitSyntax cu, ClassDeclarationSyntax classDclr, IMethodSymbol methodSymbol, INamedTypeSymbol stubbedInterface, SemanticModel semanticModel)
|
||||
public ClassDeclarationSyntax StubMethod(ClassDeclarationSyntax classDclr, IMethodSymbol methodSymbol, INamedTypeSymbol stubbedInterface, SemanticModel semanticModel)
|
||||
{
|
||||
// only handle EventAdd and ignore EventRemove because we only need to stub the event once
|
||||
if (!methodSymbol.IsEventAdd())
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
namespace Etg.SimpleStubs.CodeGen
|
||||
{
|
||||
internal interface IMethodStubber
|
||||
{
|
||||
ClassDeclarationSyntax StubMethod(CompilationUnitSyntax cu, ClassDeclarationSyntax classDclr, IMethodSymbol methodSymbol, INamedTypeSymbol stubbedInterface, SemanticModel semanticModel);
|
||||
ClassDeclarationSyntax StubMethod(ClassDeclarationSyntax classDclr, IMethodSymbol methodSymbol, INamedTypeSymbol stubbedInterface, SemanticModel semanticModel);
|
||||
}
|
||||
}
|
|
@ -70,7 +70,7 @@ namespace Etg.SimpleStubs.CodeGen
|
|||
foreach (IMethodStubber methodStubber in _methodStubbers)
|
||||
{
|
||||
|
||||
classDclr = methodStubber.StubMethod(cu, classDclr, methodSymbol, interfaceType, semanticModel);
|
||||
classDclr = methodStubber.StubMethod(classDclr, methodSymbol, interfaceType, semanticModel);
|
||||
}
|
||||
}
|
||||
return classDclr;
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Etg.SimpleStubs.CodeGen
|
|||
{
|
||||
internal class OrdinaryMethodStubber : IMethodStubber
|
||||
{
|
||||
public ClassDeclarationSyntax StubMethod(CompilationUnitSyntax cu, ClassDeclarationSyntax classDclr, IMethodSymbol methodSymbol, INamedTypeSymbol stubbedInterface, SemanticModel semanticModel)
|
||||
public ClassDeclarationSyntax StubMethod(ClassDeclarationSyntax classDclr, IMethodSymbol methodSymbol, INamedTypeSymbol stubbedInterface, SemanticModel semanticModel)
|
||||
{
|
||||
if (!methodSymbol.IsOrdinaryMethod())
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Etg.SimpleStubs.CodeGen
|
|||
|
||||
internal class StubbingDelegateGenerator : IMethodStubber
|
||||
{
|
||||
public ClassDeclarationSyntax StubMethod(CompilationUnitSyntax cu, ClassDeclarationSyntax classDclr, IMethodSymbol methodSymbol, INamedTypeSymbol stubbedInterface, SemanticModel semanticModel)
|
||||
public ClassDeclarationSyntax StubMethod(ClassDeclarationSyntax classDclr, IMethodSymbol methodSymbol, INamedTypeSymbol stubbedInterface, SemanticModel semanticModel)
|
||||
{
|
||||
if (methodSymbol.IsPropertyAccessor() || methodSymbol.IsOrdinaryMethod())
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче