[Test]
public void AgtB ()
{
- Assertion.Assert(A > B);
+ Assert.IsTrue(A > B);
}
[Test]
public void ANotLtB ()
{
- Assertion.Assert(!(A < B));
+ Assert.IsTrue(!(A < B));
}
[Test]
public void BNotGtA ()
{
- Assertion.Assert(!(B > A));
+ Assert.IsTrue(!(B > A));
}
[Test]
public void AltB ()
{
- Assertion.Assert(B < A);
+ Assert.IsTrue(B < A);
}
[Test]
public void AeqA ()
{
- Assertion.Assert(A == A);
+ Assert.AreEqual(A, A);
}
[Test]
public void BeqB ()
{
- Assertion.Assert(B == B);
+ Assert.AreEqual(B, B);
}
[Test]
public void AneqB ()
{
- Assertion.Assert(A != B);
+ Assert.AreNotEqual(A, B);
}
[Test]
public void BneqA ()
{
- Assertion.Assert(B != A);
+ Assert.AreNotEqual(B, A);
}
#endregion
for (int i = 0; i < 5; i++) {
ContextData ctx = new ContextData (128, (uint)r.Next (int.MinValue, int.MaxValue));
BigInteger p = GenerateNewPrime (128, ctx);
- Assertion.Assert (p.TestBit (1));
+ Assert.IsTrue (p.TestBit (1));
uint d = ctx.testData;
for (uint j = 128 - 2; d > 0; j--, d >>= 1)
Assertion.AssertEquals ((d&1) == 1, p.TestBit (j));
private string WriteFile ()
{
- string filename = "helloworld_signed.exe";
+ string filename = Path.Combine (Path.GetTempPath (), "helloworld_signed.exe");
try {
if (File.Exists (filename)) {
File.Delete (filename);
Assert (msg, a);
}
- private const string testfile = "test.pvk";
+ string testfile;
+
+ [TestFixtureSetUp]
+ public void FixtureSetup ()
+ {
+ testfile = Path.Combine (Path.GetTempPath (), "test.pvk");
+ }
[TearDown]
public void TearDown ()
0x77, 0xEF, 0xEC, 0x17, 0x92, 0xC7, 0xD6, 0xCD, 0xE1, 0x2A, 0x2E, 0xE7,
0xF3, 0xED, 0x7F, 0x66, 0x86, 0x31, 0x00 };
- private const string testfile = "test.spc";
+ string testfile;
+
+ [TestFixtureSetUp]
+ public void FixtureSetup ()
+ {
+ testfile = Path.Combine (Path.GetTempPath (), "test.spc");
+ }
[TearDown]
public void TearDown ()
if (unicode) {
data = Encoding.Unicode.GetBytes (s);
} else if (pem) {
- string b64pem = "-----BEGIN PKCS7-----\n" + s + "\n-----END PKCS7-----";
- data = Encoding.ASCII.GetBytes (b64pem);
- using (FileStream fs = File.Create ("bad.pem")) {
- fs.Write (data, 0, data.Length);
- }
+ //string b64pem = "-----BEGIN PKCS7-----\n" + s + "\n-----END PKCS7-----";
+ //data = Encoding.ASCII.GetBytes (b64pem);
+ //using (FileStream fs = File.Create ("bad.pem")) {
+ // fs.Write (data, 0, data.Length);
+ //}
} else {
data = Encoding.ASCII.GetBytes (s);
}
AssertEquals ("key.PublicKeyToken", sn1.PublicKeyToken, sn2.PublicKeyToken);
}
- private const string Signed = "hellosigned.exe";
- private const string Delay = "hellodelay.exe";
+ string Signed;
+ string Delay;
private StrongName sn;
private static byte[] signedData = {
0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
[SetUp]
public void SetUp ()
{
+ Signed = Path.Combine (Path.GetTempPath (), "hellosigned.exe");
+ Delay = Path.Combine (Path.GetTempPath (), "hellodelay.exe");
+
sn = new StrongName (key);
// write hellosigned.exe to disk
FileStream fs = File.OpenWrite (Signed);
fs.Write (signedData, 0, signedData.Length);
fs.Close ();
+
+
// write hellodelay.exe to disk
fs = File.OpenWrite (Delay);
fs.Write (delayData, 0, delayData.Length);
client.SendAsync (request, HttpCompletionOption.ResponseContentRead).Wait (WaitTimeout);
Assert.Fail ("#2");
} catch (AggregateException e) {
- Assert.IsInstanceOfType (typeof (HttpRequestException), e.InnerException, "#3");
+ Assert.IsTrue (e.InnerException is HttpRequestException, "#3");
}
} finally {
client.GetByteArrayAsync (LocalServer).Wait (WaitTimeout);
Assert.Fail ("#1");
} catch (AggregateException e) {
- Assert.IsInstanceOfType (typeof (HttpRequestException), e.InnerException, "#2");
+ Assert.IsTrue (e.InnerException is HttpRequestException , "#2");
}
} finally {
listener.Close ();
client.GetStringAsync (LocalServer).Wait (WaitTimeout);
Assert.Fail ("#1");
} catch (AggregateException e) {
- Assert.IsInstanceOfType (typeof (HttpRequestException), e.InnerException, "#2");
+ Assert.IsTrue (e.InnerException is HttpRequestException, "#2");
}
} finally {
listener.Abort ();
Assert.IsTrue (sc.LoadIntoBufferAsync (50).Wait (200));
Assert.Fail ("#1");
} catch (AggregateException e) {
- Assert.IsInstanceOfType (typeof (HttpRequestException), e.InnerException, "#2");
+ Assert.IsTrue (e.InnerException is HttpRequestException, "#2");
}
}
var s = new StringContent ("aaa", null, "multipart/*");
Assert.AreEqual ("Content-Type: multipart/*; charset=utf-8\r\n", s.Headers.ToString ());
-
+#if !MOBILE
s = new StringContent ("aaa", Encoding.GetEncoding (852), "multipart/*");
Assert.AreEqual ("Content-Type: multipart/*; charset=ibm852\r\n", s.Headers.ToString ());
+#endif
}
[Test]
}
[Test]
+ [Category ("MobileNotWorking")]
public void TestSimpleMutualImport ()
{
XmlReader r = new XmlTextReader ("Test/XmlFiles/xsd/inter-inc-1.xsd");
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+#if !MOBILE
using System;
using System.CodeDom;
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+#if !MOBILE
using System;
using System.CodeDom;
// (C) 2005 Novell
//
+#if !MOBILE
+
using System;
using System.Collections;
using System.Globalization;
}
}
}
+
+#endif
\ No newline at end of file
// (C) 2006 Novell
//
+#if !MOBILE
+
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
}
}
}
+
+#endif
[Test]
#if NET_2_0
[Category ("NotWorking")] // support for XmlSchemaProvider is not implemented
-#else
- [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
#endif
public void ExportXmlSerializable_SchemaProvider1 () {
- XmlSchemas schemas = schemas = Export (typeof (PrimitiveSchemaProvider));
+ XmlSchemas schemas = Export (typeof (PrimitiveSchemaProvider));
Assert.AreEqual (1, schemas.Count, "#1");
StringWriter sw = new StringWriter ();
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
+#if !MOBILE
using Microsoft.CSharp;
-
+#endif
using NUnit.Framework;
using MonoTests.System.Xml.TestClasses;
Assert.AreEqual ("UInt16", map.TypeName, "#6");
}
+#if !MOBILE
+
[Test]
public void ImportTypeMapping_EnumSimpleContent ()
{
return null;
}
- private static XmlSchemas ExportType (Type type)
- {
- XmlReflectionImporter ri = new XmlReflectionImporter ("NS" + type.Name);
- XmlSchemas schemas = new XmlSchemas ();
- XmlSchemaExporter sx = new XmlSchemaExporter (schemas);
- XmlTypeMapping tm = ri.ImportTypeMapping (type);
- sx.ExportTypeMapping (tm);
- return schemas;
- }
-
- private static ArrayList GetXmlQualifiedNames (XmlSchemas schemas)
- {
- ArrayList qnames = new ArrayList ();
-
- foreach (XmlSchema schema in schemas) {
- if (!schema.IsCompiled) schema.Compile (null);
- foreach (XmlSchemaObject ob in schema.Items)
- if (ob is XmlSchemaElement)
- qnames.Add (((XmlSchemaElement) ob).QualifiedName);
- }
-
- return qnames;
- }
-
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void ImportTypeMappingNonExistent ()
xss.Add (XmlSchema.Read (new XmlTextReader (new StringReader (xsd)), null));
return new XmlSchemaImporter (xss);
}
+
+#endif
+
+ private static ArrayList GetXmlQualifiedNames (XmlSchemas schemas)
+ {
+ ArrayList qnames = new ArrayList ();
+
+ foreach (XmlSchema schema in schemas) {
+ if (!schema.IsCompiled) schema.Compile (null);
+ foreach (XmlSchemaObject ob in schema.Items)
+ if (ob is XmlSchemaElement)
+ qnames.Add (((XmlSchemaElement) ob).QualifiedName);
+ }
+
+ return qnames;
+ }
+
+ private static XmlSchemas ExportType (Type type)
+ {
+ XmlReflectionImporter ri = new XmlReflectionImporter ("NS" + type.Name);
+ XmlSchemas schemas = new XmlSchemas ();
+ XmlSchemaExporter sx = new XmlSchemaExporter (schemas);
+ XmlTypeMapping tm = ri.ImportTypeMapping (type);
+ sx.ExportTypeMapping (tm);
+ return schemas;
+ }
}
}
ser.Deserialize (new XmlTextReader (xml, XmlNodeType.Document, null));
}
-#if NET_2_0
-#if !TARGET_JVM
+#if !TARGET_JVM && !MOBILE
[Test]
public void GenerateSerializerGenerics ()
{
Assert.AreEqual (TestEnumWithNulls.bb, w.nenum.Value);
Assert.AreEqual (t, w.ndate.Value);
}
-#endif
[Test]
public void SerializeBase64Binary()
[TestFixture]\r
public class XmlDocumentEventTests\r
{\r
- public static void Main ()\r
- {\r
- new XmlDocumentEventTests ().InsertingOrder ();\r
- }\r
-\r
private StringBuilder eventLogBuilder = new StringBuilder ();\r
\r
private XmlDocument GetEventDocument ()\r
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !MOBILE
+
using NUnit.Framework;
using System;
}
}
}
+
+#endif
\ No newline at end of file
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
+#if !MOBILE
+
using System;
using System.Collections;
using System.IO;
}
}
+#endif
\r
#if NET_4_5\r
[Test]\r
- [Category("Async")]\r
public void TestAsync ()\r
{\r
var loc = Assembly.GetExecutingAssembly ().Location;\r
Uri resolved = resolver.ResolveUri (null, loc);\r
Assert.AreEqual ("file", resolved.Scheme);\r
var task = resolver.GetEntityAsync (resolved, null, typeof (Stream));\r
- Assert.That (task.Wait (3000));\r
- Assert.IsInstanceOfType (typeof (Stream), task.Result);\r
+ Assert.IsTrue (task.Wait (3000));\r
+ Assert.IsTrue (task.Result is Stream);\r
}\r
\r
[Test]\r
- [Category("Async")]\r
public void TestAsyncError ()\r
{\r
var loc = Assembly.GetExecutingAssembly ().Location;\r
} catch (Exception ex) {\r
if (ex is AggregateException)\r
ex = ((AggregateException) ex).InnerException;\r
- Assert.IsInstanceOfType (typeof (XmlException), ex);\r
+ Assert.IsTrue (ex is XmlException);\r
}\r
}\r
#endif\r
}
[Test]
+ [Category ("MobileNotWorking")]
public void EncodingTest ()
{
// For Stream it makes sense
Assert.IsNotNull ((double?) new XAttribute (m), "m:double?:null");
Assert.AreEqual (double.NegativeInfinity, ((double?) new XAttribute (m)).Value, "m:double?:value");
Assert.IsNotNull ((double?) new XAttribute (n), "n:double?:null");
- Assert.IsNaN (((double?) new XAttribute (n)).Value, "n:double?:value");
+ Assert.AreEqual (double.NaN, ((double?) new XAttribute (n)).Value, "n:double?:value");
Assert.IsNotNull ((float?) new XAttribute (a), "a:float?:null");
Assert.AreEqual (7f, ((float?) new XAttribute (a)).Value, "a:float?:value");
Assert.IsNotNull ((float?) new XAttribute (b), "b:float?:null");
Assert.IsNotNull ((float?) new XAttribute (m), "m:float?:null");
Assert.AreEqual (float.NegativeInfinity, ((float?) new XAttribute (m)).Value, "m:float?:value");
Assert.IsNotNull ((float?) new XAttribute (n), "n:float?:null");
- Assert.IsNaN (((float?) new XAttribute (n)).Value, "n:float?:value");
+ Assert.AreEqual (float.NaN, ((float?) new XAttribute (n)).Value, "n:float?:value");
AssertThrows<FormatException> (() => { Guid? z = (Guid?) new XAttribute (a); }, "a:Guid?");
AssertThrows<FormatException> (() => { Guid? z = (Guid?) new XAttribute (b); }, "b:Guid?");
AssertThrows<FormatException> (() => { Guid? z = (Guid?) new XAttribute (c); }, "c:Guid?");
Assert.AreEqual (double.PositiveInfinity, (double) new XAttribute (i), "i:double");
Assert.AreEqual (double.NegativeInfinity, (double) new XAttribute (M), "M:double");
Assert.AreEqual (double.NegativeInfinity, (double) new XAttribute (m), "m:double");
- Assert.IsNaN (((double) new XAttribute (n)), "n:double");
+ Assert.AreEqual (double.NaN, ((double) new XAttribute (n)), "n:double");
Assert.AreEqual (7f, (float) new XAttribute (a), "a:float");
Assert.AreEqual (42f, (float) new XAttribute (b), "b:float");
Assert.AreEqual (123f, (float) new XAttribute (c), "c:float");
Assert.AreEqual (float.PositiveInfinity, (float) new XAttribute (i), "i:float");
Assert.AreEqual (float.NegativeInfinity, (float) new XAttribute (M), "M:float");
Assert.AreEqual (float.NegativeInfinity, (float) new XAttribute (m), "m:float");
- Assert.IsNaN (((float) new XAttribute (n)), "n:float");
+ Assert.AreEqual (float.NaN, ((float) new XAttribute (n)), "n:float");
AssertThrows<FormatException> (() => { Guid z = (Guid) new XAttribute (a); }, "a:Guid");
AssertThrows<FormatException> (() => { Guid z = (Guid) new XAttribute (b); }, "b:Guid");
AssertThrows<FormatException> (() => { Guid z = (Guid) new XAttribute (c); }, "c:Guid");
Assert.IsNotNull ((double?) new XElement (m), "m:double?:null");
Assert.AreEqual (double.NegativeInfinity, ((double?) new XElement (m)).Value, "m:double?:value");
Assert.IsNotNull ((double?) new XElement (n), "n:double?:null");
- Assert.IsNaN (((double?) new XElement (n)).Value, "n:double?:value");
+ Assert.AreEqual (double.NaN, ((double?) new XElement (n)).Value, "n:double?:value");
Assert.IsNotNull ((float?) new XElement (a), "a:float?:null");
Assert.AreEqual (7f, ((float?) new XElement (a)).Value, "a:float?:value");
Assert.IsNotNull ((float?) new XElement (b), "b:float?:null");
Assert.IsNotNull ((float?) new XElement (m), "m:float?:null");
Assert.AreEqual (float.NegativeInfinity, ((float?) new XElement (m)).Value, "m:float?:value");
Assert.IsNotNull ((float?) new XElement (n), "n:float?:null");
- Assert.IsNaN (((float?) new XElement (n)).Value, "n:float?:value");
+ Assert.AreEqual (float.NaN, ((float?) new XElement (n)).Value, "n:float?:value");
AssertThrows<FormatException> (() => { Guid? z = (Guid?) new XElement (a); }, "a:Guid?");
AssertThrows<FormatException> (() => { Guid? z = (Guid?) new XElement (b); }, "b:Guid?");
AssertThrows<FormatException> (() => { Guid? z = (Guid?) new XElement (c); }, "c:Guid?");
Assert.AreEqual (double.PositiveInfinity, (double) new XElement (i), "i:double");
Assert.AreEqual (double.NegativeInfinity, (double) new XElement (M), "M:double");
Assert.AreEqual (double.NegativeInfinity, (double) new XElement (m), "m:double");
- Assert.IsNaN (((double) new XElement (n)), "n:double");
+ Assert.AreEqual (double.NaN, ((double) new XElement (n)), "n:double");
Assert.AreEqual (7f, (float) new XElement (a), "a:float");
Assert.AreEqual (42f, (float) new XElement (b), "b:float");
Assert.AreEqual (13f, (float) new XElement (c), "c:float");
Assert.AreEqual (float.PositiveInfinity, (float) new XElement (i), "i:float");
Assert.AreEqual (float.NegativeInfinity, (float) new XElement (M), "M:float");
Assert.AreEqual (float.NegativeInfinity, (float) new XElement (m), "m:float");
- Assert.IsNaN (((float) new XElement (n)), "n:float");
+ Assert.AreEqual (float.NaN, ((float) new XElement (n)), "n:float");
AssertThrows<FormatException> (() => { Guid z = (Guid) new XElement (a); }, "a:Guid");
AssertThrows<FormatException> (() => { Guid z = (Guid) new XElement (b); }, "b:Guid");
AssertThrows<FormatException> (() => { Guid z = (Guid) new XElement (c); }, "c:Guid");
// (C) Stefan Prutianu
//
+#if !MOBILE
+
using NUnit.Framework;
using System;
using System.Xml;
}
}
+
+#endif
\ No newline at end of file