ObjectToTest 0.0.9

dotnet add package ObjectToTest --version 0.0.9
                    
NuGet\Install-Package ObjectToTest -Version 0.0.9
                    
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="ObjectToTest" Version="0.0.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ObjectToTest" Version="0.0.9" />
                    
Directory.Packages.props
<PackageReference Include="ObjectToTest" />
                    
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 ObjectToTest --version 0.0.9
                    
#r "nuget: ObjectToTest, 0.0.9"
                    
#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.
#addin nuget:?package=ObjectToTest&version=0.0.9
                    
Install as a Cake Addin
#tool nuget:?package=ObjectToTest&version=0.0.9
                    
Install as a Cake Tool

ObjectToTest

<h3 align="center">

NuGet Stars License Hits-of-Code Lines of Code EO principles respected here PDD status </h3>

The main idea is to implement an extension method for C# objects that generates initialization piece of code depending on an object internal state and public constructors methods and properties. It should let the developer easily recreate an object state and continue using it in unit test environment.

public class Foo
{
  public Foo(IPrice price, IUser user)
  {
    _price = price;
    _user = user;
  }
  
  public void DoSomething(int argument)
  {
    // Some logic
  }
}

Let's say there is a class <b>Foo</b> in a project. It would be really nice to have an extension method which will generate a piece of code that will allow to recreate the same object with the same internal state.

public void SomeMethod(Foo foo)
{
  /*
   * The result of ToUnit method should be a string that contains the peice of code to recreate
   * foo object from the scatch.
   * new Foo(new Price(10), new User("userName"));
   */
   var tests = foo.ToTest();
}

This generated code can be easily insterted into Unit Test.

Object state recreation diagram

The diagram shows an algorithm that an object uses uses to recreate itself with initiated internal state. The interesting thing is that an object can have arguments which are reused in other objects. Such objects are called Shared Arguments.

Alt text

More details about project architecture can be found on wiki page

IL Decompilator

IL Spy nuget package is used to support c# code decompilation

Build status

<div align="center">

Quality Gate Status Coverage Duplicated Lines (%) Maintainability Rating </div>

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 was computed.  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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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.0.9 1,171 2/22/2023
0.0.8 293 12/23/2022
0.0.7 305 12/14/2022
0.0.6 337 12/5/2022
0.0.5 327 11/24/2022
0.0.4 321 11/23/2022
0.0.3 368 11/10/2022
0.0.2 339 11/8/2022
0.0.1 382 9/27/2022