lynMarkdigRenderTest72 1.0.0

dotnet add package lynMarkdigRenderTest72 --version 1.0.0                
NuGet\Install-Package lynMarkdigRenderTest72 -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="lynMarkdigRenderTest72" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add lynMarkdigRenderTest72 --version 1.0.0                
#r "nuget: lynMarkdigRenderTest72, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install lynMarkdigRenderTest72 as a Cake Addin
#addin nuget:?package=lynMarkdigRenderTest72&version=1.0.0

// Install lynMarkdigRenderTest72 as a Cake Tool
#tool nuget:?package=lynMarkdigRenderTest72&version=1.0.0                

Eml.Mediator

A. Usage - Command

    [Test]
    public async Task Command_ShouldBeCalledOnce()
    {
        var command = new TestCommandAsync();			//<-Data

        await mediator.ExecuteAsync(command);           //<-Execute

        command.EngineInvocationCount.ShouldBe(1);
    }

1. Create a command class.

TestCommandAsync contains the needed data for the CommandEngine.

    public class TestCommandAsync : ICommandAsync
    {
        public int EngineInvocationCount { get; set; }

        public TestCommandAsync()
        {
            EngineInvocationCount = 0;
        }
    }

2. Create a command engine.

TestCommandEngine will be auto-discovered and executed by await command.ExecuteAsync();.

    [PartCreationPolicy(CreationPolicy.NonShared)]
    public class TestCommandEngine : ICommandAsyncEngine<TestCommandAsync>
    {
        public async Task ExecuteAsync(TestCommandAsync commandAsync)
        {
            await Task.Run(() => commandAsync.EngineInvocationCount++);
        }
    }

B. Usage - Request-Response

    [Test]
    public async Task Response_ShouldReturnCorrectValue()
    {
        var request = new TestRequestAsync(Guid.NewGuid());     //<-Data

        var response = await mediator.GetAsync(request);        //<-Execute

        response.ResponseToRequestId.ShouldBe(request.Id);      //<-Return Value
    }

1. Create a Request class.

TestRequestAsync contains the needed data for the RequestEngine.

    public class TestRequestAsync : IRequestAsync<TestRequestAsync, TestResponse>
    {
        public Guid Id { get; }                                 //<-Data

        public TestRequestAsync(Guid id)
        {
            Id = id;
        }
    }

2. Create a Response class.

TestResponse is the return value of RequestEngine.

    public class TestResponse : IResponse
    {
        public Guid ResponseToRequestId { get; }                //<-Return Value

        public TestResponse(Guid responseToRequestId)
        {
            ResponseToRequestId = responseToRequestId;
        }
    }

3. Create a Request engine.

TestRequestEngine will be auto-discovered and executed by await mediator.GetAsync(request);.

  • For NetFramework
    [PartCreationPolicy(CreationPolicy.NonShared)]
    public class TestRequestEngine : IRequestAsyncEngine<TestRequestAsync, TestResponse>
    {
        public async Task<TestResponse> GetAsync(TestRequestAsync request)  //<-Execute
        {
            return await Task.Run(() => new TestResponse(request.Id));
        }
    }
  • For NetCore2.2 (no need to place CreationPolicy.NonShared attribute)
    public class TestRequestEngine : IRequestAsyncEngine<TestRequestAsync, TestResponse>
    {
        public async Task<TestResponse> GetAsync(TestRequestAsync request)  //<-Execute
        {
            return await Task.Run(() => new TestResponse(request.Id));
        }
    }

That's it.

Check out EmlExtensions.vsix to automate the above process in one go.

alternate text is missing from this package README image

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 0 11/24/2020