Flaeng.Productivity 0.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Flaeng.Productivity --version 0.1.2
NuGet\Install-Package Flaeng.Productivity -Version 0.1.2
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="Flaeng.Productivity" Version="0.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Flaeng.Productivity --version 0.1.2
#r "nuget: Flaeng.Productivity, 0.1.2"
#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 Flaeng.Productivity as a Cake Addin
#addin nuget:?package=Flaeng.Productivity&version=0.1.2

// Install Flaeng.Productivity as a Cake Tool
#tool nuget:?package=Flaeng.Productivity&version=0.1.2

Flaeng.Productivity

Maintainability

CodeFactor

What does it do?

GenerateInterfaceAttribute generates a interface with all the public properties, fields and methods in your class so you don't have to keep it up-to-date but only need to change your test code.

InjectAttribute generates a constructor for the declaring class with parameters for every property or field with the InjectAttribute in the order they are defined in the class.

Examples

Example 1: Input

using Flaeng.Productivity.DependencyInjection;

namespace Flaeng.Productivity.Sample.Providers;

[GenerateInterface]
public partial class SummaryProvider
{
    public string[] GetSummaries()
    {
        return new[]
        {
            "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
        };
    }
}

Example 1: Output

// <auto-generated/>

using Flaeng.Productivity.DependencyInjection;

#nullable enable

namespace Flaeng.Productivity.Sample.Providers
{
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Flaeng.Productivity", "0.1.1.0")]
    public interface ISummaryProvider
    {
        string[] GetSummaries();
    }
    public partial class SummaryProvider : ISummaryProvider
    {
    }
}

Example 2: Input

using Flaeng.Productivity.DependencyInjection;
using Flaeng.Productivity.Sample.Providers;

namespace Flaeng.Productivity.Sample.Services;

[GenerateInterface]
public partial class WeatherForecastService
{
    [Inject] protected readonly ISummaryProvider _summaryProvider;

    public IEnumerable<WeatherForecast> GetWeatherForecast()
    {
        var Summaries = _summaryProvider.GetSummaries();
        return Enumerable.Range(1, 5).Select(index => new WeatherForecast
        {
            TemperatureC = Random.Shared.Next(-20, 55),
            Summary = Summaries[Random.Shared.Next(Summaries.Length)]
        })
        .ToArray();
    }
}

Example 2: Output

// <auto-generated/>

using Flaeng.Productivity.DependencyInjection;
using Flaeng.Productivity.Sample.Providers;

#nullable enable

namespace Flaeng.Productivity.Sample.Services
{
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Flaeng.Productivity", "0.1.1.0")]
    public interface IWeatherForecastService
    {
        IEnumerable<WeatherForecast> GetWeatherForecast();
    }
    public partial class WeatherForecastService : IWeatherForecastService
    {
    }
}

// <auto-generated/>

using Flaeng.Productivity.DependencyInjection;
using Flaeng.Productivity.Sample.Providers;

#nullable enable

namespace Flaeng.Productivity.Sample.Services
{
    public partial class WeatherForecastService
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Flaeng.Productivity", "0.1.1.0")]
        public WeatherForecastService(
            ISummaryProvider _summaryProvider
            )
        {
            this._summaryProvider = _summaryProvider;
        }
    }
}
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

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
0.3.2 214 8/5/2023
0.3.1 206 8/2/2023
0.3.0 161 7/30/2023
0.3.0-rc.3 73 7/30/2023
0.3.0-rc.2 57 7/14/2023
0.3.0-rc.1 72 7/14/2023
0.2.3 232 3/8/2023
0.2.2 248 3/5/2023
0.2.1 260 3/5/2023
0.2.0 258 3/4/2023
0.1.3 265 3/4/2023
0.1.2 234 3/4/2023
0.1.1 216 3/3/2023
0.1.0 217 3/2/2023