2 // TimestampOutputFilterTest.cs - NUnit Test Cases for TimestampOutputFilter
5 // Sebastien Pouliot (spouliot@motus.com)
7 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
10 using NUnit
.Framework
;
11 using Microsoft
.Web
.Services
;
12 using Microsoft
.Web
.Services
.Timestamp
;
14 using System
.Web
.Services
.Protocols
;
17 // note: due to compiler confusion between classes and namespace (like Timestamp)
18 // I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp"
19 // to "MonoTests.MS.Web.Services.Timestamp".
20 namespace MonoTests
.MS
.Web
.Services
.Timestamp
{
23 // 1. Inside the Web Services Enhancements Pipeline
24 // http://msdn.microsoft.com/library/en-us/dnwebsrv/html/insidewsepipe.asp
27 public class TimestampOutputFilterTest
: Assertion
{
30 public void TimestampWithoutHeader ()
32 SoapEnvelope env
= new SoapEnvelope ();
33 XmlElement body
= env
.CreateBody ();
34 env
.Envelope
.AppendChild (body
);
36 string xml
= env
.Envelope
.OuterXml
;
37 Assert ("Envelope.Header", xml
.IndexOf ("<soap:Header>") < 0);
39 TimestampOutputFilter tsOutput
= new TimestampOutputFilter ();
40 tsOutput
.ProcessMessage (env
);
41 xml
= env
.Envelope
.OuterXml
;
42 Assert ("Envelope.Header", xml
.IndexOf ("<soap:Header>") > 0);
44 // not static - more difficult to check
45 Assert ("Envelope.Timestamp.Created", xml
.IndexOf ("<wsu:Created>") > 0);
46 Assert ("Envelope.Timestamp.Expired", xml
.IndexOf ("<wsu:Expires>") > 0);
50 public void TimestampWithHeader ()
52 SoapEnvelope env
= new SoapEnvelope ();
53 XmlElement header
= env
.CreateHeader ();
54 env
.Envelope
.AppendChild (header
);
55 XmlElement body
= env
.CreateBody ();
56 env
.Envelope
.AppendChild (body
);
58 TimestampOutputFilter tsOutput
= new TimestampOutputFilter ();
59 tsOutput
.ProcessMessage (env
);
60 // not static - more difficult to check
61 string xml
= env
.Envelope
.OuterXml
;
62 Assert ("Envelope.Timestamp.Created", xml
.IndexOf ("<wsu:Created>") > 0);
63 Assert ("Envelope.Timestamp.Expired", xml
.IndexOf ("<wsu:Expires>") > 0);