AUT.Configure.CrmWeb 1.5.0

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

// Install AUT.Configure.CrmWeb as a Cake Tool
#tool nuget:?package=AUT.Configure.CrmWeb&version=1.5.0

Introduction

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

AUT.Configure.CrmWeb

This package is specially designed to configure Aurea CRM Web Project's Automatic Unit Tests. Still this package doens't contain any business logic but generic method to create any kind of object regardless the business stucture.

This package is downgraded (.NET4.5.1) and used specific versions (NUNit, Shouldly, Moq) that Aurea CRM web project usages.

Release Notes

  • Initial release from existing version.
  • Removed Generic Test case attribute.
  • Converted project to .NET 4.5.1
  • Removed unused methods.
  • Restructured codebase.
  • Fixture recursion level defined to 6.
  • Nunit 2.6.4 is used now.

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 net451 is compatible.  net452 was computed.  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.4.0 962 11/21/2018
2.3.0 832 11/21/2018
2.2.0 861 10/29/2018
2.1.0 808 10/16/2018
2.0.0 868 10/16/2018
1.5.0 882 9/12/2018
1.3.1 878 8/25/2018
1.3.0 915 8/25/2018
1.0.6 927 8/24/2018
1.0.5 968 8/24/2018
1.0.4 925 8/24/2018
1.0.2 940 8/24/2018
1.0.1 893 8/24/2018
1.0.0 898 8/24/2018

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

- Removed Generic Test Case attribute.