C# Class Google.ProtocolBuffers.ReflectionTester

Performs the same things that the methods of TestUtil do, but via the reflection interface. This is its own class because it needs to know what descriptor to use.
Datei anzeigen Open project: ayende/dotnet-protobufs Class Usage Examples

Public Methods

Method Description
AssertAllFieldsSetViaReflection ( IMessage message ) : void

Asserts that all fields of the specified message are set to the values assigned by SetAllFields, using the IMessage reflection interface.

AssertClearViaReflection ( IMessage message ) : void

Assert that all fields of the message are cleared, and that getting the fields returns their default values, using the reflection interface.

AssertPackedFieldsSetViaReflection ( IMessage message ) : void
AssertReflectionRepeatedSettersRejectNull ( IBuilder builder ) : void

Verifies that the reflection repeated setters for the given Builder object throw an ArgumentNullException if they are passed a null value.

AssertReflectionSettersRejectNull ( IBuilder builder ) : void

Verifies that the reflection setters for the given Builder object throw an ArgumentNullException if they are passed a null value.

CreateTestAllExtensionsInstance ( ) : ReflectionTester

Creates an instance for the TestAllExtensions message, with an extension registry from TestUtil.CreateExtensionRegistry.

CreateTestAllTypesInstance ( ) : ReflectionTester

Creates an instance for the TestAllTypes message, with no extension registry.

CreateTestPackedTypesInstance ( ) : ReflectionTester

Creates an instance for the TestPackedTypes message, with no extensions.

SetPackedFieldsViaReflection ( IBuilder message ) : void

Private Methods

Method Description
AssertRepeatedFieldsModifiedViaReflection ( IMessage message ) : void
CreateBuilderForField ( IBuilder parent, FieldDescriptor field ) : IBuilder

Calls parent.CreateBuilderForField() or uses the extension registry to find an appropriate builder, depending on what type is being tested.

ModifyRepeatedFieldsViaReflection ( IBuilder message ) : void

Modify the repeated fields of the specified message to contain the values expected by AssertRepeatedFieldsModified, using the IBuilder reflection interface.

ReflectionTester ( MessageDescriptor baseDescriptor, ExtensionRegistry extensionRegistry ) : System

Constructs an instance that will expect messages using the given descriptor. Normally baseDescriptor should be a descriptor for TestAllTypes. However, if extensionRegistry is non-null, then baseDescriptor should be for TestAllExtensions instead, and instead of reading and writing normal fields, the tester will read and write extensions. All of the TestAllExtensions extensions must be registered in the registry.

SetAllFieldsViaReflection ( IBuilder message ) : void

Sets every field of the message to the values expected by AssertAllFieldsSet, using the reflection interface.

f ( String name ) : FieldDescriptor

Shorthand to get a FieldDescriptor for a field of unittest::TestAllTypes.

Method Details

AssertAllFieldsSetViaReflection() public method

Asserts that all fields of the specified message are set to the values assigned by SetAllFields, using the IMessage reflection interface.
public AssertAllFieldsSetViaReflection ( IMessage message ) : void
message IMessage
return void

AssertClearViaReflection() public method

Assert that all fields of the message are cleared, and that getting the fields returns their default values, using the reflection interface.
public AssertClearViaReflection ( IMessage message ) : void
message IMessage
return void

AssertPackedFieldsSetViaReflection() public method

public AssertPackedFieldsSetViaReflection ( IMessage message ) : void
message IMessage
return void

AssertReflectionRepeatedSettersRejectNull() public method

Verifies that the reflection repeated setters for the given Builder object throw an ArgumentNullException if they are passed a null value.
public AssertReflectionRepeatedSettersRejectNull ( IBuilder builder ) : void
builder IBuilder
return void

AssertReflectionSettersRejectNull() public method

Verifies that the reflection setters for the given Builder object throw an ArgumentNullException if they are passed a null value.
public AssertReflectionSettersRejectNull ( IBuilder builder ) : void
builder IBuilder
return void

CreateTestAllExtensionsInstance() public static method

Creates an instance for the TestAllExtensions message, with an extension registry from TestUtil.CreateExtensionRegistry.

CreateTestAllTypesInstance() public static method

Creates an instance for the TestAllTypes message, with no extension registry.

CreateTestPackedTypesInstance() public static method

Creates an instance for the TestPackedTypes message, with no extensions.

SetPackedFieldsViaReflection() public method

public SetPackedFieldsViaReflection ( IBuilder message ) : void
message IBuilder
return void