forked from quickfix/quickfix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDictionaryTest.cs
More file actions
81 lines (71 loc) · 2.04 KB
/
Copy pathDictionaryTest.cs
File metadata and controls
81 lines (71 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using NUnit.Framework;
using System;
using QuickFix;
[TestFixture]
public class DictionaryTestCase
{
private Dictionary testObject = new Dictionary();
[Test]
public void testSetGetString()
{
testObject.setString( "key1", "value1" );
testObject.setString( "key2", "value2" );
testObject.setString( "key3", "value3" );
Assert.AreEqual( "value1", testObject.getString("key1") );
Assert.AreEqual( "value2", testObject.getString( "key2" ) );
Assert.AreEqual( "value3", testObject.getString( "key3" ) );
}
[Test]
public void testSetGetLong()
{
testObject.setLong( "key1", 1 );
testObject.setLong( "key2", 2 );
testObject.setLong( "key3", 3 );
Assert.AreEqual( 1, testObject.getLong( "key1" ) );
Assert.AreEqual( 2, testObject.getLong( "key2" ) );
Assert.AreEqual( 3, testObject.getLong( "key3" ) );
}
[Test]
public void testSetGetDouble()
{
testObject.setDouble( "key1", 1.1 );
testObject.setDouble( "key2", 2.2 );
testObject.setDouble( "key3", 3.3 );
Assert.IsTrue( 1.1 == testObject.getDouble("key1") );
Assert.IsTrue( 2.2 == testObject.getDouble("key2") );
Assert.IsTrue( 3.3 == testObject.getDouble("key3") );
}
[Test]
public void testSetGetBool()
{
testObject.setBool( "key1", true );
testObject.setBool( "key2", false );
testObject.setBool( "key3", true );
Assert.IsTrue( testObject.getBool("key1") );
Assert.IsTrue( !testObject.getBool("key2") );
Assert.IsTrue( testObject.getBool("key3") );
}
[Test]
public void testInvalidFormat()
{
testObject.setString( "key1", "hello" );
try
{
testObject.getLong( "key1" );
Assert.Fail();
}
catch( ConfigError ) {}
try
{
testObject.getDouble( "key1" );
Assert.Fail();
}
catch( ConfigError ) {}
try
{
testObject.getBool( "key1" );
Assert.Fail();
}
catch( ConfigError ) {}
}
}