Kimono.Extensions.DependencyInjection 0.1.1

dotnet add package Kimono.Extensions.DependencyInjection --version 0.1.1
                    
NuGet\Install-Package Kimono.Extensions.DependencyInjection -Version 0.1.1
                    
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="Kimono.Extensions.DependencyInjection" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kimono.Extensions.DependencyInjection" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Kimono.Extensions.DependencyInjection" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Kimono.Extensions.DependencyInjection --version 0.1.1
                    
#r "nuget: Kimono.Extensions.DependencyInjection, 0.1.1"
                    
#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.
#:package Kimono.Extensions.DependencyInjection@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Kimono.Extensions.DependencyInjection&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Kimono.Extensions.DependencyInjection&version=0.1.1
                    
Install as a Cake Tool

Overmock

DOTNET Build

Overmock is a mocking framework in development that allows for creating dynamic proxies that monitor and control expected behavior when writing unit tests. Here are some examples below.

The current goal is refactoring out the dynamic proxy creation into it's own class library to be used by the testing framework.

[TestClass]
public class ExampleTestsForReadMe
{
    public class Model
    {
        public int Id { get; set; }
    }
    public interface IRepository
    {
        bool Save(Model model);
    }
    public interface ILog
    {
        void Log(string message);
    }
    public class Service
    {
        private readonly ILog _log;
        private readonly IRepository _repo;
        public Service(ILog log, IRepository repo)
        {
            _log = log;
            _repo = repo;
        }
        public Model SaveModel(Model model)
        {
            try
            {
                var saved = _repo.Save(model);
                if (!saved)
                {
                    _log.Log("Failed to save");
                }
                return model;
            }
            catch (Exception ex)
            {
                _log.Log(ex.Message);
                throw;
            }
        }
    }

    [TestMethod]
    public void CallsSaveTest()
    {
        var id = 22;
        var wasSaved = false;
        var log = Overmock.AnyInvocation<ILog>();
        var repository = Overmock.Mock<IRepository>()
            .Mock(r => r.Save(Its.Any<Model>()))
            .ToCall(c => {
                wasSaved = true;
                return c.Get<Model>("model")?.Id == id;
            }, Times.Once);

        var service = new Service(log, repository.Target);
        service.SaveModel(new Model { Id = id });

        Assert.IsTrue(wasSaved);
    }

    [TestMethod]
    public void ThrowsExceptionWhenSaveFailsTest()
    {
        var expected = "Failed to save";
        var log = Overmock.AnyInvocation<ILog>();
        var repository = Overmock.Mock<IRepository>();
        Overmock.Mock(repository, r => r.Save(Its.Any<Model>()))
            .ToThrow(new Exception(expected));

        var service = new Service(log, repository.Target);

        try
        {
            service.SaveModel(new Model());

            Assert.Fail("SaveModel Failed to throw an exception.");
        }
        catch (Exception actual)
        {
            Assert.AreEqual(expected, actual.Message);
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in 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.1.1 168 8/15/2024
0.1.0 154 8/9/2024
0.0.12 170 3/27/2024
0.0.11-RC01 241 10/16/2023
0.0.10 161 10/11/2023
0.0.9 164 9/17/2023
0.0.9-RD01 144 8/28/2023
0.0.9-RC03 139 9/15/2023
0.0.9-RC02 147 8/30/2023
0.0.8 190 8/27/2023
0.0.7 197 8/27/2023
0.0.7-RC05 115 8/25/2023
0.0.7-RC04 109 8/24/2023
0.0.7-RC03 136 8/22/2023
0.0.7-RC02 142 8/19/2023
0.0.7-RC01 138 8/16/2023
0.0.6 205 8/15/2023
0.0.6-RC01 137 8/14/2023
0.0.5 182 8/14/2023
0.0.4 202 8/13/2023
0.0.3 193 8/13/2023
0.0.1 182 8/13/2023
0.0.1-RC03 173 8/13/2023
0.0.1-RC02 171 8/13/2023
0.0.1-RC01 174 8/11/2023

This is a first release and is meant for internal usages until further notice.