How I can pass GUID as a Pex argument using PexArgument attribute?
You cannot. From the MSDN attributes tutorial
Attribute parameters are restricted to constant values of the following types: Simple types (bool, byte, char, short, int, long, float, and double) string System.Type enums object (The argument to an attribute parameter of type object must be a constant value of one of the above types.) One-dimensional arrays of any of the above types
Attribute parameters are restricted to constant values of the following types:
You could just remove the Guid parameter from the generated PexMethod and hardwire the value:
Guid
PexMethod
[PexMethod] public string MyFunction() { Guid guid = Guid.Parse("394865F4-94AB-4B06-B00D-F66CD2CECE7D"); string result = MyClass.MyFunction(guid); return result; // TODO: add assertions to method MyClass_Test.MyFunction(Guid) }
You cannot. From the MSDN attributes tutorial
You could just remove the
Guid
parameter from the generatedPexMethod
and hardwire the value: