2 // MonoTests.System.Web.Services.Description.OperationMessageCollectionTest.cs
5 // Erik LeBel <eriklebel@yahoo.ca>
10 using NUnit.Framework;
13 using System.Web.Services.Description;
16 namespace MonoTests.System.Web.Services.Description
19 public class OperationMessageCollectionTest
21 OperationMessageCollection operations;
24 public void InitializeOperation()
26 // workaround for internal constructor
27 Operation op = new Operation();
28 operations = op.Messages;
32 public void TestDefaultProperties()
34 Assert.AreEqual (OperationFlow.None, operations.Flow);
35 Assert.IsNull (operations.Input);
36 Assert.IsNull (operations.Output);
37 Assert.AreEqual (0, operations.Count);
41 public void TestAddInput()
43 operations.Add(new OperationInput());
45 Assert.AreEqual (OperationFlow.OneWay, operations.Flow);
46 Assert.IsNotNull (operations.Input);
47 Assert.IsNull (operations.Output);
48 Assert.AreEqual (1, operations.Count);
52 public void TestAddOutput()
54 operations.Add(new OperationOutput());
56 Assert.AreEqual (OperationFlow.Notification, operations.Flow);
57 Assert.IsNull (operations.Input);
58 Assert.IsNotNull (operations.Output);
59 Assert.AreEqual (1, operations.Count);
63 public void TestAddInputAndOutput()
65 operations.Add(new OperationInput());
66 operations.Add(new OperationOutput());
68 Assert.AreEqual (OperationFlow.RequestResponse, operations.Flow);
69 Assert.IsNotNull (operations.Input);
70 Assert.IsNotNull (operations.Output);
71 Assert.AreEqual (2, operations.Count);
75 public void TestAddOutputAndInput()
77 operations.Add(new OperationOutput());
78 operations.Add(new OperationInput());
80 Assert.AreEqual (OperationFlow.SolicitResponse, operations.Flow);
81 Assert.IsNotNull (operations.Input);
82 Assert.IsNotNull (operations.Output);
83 Assert.AreEqual (2, operations.Count);
87 [ExpectedException (typeof (ArgumentException))]
88 public void TestAddNull()
94 [ExpectedException (typeof (ArgumentException))]
95 public void TestAddFault()
97 operations.Add(new OperationFault());
101 [ExpectedException (typeof (InvalidOperationException))]
102 public void TestAddInputAndInput()
104 operations.Add(new OperationInput());
105 operations.Add(new OperationInput());
109 [ExpectedException (typeof (InvalidOperationException))]
110 public void TestAddOutputAndOutput()
112 operations.Add(new OperationOutput());
113 operations.Add(new OperationOutput());
117 [ExpectedException (typeof (InvalidOperationException))]
118 public void TestAddThreeOperationMessages()
120 operations.Add(new OperationOutput());
121 operations.Add(new OperationOutput());
122 operations.Add(new OperationOutput());
126 [ExpectedException (typeof (ArgumentException))]
127 public void TestAddInputAndFault()
129 operations.Add(new OperationInput());
130 operations.Add(new OperationFault());