2.5 csPorter for C++ Attributes

Last modified by Tilal Ahmad on 2018/11/23 14:56

Overview

There is a number of attributes recognized by csPorter for C++. These include both widely-known attributes introduced by .NET or third party libraries such as NUnit and special attributes introduced by csPorter for C++ itself. The former attributes can be used in the same way as they are used normally in C# applications. The later can be placed into source code manually to prepare the code for porting; they are defined in CsToCppPorter namespace. This page summarizes their effects.

To use an attribute, you must make it visible from your C# code. To do so, you should reference CsToCppPorter.Attributes project from the one you are preparing to port. Please note that the porting application itself doesn't analyze attribute definitions as they are recognized by names; therefore, inheriting attributes to simplify constructor arguments or for some other reasons won't work. Please check more details as following.

Please note code examples used on this page are for illustration purposes only. Efforts were put to keep them as simple as possible. Actual porting application output may differ.

csPorter for C++ private attributes

This section describes attributes available in CsToCppPorter.Attributes project. Use them to resolve porting issues or to improve porting experience.

CppAddStructDefaultMethods

Used on: Structures
Arguments: None

Forces generating default ValueType methods: operator==, Equals, ToString and GetHashCode.

Cpp AllowBoxing

Used on: Structures
Arguments: None

Allows boxing for this type. This requires the type to implement operator == (), ToString() const and GetHashCode() const.

CppArgumentKind

Used on: Function parameter
Arguments: Mandatory single value of CsToCppPorter.ArgumentKind enumeration.

Forces to use a specific way to pass a parameter to function (const reference, pointer, etc.). This option is useful mostly if you're overriding your ported code with manually written one, as it only affects function formal parameters but not the references to them. Calling contexts are not affected as well.

Please note that C# semantics is followed by default which means that pointer types are passed to functions by reference while value types are passed by value. You don't need to use this attribute to impose this behavior.

Argument

Description

Usage example

Output code

Value

Value-type argument translation, same as if no CppArgumentKind attribute was used.

void Foo([CsToCppPorter.CppArgumentKind(CsToCppPorter.ArgumentKind.Value)]Object value) { ... }
void Foo(System::SharedPtr<System::Object> value) { ... }

Reference

Reference function argument.

void Foo([CsToCppPorter.CppArgumentKind(CsToCppPorter.ArgumentKind.Reference)]Object reference) { ... }
void Foo(System::SharedPtr<System::Object> &reference) { ... }

Pointer

Pointer function argument.

void Foo([CsToCppPorter.CppArgumentKind(CsToCppPorter.ArgumentKind.Pointer)]Object pointer) { ... }
void Foo(System::Object *pointer) { ... }

ConstValue

Const value function argument.

void Foo([CsToCppPorter.CppArgumentKind(CsToCppPorter.ArgumentKind.ConstValue)]Object constValue) { ... }
void Foo(System::SharedPtr<System::Object> const constValue) { ... }

ConstReference

Const reference function argument.

void Foo([CsToCppPorter.CppArgumentKind(CsToCppPorter.ArgumentKind.ConstReference)]Object constReference) { ... }
void Foo(System::SharedPtr<System::Object> const &constReference) { ... }

ConstPointer

Const pointer function argument.

void Foo([CsToCppPorter.CppArgumentKind(CsToCppPorter.ArgumentKind.ConstPointer)]Object constPointer) { ... }
void Foo(System::Object const *constPointer) { ... }

CppConstexpr

Used on: Field or class
Arguments: None

Forces translation of a field or of all fields of class as constexpr.

class CppConstexprTest
{
    [CsToCppPorter.CppConstexpr]
   static int i = 2 * 3;
}
class CppConstexprTest : public System::Object, public ::testing::Test
{
    ...
   static constexpr int32_t i = 2 * 3;
};

CppConstMethod

Used on: Method
Arguments: Optional boolean argument to generate 'ASPOSE_CONST' marker instead of 'const' one.

Adds 'const' modifier to method. Useful in situations where it is not generated by porter.

Argument

Description

Usage example

Output code

No CppConstMethod attribute

Method is translated as non-const.

class Foo
{
   public void Bar() { ... }
}
class Foo
{
    ...
   void Bar();
}

No argument

Method is translated as const.

class Foo
{
    [CsToCppPorter.CppConstMethod]
   public void Bar() { ... }
}
class Foo
{
    ...
   void Bar() const;
}

false

Method is translated as const, same as without argument.

class Foo
{
    [CsToCppPorter.CppConstMethod(false)]
   public void Bar() { ... }
}
class Foo
{
    ...
   void Bar() const;
}

true

Method is translated as ASPOSE_CONST, useful if you're inheriting from ASPOSE_CONST method and use library built with ASPOSE_NO_CONST_METHODS cmake option enabled.

class Foo
{
    [CsToCppPorter.CppConstMethod(true)]
   public void Bar() { ... }
}
class Foo
{
    ...
   void Bar ASPOSE_CONST();
}

CppConstRefParam

Used on: Method
Argument: Array of strings representing parameter names

Forces const reference form of function parameters in translated code. Same effect can be achieved using CppArgumentKind(ArgumentKind.ConstReference) attribute, but CppConstRefParam form is more compact. This parameter can be used e. g. to reduce shared pointer copying performance penalties.

class Foo
{
    [CsToCppPorter.CppConstRefParam("o")]
   public void Bar(Object o)
    { ... }
}
class Foo
{
    ...
   void Bar(System::SharedPtr<System::Object> const &o);
};

CppCTORSelfReference

Used on: Constructor
Arguments: None

Generate guard which allows it to create temporary shared pointers during constructor execution without deleting the object. Not required if auto_ctor_self_reference option is enabled. Otherwise, creating shared pointers in constructor could lead to calling 'delete' on object being constructed.

CppDeclareFriendClass

Used on: Class or interface
Arguments: Mandatory string argument with full name of friend type

Forces friend class declaration.

[CsToCppPorter.CppDeclareFriendClass("MyProject.Bar")]
class Foo
{
   private void Do() { ... }
}
class Foo
{
    ...
    friend class MyProject::Bar;
};

CppDeferredInit

Used on: Class
Arguments: None (obsolete boolean argument may be used for compatibility reasons)

Forces all static variables in attributed class as singletons and static constructor to be called from static functions (including singleton accessors) and instance constructors rather than from C++ static variable initializer. Overrides effect of deferred_init option.

CppEnumEnableMetadata

Used on: Enum types
Arguments: None

Forces metadata generation for enum (string representation of values for parsing and serializing). Use if you need conversions between enum values and strings in ported application.

CppEnumWithOperators

Used on: Enum types
Arguments: None

Enables bitwise operators for enum. Use if you are using them.

CppExactArrayInitializer

Used on: Array type field
Arguments: None

Passes array initializer expression directly from C# to C++ without parsing and code generation. Speeds up long initializers (like thousands of string elements, etc.).

CppForceDynamicCastFromTypeParam

Used on: Generic type or method
Argument: String name of template parameter to affect

Forces dynamic casts from argument type parameter to Object instead of static casts used by default.

CppForceDynamicCastToTypeParam

Used on: Generic type or method
Argument: String name of template parameter to affect

Forces dynamic casts from Object to argument type parameter instead of static casts used by default.

CppForceArrayInitializerCast

Used on: Methods
Arguments: None

Forces explicit casts of array initializers otherwise not working in C++ but allowed in C#.

[CsToCppPorter.CppForceArrayInitializerCast]
public void InitializeArrayFromDifferentType()
{
   int a = 1;
    int b = 2;
    float[] input_array = { a, b };
    Assert.AreEqual(2, input_array.Length);

}
void ArrayTests::InitializeArrayFromDifferentType()
{
   int32_t a = 1;
   int32_t b = 2;
    System::ArrayPtr<float> input_array = System::MakeArray<float>(System::ObjectExt::ArrayInitializerCast<float>(a, b));
   ASPOSE_ASSERT_EQ(2, input_array->get_Length());
}

CppForceForwardDeclaration

Used on: Classes
Argument: Mandatory string full name of type to forward declare

Inside attributed type, always use forward declaration of argument type instead of include. Useful for loop type references management, etc.

CppForceInclude

Used on: Classes
Arguments:

  1. Mandatory string full name of type to include header for.
  2. Optional boolean argument to force include even if no references to argument type exists, defaults to false.

Inside attributed type, always include header with argument type definition instead of forward declaration.

CppForceSharedApi

Used on: Entity
Arguments: None

Adds SHARED_API macro to entity declaration.

CppForceStringParam

Used on: Function parameter
Arguments: None

Forces 'String(...)' wrappers around string literals passed to attributed parameter. Useful if there is a problem with overloads (in C++, the priority converting string literals to boolean value is higher than to String class object. In C++, these calls are resolved used different rules from C#.

Since version 18.11, most cases like this get auto-resolved, so such attribute should only be used where porter analysis fails.

class Foo
{
   public static void Bar([CsToCppPorter.CppForceStringParam] String param) { ... }
   public static void AttributedTest(bool param) { ... }
}
...
Foo.Bar("abc");
class Foo
{
    ...
   static void Bar(System::String param);
   static void Bar(bool param);
}
...
Foo::Bar(System::String(u"abc")); //If translated as 'Foo::Bar(u"abc")', this would call Foo::Bar(bool), not Foo::Bar(System::String&)

CppIgnoreBaseType

Used on: Type
Argument: Optional string type name to ignore inheritance from; defaults to System.Object

Omit inheritance from a specific type during translation. One usecase is creating a lightweight class not related to Object tree.

[CsToCppPorter.CppIgnoreBaseType("System.Object")]
interface Interface1 { }
interface Interface2 { }
[CsToCppPorter.CppIgnoreBaseType("Interface1")]
class Class1 : Interface1, Interface2 { }
class Interface1 //No Object inheritance
{
    ...
};
class Interface2 : public virtual System::Object
{
    ...
};
class Class4 : public Interface2 //No interface1 inheritance
{
    ...
};

CppIgnoreConstraints

Used on: Method or type
Argument: Optional string comment which is always ignored

Disables translating 'where' clauses to C++.

CppMutable

Used on: Field
Arguments: None

Marks field as mutable.

private class MutableHolder
{
    [CsToCppPorter.CppMutable]
    public int Mutable;
    public int NonMutable;
}
class MutableHolder : public System::Object
{
    ...
    mutable int32_t Mutable;
    int32_t NonMutable;
};

CppNightTest

Used on: Test fixture or test method
Arguments: None

Disables attributed test or all tests from attributed fixture unless ASPOSE_ENABLE_NIGHT_TESTS define is enabled. Useful to avoid running durable or unstable tests each time.

CppNoAbstract

Used on: Class
Arguments: None

Omit 'abstract' mark when translating the class.

CppOverrideTestFixtureSetUp

Used on: Method
Arguments: None

Forces translate this method as TestFixtureSetUp, overriding existing one (if any). Also, forces method to be static.

CppOverrideTestFixtureTearDowm

Used on: Method
Arguments: None

Forces translate this method as TestFixtureTearDown, overriding existing one (if any). Also, forces method to be static.

CppPortAsEnum

Used on: Integer const fields
Arguments: None

Port numeric constant as enum (not enum class) with single value in it. Useful to define header-only constants (const fields are translated as static constants and require definition as an addition to header declaration.

class PortAsEnumTest
{
    [CsToCppPorter.CppPortAsEnum]
   const int EnumValue = 1;
   const int NonEnumValue = 1;
}
class PortAsEnumTest
{
    ...
   enum{EnumValue = 1};
   static const int32_t NonEnumValue;
};
const int32_t PortAsEnumTest::NonEnumValue = 1;

CppPortAsSingleton

Used on: Field
Argument: None; obsolete boolean argument may be used for compatibility reasons

Port field as singleton. Same behavior can be enabled globally by the deferred_init option.

class SingletonOwner
{
   static System.Collections.Generic.List<string> staticList = new System.Collections.Generic.List<string>{ "abc", "def", "g", "hi" };
    [CsToCppPorter.CppPortAsSingleton]
   static System.Collections.Generic.List<string> singletonList = new System.Collections.Generic.List<string>{ "abc", "def", "g", "hi" };
}
class SingletonOwner
{
    ...
   static System::SharedPtr<System::Collections::Generic::List<System::String>> staticList;
   static System::SharedPtr<System::Collections::Generic::List<System::String>>& singletonList();
   static struct __StaticConstructor__ { __StaticConstructor__(); } s_constructor__;
};
SingletonOwner::__StaticConstructor__ SingletonOwner::s_constructor__;
System::SharedPtr<System::Collections::Generic::List<System::String>> SingletonOwner::staticList;
SingletonOwner::__StaticConstructor__::__StaticConstructor__()
{
    staticList = [&]{ System::String init_3[] = {u"abc", u"def", u"g", u"hi"}; auto list_3 = System::MakeObject<System::Collections::Generic::List<System::String>>(); list_3->AddInitializer(4, init_3); return list_3; }();
}
System::SharedPtr<System::Collections::Generic::List<System::String>>& SingletonOwner::singletonList()
{
   static System::SharedPtr<System::Collections::Generic::List<System::String>> value;
   static std::once_flag once;
    std::call_once(once, []
    {
        value = [&]{ System::String init_0[] = {u"abc", u"def", u"g", u"hi"}; auto list_0 = System::MakeObject<System::Collections::Generic::List<System::String>>(); list_0->AddInitializer(4, init_0); return list_0; }();
    });
   return value;
}

CppPortConstStringAsWChar

Used on: Field or class
Arguments: None

Port attributed string field or all string fields in attributed class as const char16_t* instead of System::String. Only possible for const or readonly fields with plain initializers. Resolves initialization race issues, speeds up startup.

CppRenameEntity

Used on: Method or property
Argument: Optional string with new name. If absent, old name with '_' prefix or suffix will be used, depending on context.

Renames method or property in output code. Useful if you have name clash which can't be resolved on C++ side (e. g. two virtual methods with same signatures or C++ keyword used as an identifier). Affects both symbol and references to it.

[CsToCppPorter.CppRenameEntity("NewName")]
public String OldName()
{
   return "ClassName.OldName";
}
System::String ClassName::NewName()
{
    return u"ClassName.OldName";
}

CppSelfReference

Used on: Method
Arguments: None

Same as CppCTORSelfReference, but works on method. No auto-placement option at the moment exists for this attribute. Useful if method is called when no references to object exist (e. g. during construction or destruction).

CppSkipDefinition

Used on: Class, struct, method
Argument: Optional boolean value - whether to generate exception-throwing stubs; defaults to 'true'.

Skips translating method or class definition, leaving declaration in place. Optionally, generates stubs that throw exception without actually doing anything. Use this attribute on methods you want to substitute native C++ implementation to.

class SkipDefinitionTest
{
    [CsToCppPorter.CppSkipDefinition]
   private static String Skip1()
    {
       return "C#";
    }
    [CsToCppPorter.CppSkipDefinition(true)]
   private static String Skip2()
    {
       return "C#";
    }
    [CsToCppPorter.CppSkipDefinition(false)]
   private static String Skip3()
    {
       return "C#";
    }
}
class SkipDefinitionTest
{
    ...
   static System::String Skip1();
   static System::String Skip2();
   static System::String Skip3();
};
System::String SkipDefinitionTest::Skip1() { throw System::NotImplementedException(ASPOSE_CURRENT_FUNCTION); }
System::String SkipDefinitionTest::Skip2() { throw System::NotImplementedException(ASPOSE_CURRENT_FUNCTION); }
//No body generated for Skip3

CppSkipEntity

Used on: Entity
Argument: Optional comment string. Always ignored.

Skips class, struct, enum, method, field, etc. The output code looks as if the entity was not present in the input at all. Unlike CppSkipDefinition, skips both declarations and definitions of the affected entities. Note that any references to skipped entity in ported code end up in compilation errors as

CppStaticMethod

Used on: Method
Argument: None

Forces method which is otherwise non-static to be translated as static.

CppStaticVariable

Used on: Method
Argument: String name of variable inside attributed function

Forces argument variable as static. Affects all variables with same name. Only affects declarations containing single variable per declaration. Useful to cache large objects (e. g. string arrays, etc.).

[CsToCppPorter.CppStaticVariable("colors")]
private string GetFruitColor(string fruit)
{
   System.Collections.Generic.Dictionary<string, string> colors = new System.Collections.Generic.Dictionary<string, string> { { "banana", "yellow" }, { "apple", "red" }, { "carrot", "orange" } };
    return colors[fruit];

}

CppUnknownTypeParam

Used on: Generic type or method
Argument: String name of template parameter to treat as unknown type

Force treating type argument as unknown type: calling ObjectExt::UnknownToObject() and ObjectExt::ObjectToUnknown() whenever the conversion is required. Fixes some type conversion issues with type parameters.

CppUseAlternativeSwitch

Used on: Method
Arguments: None

Forces using do-while form of switch translation inside this method. Similar to alternative_string_switch option, but only affects single method.

CppUsing

Used on: Class, interface
Arguments:

  1. Mandatory string parameter: method name
  2. Optional CsToCppPorter.CppUsingAttribute.Visibility enum parameter - closure level (defaults to public)

Generates 'using' directives that import symbols from base classes.

class UsingTestParent
{
   protected void Foo(bool b)
    { }
}
[CsToCppPorter.CppUsing("UsingTestBase::Foo")]
class UsingTestChild : UsingTestParent
{}
class UsingTestParent: public System::Object
{
    ...
protected:
   void Foo(bool b);
};
class UsingTestChild : public UsingTestMiddle
{
    ...
public:
    using UsingTestMiddle::UsingTestBase::Foo;
};

CppValueTypeParam

Used on: Generic type or method
Argument: String name of template parameter to treat as value type

Force treating type argument as value type: boxing, etc.

CppVirtualInheritance

Used on: Class, interface
Argument: Name of the base class or interface to inherit from virtually (mandatory as there can be multiple base classes)

Forces virtual inheritance instead of direct.

CppWeakPtr

Used on: Field
Argument:

  1. Without parameters affects variable itself.
  2. Single integer parameter denotes index of generic argument which should be passed as weak pointer rather than shared pointer.

Force holding value as weak pointer rather than shared pointer.

class WeakPtrTest_Cs
{
   public Object s;
    [CsToCppPorter.CppWeakPtr]
   public Object w;

   public List<Object> ss;
    [CsToCppPorter.CppWeakPtr]
   public List<Object> ws;
    [CsToCppPorter.CppWeakPtr(0)]
   public List<Object> sw;
    [CsToCppPorter.CppWeakPtr(0), CsToCppPorter.CppWeakPtr]
   public List<Object> ww;

   public class TwoArgs<A,B>
    {
       public A a;
       public B b;
    }

   public TwoArgs<Object,Object> sss;
    [CsToCppPorter.CppWeakPtr]
   public TwoArgs<Object,Object> wss;
    [CsToCppPorter.CppWeakPtr(0)]
   public TwoArgs<Object,Object> sws;
    [CsToCppPorter.CppWeakPtr(1)]
   public TwoArgs<Object,Object> ssw;
    [CsToCppPorter.CppWeakPtr(0), CsToCppPorter.CppWeakPtr(1)]
   public TwoArgs<Object,Object> sww;
    [CsToCppPorter.CppWeakPtr, CsToCppPorter.CppWeakPtr(0)]
   public TwoArgs<Object,Object> wws;
    [CsToCppPorter.CppWeakPtr, CsToCppPorter.CppWeakPtr(1)]
   public TwoArgs<Object,Object> wsw;
    [CsToCppPorter.CppWeakPtr, CsToCppPorter.CppWeakPtr(0), CsToCppPorter.CppWeakPtr(1)]
   public TwoArgs<Object,Object> www;
}
class WeakPtrTest_Cs
{
    ...
public:
    template<typename A, typename B>
   class TwoArgs
    {
        ...
   public:
        A a;
        B b;
    };

    System::SharedPtr<System::Object> s;
    System::WeakPtr<System::Object> w;
    System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<System::Object>>> ss;
    System::WeakPtr<System::Collections::Generic::List<System::SharedPtr<System::Object>>> ws;
    System::SharedPtr<System::Collections::Generic::List<System::WeakPtr<System::Object>>> sw;
    System::WeakPtr<System::Collections::Generic::List<System::WeakPtr<System::Object>>> ww;
    System::SharedPtr<WeakPtrTest_Cs::TwoArgs<System::SharedPtr<System::Object>, System::SharedPtr<System::Object>>> sss;
    System::WeakPtr<WeakPtrTest_Cs::TwoArgs<System::SharedPtr<System::Object>, System::SharedPtr<System::Object>>> wss;
    System::SharedPtr<WeakPtrTest_Cs::TwoArgs<System::WeakPtr<System::Object>, System::SharedPtr<System::Object>>> sws;
    System::SharedPtr<WeakPtrTest_Cs::TwoArgs<System::SharedPtr<System::Object>, System::WeakPtr<System::Object>>> ssw;
    System::SharedPtr<WeakPtrTest_Cs::TwoArgs<System::WeakPtr<System::Object>, System::WeakPtr<System::Object>>> sww;
    System::WeakPtr<WeakPtrTest_Cs::TwoArgs<System::WeakPtr<System::Object>, System::SharedPtr<System::Object>>> wws;
    System::WeakPtr<WeakPtrTest_Cs::TwoArgs<System::SharedPtr<System::Object>, System::WeakPtr<System::Object>>> wsw;
    System::WeakPtr<WeakPtrTest_Cs::TwoArgs<System::WeakPtr<System::Object>, System::WeakPtr<System::Object>>> www;
};

CppWrapInMacro

Used on: Method
Argument: Mandatory string expression to be tested as an argument of '#if' statement

Wrap method in macro.

private class FooContainer
{
    [CsToCppPorter.CppWrapInMacro("defined(FOO_FUNCTION_EXISTS)")]
    public static void Foo()
    {}
}
class FooContainer
{
    ...
   #if defined(FOO_FUNCTION_EXISTS)
       static void Foo();
   #endif
}

.NET attributes

This section enlists .NET attributes recognized by porting applicaton.

System.Diagnostics.Conditional

Used on: Methods
Argument: Mandatory string name of preprocessor definition

Wraps method body with '#if defined' directives with attribute argument as definition name. Multiple attributes join using 'logical or' coupling.

[System.Diagnostics.Conditional("TEST_DEF")]
public void func1(int val)
{
   func3(val);
}
[Conditional("NONEXISTENT"), ConditionalAttribute("TEST_DEF"), System.Diagnostics.Conditional("BOO")]
public void func2(int val)
{
   func3(val);
}
void ClassName::func1(int32_t val)
{
#if defined(TEST_DEF)
    func3(val);
#endif
}
void ClassName::func2(int32_t val)
{
#if defined(NONEXISTENT) || defined(TEST_DEF) || defined(BOO)
    func3(val);
#endif
}

System.ThreadStatic

Used on: static fields
Arguments: None

Puts static variable into thread scope. In C++, translates into 'thread_local' scope specifier.

class MyThread
{
   public int value0;
    [ThreadStatic]
   public static int value1 = 0;
    [ThreadStatic]
   public int value2 = 0;
   public static int value3 = 0;
}
class MyThread
{
    ...
    int32_t value0;
   static thread_local int32_t value1;
    int32_t value2;
   static int32_t value3;
};
thread_local int32_t MyThread::value1 = 0;
int32_t MyThread::value3 = 0;

NUnit attributes

This section enlists supported attributes from NUnit framework. For more information on how to use these methods, please refer to NUnit manual.

The below example shows usage of some NUnit attributes supported by csPorter for C++.

using System;
using NUnit.Framework;
[TestFixture]
class TestWithArguments
{
    [Test]
   public void TestWithMultipleArguments([Values("a", "b", "c")] string str1, [Values("a", "d", "e")] string str2)
    {
        Assert.IsTrue(str1 == str2 || str1 != str2);
    }
}

For more information, please refer to NUnit site at http://nunit.org/.

NUnit.Framework.Category

Used on: TestFixture class methods

Maps test methods into categories allowing porting application excluding them based on category name.

NUnit.Framework.ExpectedException

Used on: TestFixture class methods

Marks test method with expected exception information.

NUnit.Framework.Explicit

Used on: TestFixture class methods

Marks method as explicit test.

NUnit.Framework.Ignore

Used on: TestFixture class methods

Ignores test (by adding 'DISABLED_' prefix to C++ test name).

NUnit.Framework.OneTimeSetUp

Used on: TestFixture class methods

Marks method as a test fixture setupper.

NUnit.Framework.OneTimeTearDown

Used on: TestFixture class methods

Marks method as a test fixtuer teardowner.

NUnit.Framework.SetCulture

Used on: TestFixture class methods

Forces using specific culture when running test method.

NUnit.Framework.SetUp

Used on: TestFixture class methods

Marks method as a test setupper.

NUnit.Framework.Sequential

Used on: TestFixture class methods

Marks test as sequential.

NUnit.Framework.TearDown

Used on: TestFixture class methods

Marks method as a test teardowner.

NUnit.Framework.Test

Used on: TestFixture class methods

Marks method as a test,

NUnit.Framework.TestCase

Used on: TestFixture class methods

Adds test case based on attributed method.

NUnit.Framework.TestCaseSource

Used on: TestFixture class methods

Specifies test case.

NUnit.Framework.TestFixture

Used on: Classes
Arguments: None

Marks class as test fixture.

NUnit.Framework.TestFixtureSetUp

Used on: TestFixture class methods

Marks method as a test fixture setupper.

NUnit.Framework.TestFixtureTearDown

Used on: TestFixture class methods

Marks method as a test fixture teardowner.

NUnit.Framework.Timeout

Used on: TestFixture class methods

Sets up timeout for test (e. g. for performance testing).

NUnit.Framewor.Values

Used on: Test method arguments

Specifies values to run test with.

xUnit framework attributes

This section enlists supported xUnit framework attributes. For more information please refer to xUnit site at https://github.com/xunit/xunit.

Xunit.Fact

Used on: Methods

Marks method as fact.

Xunit.InlineData

Used on: Methods

Specifies theory inline data.

Xunit.Theory

Used on: Methods

Marks method as theory.

 

Tags:
Created by Tilal Ahmad on 2018/09/29 14:31