AUT.TestProjects.GenerationVersion2 1.3.2

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

// Install AUT.TestProjects.GenerationVersion2 as a Cake Tool
#tool nuget:?package=AUT.TestProjects.GenerationVersion2&version=1.3.2

Introduction

This package contains generic helper method to configure any project. It doesn't contain any business logic.

AUT.TestProjects.GenerationVersion2

The next generation version of AUT Configure test projects. It will be used in future.

This package is specially designed to configure Generator(v0.2.4 above) Automatic Unit Tests. Still this package doesn't contain any business logic but generic method to create any kind of object regardless the business structure.

This package is downgraded (.NET4.5.2) and used specific versions (NUNit, Shouldly, Moq) that new test project usages.

Release Notes

  • Initial release from existing version.
  • Removed Generic Test case attribute.
  • Converted project to .NET 4.5.2
  • Removed unused methods.
  • Restructured codebase.
  • Fixture recursion level defined to 6.
  • Nunit 3.10.1

Code Examples

Few sample code examples to use it in the bootstrapping.

Class Inherit Example

 [TestFixture]
 public class GenericTestClass : AbstractBaseSetupV1Test
 {
    // Initialize basic stuff in the base class.
    public GenericTestClass() : base(type(ObjectTypeTesting))
    {}

    [Test]
    public void TestMethodExample()
    {
        // Arrange
        var anyType = this.CreateType<Type>();
        var testingClassInstance = this.Create();

        // Act
        ... Acting stuff.

        // Assert
        anyType.ShouldNotBeNull();
        testingClassInstance.ShouldNotBeNull();
    }
 }

Explore function

Explore existing methods in the AbstractBaseSetupV2Test Extensions var methodInfo = this.GetMethodInfo("PrivateMethodName", defaultIndex: 0); // Provide overloading index if has any overloading. this.ExploreMethodDynamically(methodInfo); // Explore private mehtods.

Abstract Class Create Example

var exampleInstance = this.Create(); // inside AbstractBaseSetupV1Test class

Create Example from Base Class

var employee = CreateAnalyzer.CreateAbstractClass<AbstractEmployee>(typeof(EmployeeImpl), GenericTestClass.Fixture);

Get MethodInfo without throwing exception

var methodInfo1 = ReflectionAnalyzer.GetMethodInfo(typeof(T), "AnyMethodName"); // only if there is no overloading, no exception if any. Returns first one.
var methodInfo2 = ReflectionAnalyzer.GetMethodInfo(typeof(T), "AnyMethodName", new Type[] { typeof(MethodParameterType1) }); // Returns specific one by matching the parameters.

Reflection Instance Member Extensions Example MemberInfoExtension.cs

var value1 = memberInfo.GetValue(instance, Fixture); // get the value if property, field or method (by invoking it).
var value2 = memberInfo.GetValueWithoutParameters(instance); // get the value if property, field or method (by invoking it, assuming method doesn't have parameters).
var fieldInfo = memberInfo.ToField(); // get `FieldInfo` if it is or null.
var methodInfo = memberInfo.ToMethod(); // get `MethodInfo` if it is or null.
var propertyInfo = memberInfo.ToProperty(); // get `PropertyInfo` if it is or null.

Extensions Example of MethodInfoExtension.cs

var value1 = memberInfo.GetResultMethodInfo<TReturnData>(instance, out _, parameters); // invoke method and get typed result. And suppress exception.
var value2 = memberInfo.GetResultMethodInfo<TReturnData>(instance, parameters); // invoke method and get typed result. And suppress exception.
var value3 = memberInfo.GetResultOfStaticMethodInfo<TReturnData>(parameters); // invoke method and get typed result. And suppress exception.
var value3 = memberInfo.GetResultOfMethodInfoAsObject(parameters); // invoke method and get object result. And suppress exception.
var value3 = memberInfo.GetResultOfMethodInfoAsObjectWithParametersCreatedIfHasAny(instance, fixture); // Create parameters dynamically if has any and then invoke then method.
var doesThrow = memberInfo.DoesInvokeThrow<T>(instance, parameters); // returns true / false based on exception thrown.
var exception = memberInfo.GetThrownException(instance, parameters); // get thrown exception

Example of CreateAnalyzer.cs

var value1 = CreateAnalyzer.CreateType(fixture, type, out _, parameters = null); // try to create the object in different paths. With new(), with fixture, with constuctor (by creating all constuctor parameters using fixture)
var value2 = CreateAnalyzer.ReturnStaticSingletonInstance<T>(fixture); // get the actual singleton type.
var value3 = CreateAnalyzer.Create<T>(fixture, out _, useFixtureAtFirst, [parameters]); // try to create the object in different paths. With new(), with fixture, with constuctor (by creating all constuctor parameters using fixture)
var value3 = CreateAnalyzer.CreateAbstractClass<AbstractEmployee>(typeof(EmployeeImpl), GenericTestClass.Fixture); // create a abstract class from a list of child classes type.
Product Compatible and additional computed target framework versions.
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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
2.1.0 1,039 10/24/2018
2.0.0 836 10/24/2018
1.5.6 885 10/16/2018
1.5.5 846 10/16/2018
1.5.4 2,045 10/4/2018
1.5.2 858 10/4/2018
1.5.1 862 10/3/2018
1.5.0 856 10/3/2018
1.4.16 901 10/3/2018
1.4.15 968 10/3/2018
1.4.12 902 9/29/2018
1.4.10 876 9/28/2018
1.4.8 841 9/28/2018
1.4.7 864 9/28/2018
1.4.6 929 9/28/2018
1.4.5 910 9/27/2018
1.4.4 904 9/27/2018
1.4.3 917 9/27/2018
1.4.2 864 9/27/2018
1.4.1 879 9/20/2018
1.4.0 852 9/20/2018
1.3.2.4 860 9/20/2018
1.3.2.3 881 9/20/2018
1.3.2.1 924 9/20/2018
1.3.2 881 9/20/2018
1.3.1 897 9/19/2018
1.3.0 871 9/19/2018
1.2.1 914 9/19/2018
1.2.0 938 9/19/2018
1.1.0 878 9/19/2018
1.0.0 878 9/19/2018

- Targeted for .NET 4.5.2 and now compatible with .NET 4.5.2

- Removed Generic Test Case attribute.