C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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.

Описание методов

AssertAllFieldsSetViaReflection() публичный Метод

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
Результат void

AssertClearViaReflection() публичный Метод

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
Результат void

AssertPackedFieldsSetViaReflection() публичный Метод

public AssertPackedFieldsSetViaReflection ( IMessage message ) : void
message IMessage
Результат void

AssertReflectionRepeatedSettersRejectNull() публичный Метод

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
Результат void

AssertReflectionSettersRejectNull() публичный Метод

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
Результат void

CreateTestAllExtensionsInstance() публичный статический Метод

Creates an instance for the TestAllExtensions message, with an extension registry from TestUtil.CreateExtensionRegistry.
public static CreateTestAllExtensionsInstance ( ) : ReflectionTester
Результат ReflectionTester

CreateTestAllTypesInstance() публичный статический Метод

Creates an instance for the TestAllTypes message, with no extension registry.
public static CreateTestAllTypesInstance ( ) : ReflectionTester
Результат ReflectionTester

CreateTestPackedTypesInstance() публичный статический Метод

Creates an instance for the TestPackedTypes message, with no extensions.
public static CreateTestPackedTypesInstance ( ) : ReflectionTester
Результат ReflectionTester

SetPackedFieldsViaReflection() публичный Метод

public SetPackedFieldsViaReflection ( IBuilder message ) : void
message IBuilder
Результат void