本文整理汇总了C#中ObjectState.GetField方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectState.GetField方法的具体用法?C# ObjectState.GetField怎么用?C# ObjectState.GetField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectState
的用法示例。
在下文中一共展示了ObjectState.GetField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSimpleSmsCapability
public void TestSimpleSmsCapability()
{
ISmsc smsc;
ISmsProvider provider;
Dictionary<string, string> settings;
ObjectState mockProvider;
ObjectState mockSettings;
// This call, other than instantiating a Smsc object,
// loads all registered Sms Providers
smsc = SmsFactory.GetSmsc();
// Lookup the Aspsms provider
provider = smsc.SmsProviders.Lookup("Aspsms");
// Verify the Aspsms provider is correctly loaded
Assert.IsNotNull(provider, "Aspsms provider not found");
Assert.AreEqual("aspsms", provider.Name.ToLower(), "Invalid sms provider name");
Assert.IsTrue(provider.Capabilities.SimpleSms, "Aspsms provider not enabled to send simple SMS");
Assert.IsTrue(provider.Capabilities.TestMode, "Aspsms provider not implementing a test mode");
// Read the internal provider state in order to get access
// to private members and display some information
mockProvider = new ObjectState(provider);
mockSettings = new ObjectState(provider.Configuration);
settings = (Dictionary<string, string>) mockSettings.GetField("_settings");
Console.Out.WriteLine("Name: " + provider.Name);
Console.Out.WriteLine("Assembly: " + mockProvider.GetField("_assemblyName"));
Console.Out.WriteLine("Class: " + mockProvider.GetField("_className"));
Console.Out.WriteLine("UserKey: " + settings["userKey"]);
Console.Out.WriteLine("Password: " + settings["password"]);
}