DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Types | Public Member Functions | List of all members
Deveel.Data.Configuration.DbConfigTests Class Reference

Public Types

enum  TestEnum { TestEnum.One = 1, TestEnum.Two = 2, TestEnum.Default = 0 }
 

Public Member Functions

void DefaultConfig ()
 
void GetValuesFromRoot ()
 
void GetValuesFromChild ()
 
void GetValueAsInt32 ()
 
void GetBooleanValue (string key, string value, bool expected)
 
void GetEnumValue (object value, TestEnum expected)
 
void Extensions_LoadFromProperties ()
 

Detailed Description

Definition at line 23 of file DbConfigTests.cs.

Member Enumeration Documentation

Enumerator
One 
Two 
Default 

Definition at line 131 of file DbConfigTests.cs.

131  {
132  One = 1,
133  Two = 2,
134  Default = 0
135  }
No specific form of the parameter was given: this default to the system default parameter style confi...

Member Function Documentation

void Deveel.Data.Configuration.DbConfigTests.DefaultConfig ( )
inline

Definition at line 25 of file DbConfigTests.cs.

25  {
26  IConfiguration config = null;
27  Assert.DoesNotThrow(() => config = new Configuration());
28  Assert.IsNotNull(config);
29  Assert.IsNull(config.Parent);
30  Assert.IsNull(config.Source);
31  }
void Deveel.Data.Configuration.DbConfigTests.Extensions_LoadFromProperties ( )
inline

Definition at line 138 of file DbConfigTests.cs.

138  {
139  var properties = new StringBuilder();
140  properties.AppendLine("system.readOnly = false");
141  properties.AppendLine("caching.type = Memory");
142 
143  IConfiguration configuration = null;
144  Assert.DoesNotThrow(() => configuration = new Configuration(new StringConfigSource(properties.ToString())));
145  Assert.IsNotNull(configuration);
146  Assert.DoesNotThrow(() => configuration.Load(new PropertiesConfigFormatter()));
147 
148  Assert.DoesNotThrow(() => Assert.IsNotNull(configuration.GetValue("system.readOnly")));
149 
150  bool readOnly = true;
151  Assert.DoesNotThrow(() => readOnly = configuration.GetBoolean("system.readOnly"));
152  Assert.IsFalse(readOnly);
153  }
void Deveel.Data.Configuration.DbConfigTests.GetBooleanValue ( string  key,
string  value,
bool  expected 
)
inline

Definition at line 100 of file DbConfigTests.cs.

100  {
101  IConfiguration config = null;
102  Assert.DoesNotThrow(() => config = new Configuration());
103  Assert.IsNotNull(config);
104 
105  Assert.DoesNotThrow(() => config.SetValue(key, value));
106 
107  object configValue = null;
108  Assert.DoesNotThrow(() => configValue = config.GetBoolean(key));
109  Assert.IsNotNull(configValue);
110  Assert.IsInstanceOf<bool>(configValue);
111  Assert.AreEqual(expected, configValue);
112  }
void Deveel.Data.Configuration.DbConfigTests.GetEnumValue ( object  value,
TestEnum  expected 
)
inline

Definition at line 118 of file DbConfigTests.cs.

118  {
119  IConfiguration config = null;
120  Assert.DoesNotThrow(() => config = new Configuration());
121  Assert.IsNotNull(config);
122 
123  Assert.DoesNotThrow(() => config.SetValue("test", value));
124 
125  object configValue = null;
126  Assert.DoesNotThrow(() => configValue = config.GetValue<TestEnum>("test"));
127  Assert.IsInstanceOf<TestEnum>(configValue);
128  Assert.AreEqual(expected, configValue);
129  }
void Deveel.Data.Configuration.DbConfigTests.GetValueAsInt32 ( )
inline

Definition at line 81 of file DbConfigTests.cs.

81  {
82  IConfiguration config = null;
83  Assert.DoesNotThrow(() => config = new Configuration());
84  Assert.IsNotNull(config);
85 
86  Assert.DoesNotThrow(() => config.SetValue("test.oneKey", "22"));
87 
88  object value = null;
89  Assert.DoesNotThrow(() => value = config.GetInt32("test.oneKey"));
90  Assert.IsNotNull(value);
91  Assert.IsInstanceOf<int>(value);
92  Assert.AreEqual(22, value);
93  }
void Deveel.Data.Configuration.DbConfigTests.GetValuesFromChild ( )
inline

Definition at line 54 of file DbConfigTests.cs.

54  {
55  IConfiguration config = null;
56  Assert.DoesNotThrow(() => config = new Configuration());
57  Assert.IsNotNull(config);
58 
59  Assert.DoesNotThrow(() => config.SetValue("test.oneKey", "one"));
60 
61  IConfiguration child = null;
62  Assert.DoesNotThrow(() => child = new Configuration(config));
63  Assert.IsNotNull(child);
64  Assert.IsNotNull(child.Parent);
65 
66  Assert.DoesNotThrow(() => child.SetValue("test.oneKey", 45));
67 
68  object value = null;
69  Assert.DoesNotThrow(() => value = child.GetValue("test.oneKey"));
70  Assert.IsNotNull(value);
71  Assert.IsInstanceOf<int>(value);
72  Assert.AreEqual(45, value);
73 
74  Assert.DoesNotThrow(() => value = config.GetValue("test.oneKey"));
75  Assert.IsNotNull(value);
76  Assert.IsInstanceOf<string>(value);
77  Assert.AreEqual("one", value);
78  }
void Deveel.Data.Configuration.DbConfigTests.GetValuesFromRoot ( )
inline

Definition at line 34 of file DbConfigTests.cs.

34  {
35  IConfiguration config = null;
36  Assert.DoesNotThrow(() => config = new Configuration());
37  Assert.IsNotNull(config);
38  Assert.DoesNotThrow(() => config.SetValue("test.oneKey", 54));
39  Assert.DoesNotThrow(() => config.SetValue("test.twoKeys", null));
40 
41  object value1 = null;
42  object value2 = null;
43 
44  Assert.DoesNotThrow(() => value1 = config.GetValue("test.oneKey"));
45  Assert.IsNotNull(value1);
46  Assert.IsInstanceOf<int>(value1);
47  Assert.AreEqual(54, value1);
48 
49  Assert.DoesNotThrow(() => value2 = config.GetValue("test.twoKeys"));
50  Assert.IsNull(value2);
51  }

The documentation for this class was generated from the following file: