diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index 1f176811de36..4134b04a2eaf 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-t4": {
- "version": "2.2.1",
+ "version": "3.0.0",
"commands": [
"t4"
],
diff --git a/Directory.Build.props b/Directory.Build.props
index d4a1086d9d07..40faa21b2c44 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -22,6 +22,8 @@
6.1.0
4.7.0
4.4.0
+ $(NUnitPackageVersion)
+ 3.8.0
latest
diff --git a/external/Xamarin.MacDev b/external/Xamarin.MacDev
index 95ec821da377..11fad7fe464a 160000
--- a/external/Xamarin.MacDev
+++ b/external/Xamarin.MacDev
@@ -1 +1 @@
-Subproject commit 95ec821da377c2dda841eed4578250cf9469b4ad
+Subproject commit 11fad7fe464a7de7dd809542e4bb352310236052
diff --git a/tests/BundledResources/ResourcesTest.cs b/tests/BundledResources/ResourcesTest.cs
index e22cdc7ec85e..573102ee7133 100644
--- a/tests/BundledResources/ResourcesTest.cs
+++ b/tests/BundledResources/ResourcesTest.cs
@@ -22,9 +22,9 @@ public void Bundled ()
// files are extracted (by MonoDevelop) so we can see them in the file system
// that's true for simulator or devices and whatever the linker settings are
var dir = NSBundle.MainBundle.ResourcePath!;
- Assert.True (File.Exists (Path.Combine (dir, "basn3p08.png")), "file-basn3p08.png");
- Assert.True (File.Exists (Path.Combine (dir, "basn3p08_with_loc.png")), "file-basn3p08_with_loc.png");
- Assert.True (File.Exists (Path.Combine (dir, "xamvideotest.mp4")), "xamvideotest.mp4");
+ Assert.That (File.Exists (Path.Combine (dir, "basn3p08.png")), Is.True, "file-basn3p08.png");
+ Assert.That (File.Exists (Path.Combine (dir, "basn3p08_with_loc.png")), Is.True, "file-basn3p08_with_loc.png");
+ Assert.That (File.Exists (Path.Combine (dir, "xamvideotest.mp4")), Is.True, "xamvideotest.mp4");
// resources are removed by the linker or an extra step (e.g. "link sdk" or "don't link") but that
// extra step is done only on device (to keep the simulator builds as fast as possible)
diff --git a/tests/EmbeddedResources/ResourcesTest.cs b/tests/EmbeddedResources/ResourcesTest.cs
index 04f35a6856e8..e8c83f5d9b08 100644
--- a/tests/EmbeddedResources/ResourcesTest.cs
+++ b/tests/EmbeddedResources/ResourcesTest.cs
@@ -23,13 +23,13 @@ public class ResourcesTest {
public void Embedded ()
{
var manager = new ResourceManager ("EmbeddedResources.Welcome", typeof (ResourcesTest).Assembly);
- Assert.AreEqual ("Welcome", manager.GetString ("String1", new CultureInfo ("en")), "en");
- Assert.AreEqual ("G'day", manager.GetString ("String1", new CultureInfo ("en-AU")), "en-AU");
- Assert.AreEqual ("Willkommen", manager.GetString ("String1", new CultureInfo ("de")), "de");
- Assert.AreEqual ("Willkommen", manager.GetString ("String1", new CultureInfo ("de-DE")), "de-DE");
- Assert.AreEqual ("Bienvenido", manager.GetString ("String1", new CultureInfo ("es")), "es");
- Assert.AreEqual ("Bienvenido", manager.GetString ("String1", new CultureInfo ("es-AR")), "es-AR");
- Assert.AreEqual ("Bienvenido", manager.GetString ("String1", new CultureInfo ("es-ES")), "es-ES");
+ Assert.That (manager.GetString ("String1", new CultureInfo ("en")), Is.EqualTo ("Welcome"), "en");
+ Assert.That (manager.GetString ("String1", new CultureInfo ("en-AU")), Is.EqualTo ("G'day"), "en-AU");
+ Assert.That (manager.GetString ("String1", new CultureInfo ("de")), Is.EqualTo ("Willkommen"), "de");
+ Assert.That (manager.GetString ("String1", new CultureInfo ("de-DE")), Is.EqualTo ("Willkommen"), "de-DE");
+ Assert.That (manager.GetString ("String1", new CultureInfo ("es")), Is.EqualTo ("Bienvenido"), "es");
+ Assert.That (manager.GetString ("String1", new CultureInfo ("es-AR")), Is.EqualTo ("Bienvenido"), "es-AR");
+ Assert.That (manager.GetString ("String1", new CultureInfo ("es-ES")), Is.EqualTo ("Bienvenido"), "es-ES");
}
}
}
diff --git a/tests/bindings-test/ProtocolTest.cs b/tests/bindings-test/ProtocolTest.cs
index 5667a8d478a2..5b3cc8285760 100644
--- a/tests/bindings-test/ProtocolTest.cs
+++ b/tests/bindings-test/ProtocolTest.cs
@@ -35,23 +35,23 @@ public void Constructors ()
using var dateNow = (NSDate) DateTime.Now;
using (var obj = IConstructorProtocol.CreateInstance ("Hello world")!) {
- Assert.AreEqual ("Hello world", obj.StringValue, "A StringValue");
- Assert.IsNull (obj.DateValue, "A DateValue");
+ Assert.That (obj.StringValue, Is.EqualTo ("Hello world"), "A StringValue");
+ Assert.That (obj.DateValue, Is.Null, "A DateValue");
}
using (var obj = IConstructorProtocol.CreateInstance (dateNow)!) {
- Assert.IsNull (obj.StringValue, "B StringValue");
- Assert.AreEqual (dateNow, obj.DateValue, "B DateValue");
+ Assert.That (obj.StringValue, Is.Null, "B StringValue");
+ Assert.That (obj.DateValue, Is.EqualTo (dateNow), "B DateValue");
}
using (var obj = IConstructorProtocol.CreateInstance ("Hello Subclassed")!) {
- Assert.AreEqual ("Hello Subclassed", obj.StringValue, "C1 StringValue");
- Assert.IsNull (obj.DateValue, "C1 DateValue");
+ Assert.That (obj.StringValue, Is.EqualTo ("Hello Subclassed"), "C1 StringValue");
+ Assert.That (obj.DateValue, Is.Null, "C1 DateValue");
}
using (var obj = IConstructorProtocol.CreateInstance (dateNow)!) {
- Assert.IsNull (obj.StringValue, "C2 StringValue");
- Assert.AreEqual (dateNow, obj.DateValue, "C2 DateValue");
+ Assert.That (obj.StringValue, Is.Null, "C2 StringValue");
+ Assert.That (obj.DateValue, Is.EqualTo (dateNow), "C2 DateValue");
}
if (global::XamarinTests.ObjCRuntime.Registrar.IsDynamicRegistrar) {
@@ -60,8 +60,8 @@ public void Constructors ()
}, "D1 Exception");
} else {
using (var obj = IConstructorProtocol.CreateInstance ("Hello Subclassed 2")!) {
- Assert.AreEqual ("Managed interceptor! Hello Subclassed 2", obj.StringValue, "D1 StringValue");
- Assert.IsNull (obj.DateValue, "D1 DateValue");
+ Assert.That (obj.StringValue, Is.EqualTo ("Managed interceptor! Hello Subclassed 2"), "D1 StringValue");
+ Assert.That (obj.DateValue, Is.Null, "D1 DateValue");
}
}
@@ -71,8 +71,8 @@ public void Constructors ()
}, "D2 Exception");
} else {
using (var obj = IConstructorProtocol.CreateInstance (dateNow)!) {
- Assert.IsNull (obj.StringValue, "D2 StringValue");
- Assert.AreEqual (dateNow.AddSeconds (42), obj.DateValue, "D2 DateValue");
+ Assert.That (obj.StringValue, Is.Null, "D2 StringValue");
+ Assert.That (obj.DateValue, Is.EqualTo (dateNow.AddSeconds (42)), "D2 DateValue");
}
}
}
@@ -107,27 +107,27 @@ public void OnlyProtocol ()
// the interface must be created
var IP1 = bindingAssembly.GetType ("Bindings.Test.Protocol.IP1")!;
- Assert.IsNotNull (IP1, "IP1");
+ Assert.That (IP1, Is.Not.Null, "IP1");
// with a [Protocol] attribute
var IP1Attributes = IP1.GetCustomAttributes (typeof (ProtocolAttribute), false);
if (HasProtocolAttributes) {
- Assert.AreEqual (1, IP1Attributes.Length, "[Protocol] IP1");
+ Assert.That (IP1Attributes.Length, Is.EqualTo (1), "[Protocol] IP1");
var IP1Protocol = (ProtocolAttribute) IP1Attributes [0];
- Assert.AreEqual ("P1", IP1Protocol.Name, "Name");
+ Assert.That (IP1Protocol.Name, Is.EqualTo ("P1"), "Name");
// and a wrapper type
var wrapperType = bindingAssembly.GetType ("Bindings.Test.Protocol.P1Wrapper");
- Assert.IsNotNull (wrapperType, "P1_Wrapper");
- Assert.AreEqual (wrapperType, IP1Protocol.WrapperType, "WrapperType");
+ Assert.That (wrapperType, Is.Not.Null, "P1_Wrapper");
+ Assert.That (IP1Protocol.WrapperType, Is.EqualTo (wrapperType), "WrapperType");
} else {
- Assert.AreEqual (0, IP1Attributes.Length, "[Protocol] IP1");
+ Assert.That (IP1Attributes.Length, Is.EqualTo (0), "[Protocol] IP1");
// and a wrapper type
var wrapperType = bindingAssembly.GetType ("Bindings.Test.Protocol.P1Wrapper");
- Assert.IsNotNull (wrapperType, "P1_Wrapper");
+ Assert.That (wrapperType, Is.Not.Null, "P1_Wrapper");
}
// but not the model
- Assert.IsNull (bindingAssembly.GetType ("Bindings.Test.Protocol.P1"), "P1");
+ Assert.That (bindingAssembly.GetType ("Bindings.Test.Protocol.P1"), Is.Null, "P1");
}
[Test]
@@ -139,32 +139,32 @@ public void ProtocolWithBaseType ()
// the interface must be created
var IP2 = bindingAssembly.GetType ("Bindings.Test.Protocol.IP2")!;
- Assert.IsNotNull (IP2, "IP2");
+ Assert.That (IP2, Is.Not.Null, "IP2");
// with a [Protocol] attribute
var IP2Attributes = IP2.GetCustomAttributes (typeof (ProtocolAttribute), false);
if (HasProtocolAttributes) {
- Assert.AreEqual (1, IP2Attributes.Length, "[Protocol] IP2");
+ Assert.That (IP2Attributes.Length, Is.EqualTo (1), "[Protocol] IP2");
var IP2Protocol = (ProtocolAttribute) IP2Attributes [0];
- Assert.AreEqual ("P2", IP2Protocol.Name, "Name");
+ Assert.That (IP2Protocol.Name, Is.EqualTo ("P2"), "Name");
// and a wrapper type
var wrapperType = bindingAssembly.GetType ("Bindings.Test.Protocol.P2Wrapper");
- Assert.IsNotNull (wrapperType, "P2_Wrapper");
- Assert.AreEqual (wrapperType, IP2Protocol.WrapperType, "WrapperType");
+ Assert.That (wrapperType, Is.Not.Null, "P2_Wrapper");
+ Assert.That (IP2Protocol.WrapperType, Is.EqualTo (wrapperType), "WrapperType");
} else {
- Assert.AreEqual (0, IP2Attributes.Length, "[Protocol] IP2");
+ Assert.That (IP2Attributes.Length, Is.EqualTo (0), "[Protocol] IP2");
// and a wrapper type
var wrapperType = bindingAssembly.GetType ("Bindings.Test.Protocol.P2Wrapper");
- Assert.IsNotNull (wrapperType, "P2_Wrapper");
+ Assert.That (wrapperType, Is.Not.Null, "P2_Wrapper");
}
// and a model-like class
var model = bindingAssembly.GetType ("Bindings.Test.Protocol.P2")!;
- Assert.IsNotNull (model, "P2");
+ Assert.That (model, Is.Not.Null, "P2");
// but without the [Model] attribute
- Assert.False (model.IsDefined (typeof (ModelAttribute), false), "model");
+ Assert.That (model.IsDefined (typeof (ModelAttribute), false), Is.False, "model");
}
[Test]
@@ -176,32 +176,32 @@ public void ProtocolWithBaseTypeAndModel ()
// the interface must be created
var IP3 = bindingAssembly.GetType ("Bindings.Test.Protocol.IP3")!;
- Assert.IsNotNull (IP3, "IP3");
+ Assert.That (IP3, Is.Not.Null, "IP3");
// with a [Protocol] attribute
var IP3Attributes = IP3.GetCustomAttributes (typeof (ProtocolAttribute), false);
if (HasProtocolAttributes) {
- Assert.AreEqual (1, IP3Attributes.Length, "[Protocol] IP3");
+ Assert.That (IP3Attributes.Length, Is.EqualTo (1), "[Protocol] IP3");
var IP3Protocol = (ProtocolAttribute) IP3Attributes [0];
- Assert.AreEqual ("P3", IP3Protocol.Name, "Name");
+ Assert.That (IP3Protocol.Name, Is.EqualTo ("P3"), "Name");
// and a wrapper type
var wrapperType = bindingAssembly.GetType ("Bindings.Test.Protocol.P3Wrapper");
- Assert.IsNotNull (wrapperType, "P3_Wrapper");
- Assert.AreEqual (wrapperType, IP3Protocol.WrapperType, "WrapperType");
+ Assert.That (wrapperType, Is.Not.Null, "P3_Wrapper");
+ Assert.That (IP3Protocol.WrapperType, Is.EqualTo (wrapperType), "WrapperType");
} else {
- Assert.AreEqual (0, IP3Attributes.Length, "[Protocol] IP3");
+ Assert.That (IP3Attributes.Length, Is.EqualTo (0), "[Protocol] IP3");
// and a wrapper type
var wrapperType = bindingAssembly.GetType ("Bindings.Test.Protocol.P3Wrapper");
- Assert.IsNotNull (wrapperType, "P3_Wrapper");
+ Assert.That (wrapperType, Is.Not.Null, "P3_Wrapper");
}
// and a model class
var model = bindingAssembly.GetType ("Bindings.Test.Protocol.P3")!;
- Assert.IsNotNull (model, "P3");
+ Assert.That (model, Is.Not.Null, "P3");
// with a [Model] attribute
- Assert.True (model.IsDefined (typeof (ModelAttribute), false), "model");
+ Assert.That (model.IsDefined (typeof (ModelAttribute), false), Is.True, "model");
}
class MembersImplementation : NSObject, Bindings.Test.Protocol.IMemberAttributes {
@@ -230,14 +230,14 @@ void CleanupSignatures (objc_method_description [] methods)
public void ProtocolMembers ()
{
IntPtr protocol = objc_getProtocol ("MemberAttributes");
- Assert.AreNotEqual (IntPtr.Zero, protocol, "a");
+ Assert.That (protocol, Is.Not.EqualTo (IntPtr.Zero), "a");
objc_method_description [] methods;
// Required instance methods
methods = protocol_copyMethodDescriptionList (protocol, true, true);
CleanupSignatures (methods);
- Assert.AreEqual (4, methods.Length, "Required Instance Methods: Count");
+ Assert.That (methods.Length, Is.EqualTo (4), "Required Instance Methods: Count");
AssertContains (methods, new objc_method_description ("requiredInstanceMethod", "v@:"), "Required Instance Methods: requiredInstanceMethod");
AssertContains (methods, new objc_method_description ("requiredInstanceProperty", "@@:"), "Required Instance Methods: requiredInstanceProperty");
AssertContains (methods, new objc_method_description ("setRequiredInstanceProperty:", "v@:@"), "Required Instance Methods: setRequiredInstanceProperty");
@@ -246,7 +246,7 @@ public void ProtocolMembers ()
// Required static methods
methods = protocol_copyMethodDescriptionList (protocol, true, false);
CleanupSignatures (methods);
- Assert.AreEqual (3, methods.Length, "Required Static Methods: Count");
+ Assert.That (methods.Length, Is.EqualTo (3), "Required Static Methods: Count");
AssertContains (methods, new objc_method_description ("requiredStaticMethod", "v@:"), "Required Static Methods: requiredStaticMethod");
AssertContains (methods, new objc_method_description ("setRequiredStaticProperty:", "v@:@"), "Required Static Methods: setRequiredStaticProperty:");
AssertContains (methods, new objc_method_description ("requiredStaticProperty", "@@:"), "Required Static Methods: requiredStaticProperty");
@@ -254,7 +254,7 @@ public void ProtocolMembers ()
// Optional instance methods
methods = protocol_copyMethodDescriptionList (protocol, false, true);
CleanupSignatures (methods);
- Assert.AreEqual (19, methods.Length, "Optional Instance Methods: Count");
+ Assert.That (methods.Length, Is.EqualTo (19), "Optional Instance Methods: Count");
AssertContains (methods, new objc_method_description ("variadicMethod:", "v@:^v"), "Optional Instance Methods: variadicMethod:");
AssertContains (methods, new objc_method_description ("methodWithReturnType", "@@:"), "Optional Instance Methods: methodWithReturnType");
AssertContains (methods, new objc_method_description ("methodWithParameter:", "v@:i"), "Optional Instance Methods: methodWithParameter:");
@@ -278,7 +278,7 @@ public void ProtocolMembers ()
// Optional static methods
methods = protocol_copyMethodDescriptionList (protocol, false, false);
CleanupSignatures (methods);
- Assert.AreEqual (3, methods.Length, "Optional Static Methods: Count");
+ Assert.That (methods.Length, Is.EqualTo (3), "Optional Static Methods: Count");
AssertContains (methods, new objc_method_description ("optionalStaticMethod", "v@:"), "Optional Static Methods: optionalStaticMethod");
AssertContains (methods, new objc_method_description ("optionalStaticProperty", "@@:"), "Optional Static Methods: optionalStaticProperty");
AssertContains (methods, new objc_method_description ("setOptionalStaticProperty:", "v@:@"), "Optional Static Methods: setOptionalStaticProperty:");
@@ -290,9 +290,9 @@ public void ProtocolMembers ()
// see file objc4-647/runtime/objc-runtime-old.mm in Apple's open source code),
// so we need to verify differently for the dynamic registrar.
if (XamarinTests.ObjCRuntime.Registrar.IsStaticRegistrar) {
- Assert.AreEqual (9, properties.Length, "Properties: Count");
+ Assert.That (properties.Length, Is.EqualTo (9), "Properties: Count");
} else {
- Assert.AreEqual (2, properties.Length, "Properties: Count");
+ Assert.That (properties.Length, Is.EqualTo (2), "Properties: Count");
}
AssertContains (properties, new objc_property ("requiredInstanceProperty", "T@\"NSString\",N", new objc_property_attribute [] {
diff --git a/tests/bindings-test/RegistrarBindingTest.cs b/tests/bindings-test/RegistrarBindingTest.cs
index 93bba2d9c9e2..fb3cf6821c83 100644
--- a/tests/bindings-test/RegistrarBindingTest.cs
+++ b/tests/bindings-test/RegistrarBindingTest.cs
@@ -57,7 +57,7 @@ public static void OptionalStaticCallback (Action completionHandler)
public Action RequiredReturnValue ()
{
return new Action ((v) => {
- Assert.AreEqual (42, v, "RequiredReturnValue");
+ Assert.That (v, Is.EqualTo (42), "RequiredReturnValue");
});
}
@@ -65,7 +65,7 @@ public Action RequiredReturnValue ()
public Action OptionalReturnValue ()
{
return new Action ((v) => {
- Assert.AreEqual (42, v, "RequiredReturnValue");
+ Assert.That (v, Is.EqualTo (42), "RequiredReturnValue");
});
}
@@ -73,7 +73,7 @@ public Action OptionalReturnValue ()
public static Action RequiredStaticReturnValue ()
{
return new Action ((v) => {
- Assert.AreEqual (42, v, "RequiredReturnValue");
+ Assert.That (v, Is.EqualTo (42), "RequiredReturnValue");
});
}
@@ -81,7 +81,7 @@ public static Action RequiredStaticReturnValue ()
public static Action OptionalStaticReturnValue ()
{
return new Action ((v) => {
- Assert.AreEqual (42, v, "RequiredReturnValue");
+ Assert.That (v, Is.EqualTo (42), "RequiredReturnValue");
});
}
}
@@ -99,10 +99,10 @@ public void DerivedClassBlockCallback ()
ObjCBlockTester.CallOptionalStaticCallback ();
DerivedBlockCallbackClass.Answer = 2;
- Assert.IsFalse (obj.InvokeNullableCallbackNatively (null), "NullableCallback A rv");
+ Assert.That (obj.InvokeNullableCallbackNatively (null), Is.False, "NullableCallback A rv");
int nullableResult = -1;
- Assert.IsTrue (obj.InvokeNullableCallbackNatively ((v) => nullableResult = v), "NullableCallback B rv");
- Assert.AreEqual (24, nullableResult, "NullableCallback result");
+ Assert.That (obj.InvokeNullableCallbackNatively ((v) => nullableResult = v), Is.True, "NullableCallback B rv");
+ Assert.That (nullableResult, Is.EqualTo (24), "NullableCallback result");
}
}
@@ -141,7 +141,7 @@ public static void OptionalStaticCallback (Action completionHandler)
public override Action RequiredReturnValue ()
{
return new Action ((v) => {
- Assert.AreEqual (Answer, v, "RequiredReturnValue");
+ Assert.That (v, Is.EqualTo (Answer), "RequiredReturnValue");
});
}
@@ -150,7 +150,7 @@ public Action OptionalReturnValue ()
{
return new Action ((v) => {
Console.WriteLine ("OptionalReturnValue");
- Assert.AreEqual (Answer, v, "RequiredReturnValue");
+ Assert.That (v, Is.EqualTo (Answer), "RequiredReturnValue");
});
}
@@ -158,7 +158,7 @@ public Action OptionalReturnValue ()
public static Action RequiredStaticReturnValue ()
{
return new Action ((v) => {
- Assert.AreEqual (Answer, v, "RequiredReturnValue");
+ Assert.That (v, Is.EqualTo (Answer), "RequiredReturnValue");
});
}
@@ -167,7 +167,7 @@ public static Action OptionalStaticReturnValue ()
{
return new Action ((v) => {
Console.WriteLine ("OptionalStaticReturnValue");
- Assert.AreEqual (Answer, v, "RequiredReturnValue");
+ Assert.That (v, Is.EqualTo (Answer), "RequiredReturnValue");
});
}
}
@@ -201,7 +201,7 @@ public static void OptionalRequiredCallback (Action completionHandler)
Action IObjCProtocolBlockTest.RequiredReturnValue ()
{
return new Action ((v) => {
- Assert.AreEqual (42, v, "RequiredReturnValue");
+ Assert.That (v, Is.EqualTo (42), "RequiredReturnValue");
});
}
@@ -209,7 +209,7 @@ Action IObjCProtocolBlockTest.RequiredReturnValue ()
public Action OptionalReturnValue ()
{
return new Action ((v) => {
- Assert.AreEqual (42, v, "RequiredReturnValue");
+ Assert.That (v, Is.EqualTo (42), "RequiredReturnValue");
});
}
@@ -217,7 +217,7 @@ public Action OptionalReturnValue ()
public static Action RequiredStaticReturnValue ()
{
return new Action ((v) => {
- Assert.AreEqual (42, v, "RequiredReturnValue");
+ Assert.That (v, Is.EqualTo (42), "RequiredReturnValue");
});
}
@@ -225,7 +225,7 @@ public static Action RequiredStaticReturnValue ()
public static Action OptionalStaticReturnValue ()
{
return new Action ((v) => {
- Assert.AreEqual (42, v, "RequiredReturnValue");
+ Assert.That (v, Is.EqualTo (42), "RequiredReturnValue");
});
}
}
@@ -311,7 +311,7 @@ public void ProtocolWithBlockProperties (bool required, bool instance)
}
}
ObjCBlockTester.CallProtocolWithBlockProperties (pb, required, instance);
- Assert.IsTrue (callbackCalled, "Callback");
+ Assert.That (callbackCalled, Is.True, "Callback");
}
}
@@ -338,7 +338,7 @@ public void ProtocolWithNativeBlockProperties (bool required, bool instance)
PropertyBlock.MyOptionalStaticProperty! ();
}
}
- Assert.AreEqual (calledCounter + 1, ObjCBlockTester.CalledBlockCount, "Blocks called");
+ Assert.That (ObjCBlockTester.CalledBlockCount, Is.EqualTo (calledCounter + 1), "Blocks called");
}
}
[Test]
@@ -372,7 +372,7 @@ public void LinkedAway (bool required, bool instance)
if (re.Code == 8009) {
Assert.That (re.Message, Does.StartWith ("Unable to locate the block to delegate conversion method for the method Xamarin.BindingTests.RegistrarBindingTest+FakePropertyBlock.set_"), re.Message, "Message");
} else {
- Assert.AreEqual ("The runtime function get_block_wrapper_creator has been linked away.", re.Message, "Message");
+ Assert.That (re.Message, Is.EqualTo ("The runtime function get_block_wrapper_creator has been linked away."), "Message");
}
}
}
diff --git a/tests/bindings-test/RuntimeTest.cs b/tests/bindings-test/RuntimeTest.cs
index aea647585f60..f445ec7bca9e 100644
--- a/tests/bindings-test/RuntimeTest.cs
+++ b/tests/bindings-test/RuntimeTest.cs
@@ -9,7 +9,7 @@ public class RuntimeTest {
[Test]
public void GlobalStringTest ()
{
- Assert.AreEqual ("There's nothing cruvus here!", (string) Globals.GlobalString, "Global string");
+ Assert.That ((string) Globals.GlobalString, Is.EqualTo ("There's nothing cruvus here!"), "Global string");
}
[Test]
@@ -95,7 +95,7 @@ public void SwiftTest ()
{
TestRuntime.AssertXcodeVersion (13, 0);
using var obj = new SwiftTestClass ();
- Assert.AreEqual ("Hello from Swift", obj.SayHello (), "Hello");
+ Assert.That (obj.SayHello (), Is.EqualTo ("Hello from Swift"), "Hello");
}
[Test]
@@ -105,18 +105,18 @@ public void SwiftTypeEncodings ()
using var obj = new SwiftTestClass ();
- Assert.AreEqual ("42", obj.DoSomething ("42"), "DoSomething");
+ Assert.That (obj.DoSomething ("42"), Is.EqualTo ("42"), "DoSomething");
string? asyncResult = null;
obj.DoSomethingAsync ("dolphins", (v) => asyncResult = v);
var done = TestRuntime.RunAsync (TimeSpan.FromSeconds (5), () => asyncResult is not null);
- Assert.AreEqual ("dolphins", asyncResult, "DoSomethingAsync");
- Assert.IsTrue (done, "Done");
+ Assert.That (asyncResult, Is.EqualTo ("dolphins"), "DoSomethingAsync");
+ Assert.That (done, Is.True, "Done");
obj.DoSomethingComplexAsync ("fish", IntPtr.Zero, (v) => asyncResult = v);
done = TestRuntime.RunAsync (TimeSpan.FromSeconds (5), () => asyncResult is not null);
- Assert.AreEqual ("fish", asyncResult, "DoSomethingComplexAsync");
- Assert.IsTrue (done, "Done 2");
+ Assert.That (asyncResult, Is.EqualTo ("fish"), "DoSomethingComplexAsync");
+ Assert.That (done, Is.True, "Done 2");
}
[Test]
@@ -124,7 +124,7 @@ public void SwiftTestClass2 ()
{
TestRuntime.AssertXcodeVersion (13, 0);
using var obj = new SwiftTestClass2 ();
- Assert.AreEqual ("Hello from Swift 2", obj.SayHello2 (), "Hello");
+ Assert.That (obj.SayHello2 (), Is.EqualTo ("Hello from Swift 2"), "Hello");
}
[Test]
diff --git a/tests/bindings-test2/BindingTest.cs b/tests/bindings-test2/BindingTest.cs
index 7da68e8bbfc5..803e3bf91624 100644
--- a/tests/bindings-test2/BindingTest.cs
+++ b/tests/bindings-test2/BindingTest.cs
@@ -9,8 +9,8 @@ public class BindingTest {
[Test]
public void Test ()
{
- Assert.AreEqual (42, CFunctions.getIntOfChocolate (), "chocolate");
- Assert.AreEqual (42, Bindings.Test.CFunctions.theUltimateAnswer (), "theUltimateAnswer");
+ Assert.That (CFunctions.getIntOfChocolate (), Is.EqualTo (42), "chocolate");
+ Assert.That (Bindings.Test.CFunctions.theUltimateAnswer (), Is.EqualTo (42), "theUltimateAnswer");
}
}
}
diff --git a/tests/common/Assert.cs b/tests/common/Assert.cs
index 5f1b7bb0f344..e16866ee8362 100644
--- a/tests/common/Assert.cs
+++ b/tests/common/Assert.cs
@@ -92,7 +92,7 @@ protected virtual void SetUp ()
public static void Assert (string msg, bool condition)
{
- NUnit.Framework.Assert.True (condition, msg);
+ Assert.That (condition, Is.True, msg);
}
public static void AssertEquals (object a, object b)
diff --git a/tests/common/AssertHelpers.cs b/tests/common/AssertHelpers.cs
index cb4aba3fe4ca..4975c7d26110 100644
--- a/tests/common/AssertHelpers.cs
+++ b/tests/common/AssertHelpers.cs
@@ -11,7 +11,7 @@ public static void Throws (Action action, string expectedExceptionMessage, st
action ();
throw new AssertionException (string.Format ("Expected {0}, but no exception was thrown. {1}.", typeof (T).FullName, message));
} catch (T ex) {
- Assert.AreEqual (expectedExceptionMessage, ex.Message, message);
+ Assert.That (ex.Message, Is.EqualTo (expectedExceptionMessage), message);
}
}
diff --git a/tests/common/BundlerTool.cs b/tests/common/BundlerTool.cs
index 7a5754620653..3f45c28b1bf7 100644
--- a/tests/common/BundlerTool.cs
+++ b/tests/common/BundlerTool.cs
@@ -321,7 +321,7 @@ public virtual void AssertExecute (string message = null)
public void AssertExecuteFailure (string message = null)
{
- Assert.AreEqual (1, Execute (), message);
+ Assert.That (Execute (), Is.EqualTo (1), message);
}
public abstract void CreateTemporaryApp (Profile profile, string appName = "testApp", string code = null, IList extraArgs = null, string extraCode = null, string usings = null);
diff --git a/tests/common/ProductTests.cs b/tests/common/ProductTests.cs
index ec1d1bc53569..8d4a4d3d1063 100644
--- a/tests/common/ProductTests.cs
+++ b/tests/common/ProductTests.cs
@@ -71,7 +71,7 @@ public void MinOSVersion (Profile profile, MachO.LoadCommands load_command, Mach
Version lc_min_version;
var mincmd = lc as MinCommand;
if (mincmd is not null) {
- Assert.AreEqual (load_command, mincmd.Command, "Unexpected min load command");
+ Assert.That (mincmd.Command, Is.EqualTo (load_command), "Unexpected min load command");
lc_min_version = mincmd.Version;
} else {
// starting from iOS SDK 12 the LC_BUILD_VERSION is used instead
@@ -159,7 +159,7 @@ public void MinOSVersion (Profile profile, MachO.LoadCommands load_command, Mach
failed.Add ($"No minOS version found in {machoFile}.");
}
}
- CollectionAssert.IsEmpty (failed, "Failures");
+ Assert.That (failed, Is.Empty, "Failures");
}
}
diff --git a/tests/common/TestRuntime.cs b/tests/common/TestRuntime.cs
index 7c4f957c0c70..04d1ef2e23f4 100644
--- a/tests/common/TestRuntime.cs
+++ b/tests/common/TestRuntime.cs
@@ -210,7 +210,7 @@ public static void AssertXcodeVersion (int major, int minor, int build = 0)
if (CheckXcodeVersion (major, minor, build))
return;
- NUnit.Framework.Assert.Ignore ("Requires the platform version shipped with Xcode {0}.{1}", major, minor);
+ NUnit.Framework.Assert.Ignore ($"Requires the platform version shipped with Xcode {major}.{minor}");
}
public static void AssertDevice (string message = "This test only runs on device.")
@@ -1857,7 +1857,7 @@ public static void AssertNoNonNUnitException (Exception ex, string message)
case InconclusiveException: throw new InconclusiveException (ex.Message, ex);
case ResultStateException: throw ex;
default:
- Assert.IsNull (ex, message);
+ Assert.That (ex, Is.Null, message);
break;
}
}
diff --git a/tests/common/Touch.Unit/Touch.Client/Runner/TestResultElement.cs b/tests/common/Touch.Unit/Touch.Client/Runner/TestResultElement.cs
index 880741dcc9a2..c9f1ef8af194 100644
--- a/tests/common/Touch.Unit/Touch.Client/Runner/TestResultElement.cs
+++ b/tests/common/Touch.Unit/Touch.Client/Runner/TestResultElement.cs
@@ -32,7 +32,7 @@ namespace MonoTouch.NUnit.UI {
class TestResultElement : StyledMultilineElement {
public TestResultElement (TestResult result) :
- base (result.Message ?? "Unknown error", result.StackTrace, UITableViewCellStyle.Subtitle)
+ base (result.Message ?? "Unknown error", result.StackTrace ?? "", UITableViewCellStyle.Subtitle)
{
}
}
diff --git a/tests/common/Touch.Unit/Touch.Client/Runner/TouchRunner.cs b/tests/common/Touch.Unit/Touch.Client/Runner/TouchRunner.cs
index a2a873e133e8..1c23046fb905 100644
--- a/tests/common/Touch.Unit/Touch.Client/Runner/TouchRunner.cs
+++ b/tests/common/Touch.Unit/Touch.Client/Runner/TouchRunner.cs
@@ -568,8 +568,8 @@ public virtual void TestFinished (ITestResult r)
#endif
string? stacktrace = result.StackTrace;
- if (!String.IsNullOrEmpty (result.StackTrace)) {
- string [] lines = stacktrace.Split (new char [] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
+ if (!String.IsNullOrEmpty (stacktrace)) {
+ string [] lines = stacktrace!.Split (new char [] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string line in lines)
writer.WriteLine ("\t\t{0}", line);
}
@@ -689,9 +689,11 @@ public void Run (Test test)
var tsr = new TestSuiteResult (suite);
foreach (var runner in runners) {
- var rv = (TestResult) (find_result (runner.Result) ?? runner.Result);
- if (rv is not null)
- tsr.AddResult (rv);
+ var runnerResult = runner.Result is not null ? (find_result (runner.Result) ?? runner.Result) : null;
+ if (runnerResult is null)
+ continue;
+ var rv = (TestResult) runnerResult;
+ tsr.AddResult (rv);
}
Result = tsr;
#else
diff --git a/tests/common/Touch.Unit/Touch.Client/dotnet/shared.csproj b/tests/common/Touch.Unit/Touch.Client/dotnet/shared.csproj
index ada75cd79283..97edb9f41e74 100644
--- a/tests/common/Touch.Unit/Touch.Client/dotnet/shared.csproj
+++ b/tests/common/Touch.Unit/Touch.Client/dotnet/shared.csproj
@@ -55,10 +55,10 @@
- 3.12.0
+ $(NUnitLitePackageVersion)
- 3.6.0
+ $(NUnitV2ResultWriterPackageVersion)
6.12.0.148
diff --git a/tests/common/shared-dotnet.csproj b/tests/common/shared-dotnet.csproj
index 06243b83489f..8c3e83197315 100644
--- a/tests/common/shared-dotnet.csproj
+++ b/tests/common/shared-dotnet.csproj
@@ -107,7 +107,7 @@
-
+
diff --git a/tests/dotnet/UnitTests/AppIconTest.cs b/tests/dotnet/UnitTests/AppIconTest.cs
index e8bea97b7c7e..970676172b53 100644
--- a/tests/dotnet/UnitTests/AppIconTest.cs
+++ b/tests/dotnet/UnitTests/AppIconTest.cs
@@ -656,7 +656,7 @@ void TestXCAssetsImpl (ApplePlatform platform, string runtimeIdentifiers, Dictio
try {
var doc = AssetsTest.ProcessAssets (assetsCar, AssetsTest.GetFullSdkVersion (platform, runtimeIdentifiers));
- Assert.IsNotNull (doc, "There was an issue processing the asset binary.");
+ Assert.That (doc, Is.Not.Null, "There was an issue processing the asset binary.");
var foundAssets = AssetsTest.FindAssets (platform, doc);
@@ -666,7 +666,7 @@ void TestXCAssetsImpl (ApplePlatform platform, string runtimeIdentifiers, Dictio
expectedAssets.Add (asset);
}
- CollectionAssert.AreEquivalent (expectedAssets, foundAssets, "Incorrect assets");
+ Assert.That (foundAssets, Is.EquivalentTo (expectedAssets), "Incorrect assets");
} catch {
Console.WriteLine ($"Assets.car: {assetsCar}");
throw;
diff --git a/tests/dotnet/UnitTests/AssetsTest.cs b/tests/dotnet/UnitTests/AssetsTest.cs
index 0f2655513ca4..3466457299e9 100644
--- a/tests/dotnet/UnitTests/AssetsTest.cs
+++ b/tests/dotnet/UnitTests/AssetsTest.cs
@@ -55,7 +55,7 @@ void TestXCAssetsImpl (ApplePlatform platform, string runtimeIdentifiers, bool i
Assert.That (assetsCar, Does.Exist, "Assets.car");
var doc = ProcessAssets (assetsCar, GetFullSdkVersion (platform, runtimeIdentifiers));
- Assert.IsNotNull (doc, "There was an issue processing the asset binary.");
+ Assert.That (doc, Is.Not.Null, "There was an issue processing the asset binary.");
var foundAssets = FindAssets (platform, doc);
@@ -78,12 +78,12 @@ void TestXCAssetsImpl (ApplePlatform platform, string runtimeIdentifiers, bool i
throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}");
}
- CollectionAssert.AreEquivalent (expectedAssets, foundAssets, $"Incorrect assets in {assetsCar}");
+ Assert.That (foundAssets, Is.EquivalentTo (expectedAssets), $"Incorrect assets in {assetsCar}");
var arm64txt = Path.Combine (resourcesDirectory, "arm64.txt");
var x64txt = Path.Combine (resourcesDirectory, "x64.txt");
- Assert.AreEqual (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-arm64")), File.Exists (arm64txt), "arm64.txt");
- Assert.AreEqual (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-x64")), File.Exists (x64txt), "x64.txt");
+ Assert.That (File.Exists (arm64txt), Is.EqualTo (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-arm64"))), "arm64.txt");
+ Assert.That (File.Exists (x64txt), Is.EqualTo (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-x64"))), "x64.txt");
}
void ConfigureAssets (string projectPath, string runtimeIdentifiers, string config, bool isStartingWithAssets)
@@ -128,7 +128,7 @@ void MakeSymlinks (string sourceDir, string destDir)
var executable = "ln";
var arguments = new string [] { "-s", sourceDir, destDir };
var rv = Execution.RunAsync (executable, arguments, timeout: TimeSpan.FromSeconds (60)).Result;
- Assert.AreEqual (0, rv.ExitCode, $"Creating Symlink Error: {rv.Output.MergedOutput}. Unexpected ExitCode");
+ Assert.That (rv.ExitCode, Is.EqualTo (0), $"Creating Symlink Error: {rv.Output.MergedOutput}. Unexpected ExitCode");
}
public static string GetFullSdkVersion (ApplePlatform platform, string runtimeIdentifiers)
@@ -161,12 +161,12 @@ void ProcessUpdateSymlink (string xcassetsDir)
var assets = Directory.EnumerateFiles (xcassetsDir, "*.*", SearchOption.AllDirectories).ToArray ();
// assets first value is a .DS_Store file that work trigger MSBuild recompile so we want the second value
- Assert.Greater (assets.Length, 1);
+ Assert.That (assets.Length, Is.GreaterThan (1));
var executable = "touch";
var arguments = new string [] { assets [1] };
var rv = Execution.RunAsync (executable, arguments, timeout: TimeSpan.FromSeconds (120)).Result;
- Assert.AreEqual (0, rv.ExitCode, $"Processing Update Symlink Error: {rv.Output.MergedOutput}. Unexpected ExitCode");
+ Assert.That (rv.ExitCode, Is.EqualTo (0), $"Processing Update Symlink Error: {rv.Output.MergedOutput}. Unexpected ExitCode");
}
public static JsonDocument ProcessAssets (string assetsPath, string sdkVersion)
@@ -176,7 +176,7 @@ public static JsonDocument ProcessAssets (string assetsPath, string sdkVersion)
var tmpfile = Path.Combine (tmpdir, "Assets.json");
var arguments = new string [] { "--sdk", sdkVersion, "assetutil", "--info", assetsPath, "-o", tmpfile };
var rv = Execution.RunAsync (executable, arguments, timeout: TimeSpan.FromSeconds (120)).Result;
- Assert.AreEqual (0, rv.ExitCode, $"Processing Assets Error: {rv.Output.StandardError}. Unexpected ExitCode");
+ Assert.That (rv.ExitCode, Is.EqualTo (0), $"Processing Assets Error: {rv.Output.StandardError}. Unexpected ExitCode");
var s = File.ReadAllText (tmpfile);
try {
@@ -212,7 +212,7 @@ public static HashSet FindAssets (ApplePlatform platform, JsonDocument d
case ApplePlatform.MacCatalyst:
case ApplePlatform.iOS:
case ApplePlatform.TVOS:
- Assert.AreEqual ("2", schemaVersion.ToString (), "Verify SchemaVersion");
+ Assert.That (schemaVersion.ToString (), Is.EqualTo ("2"), "Verify SchemaVersion");
break;
default:
throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}");
diff --git a/tests/dotnet/UnitTests/BundleStructureTest.cs b/tests/dotnet/UnitTests/BundleStructureTest.cs
index 13b5f6ca256a..20d21a660f7d 100644
--- a/tests/dotnet/UnitTests/BundleStructureTest.cs
+++ b/tests/dotnet/UnitTests/BundleStructureTest.cs
@@ -311,6 +311,7 @@ internal static void CheckAppBundleContents (ApplePlatform platform, IEnumerable
if (platform != ApplePlatform.MacOSX)
AddMultiRidAssembly (platform, expectedFiles, assemblyDirectory, "MonoTouch.Dialog", runtimeIdentifiers, forceSingleRid: (platform == ApplePlatform.MacCatalyst && !isReleaseBuild), includeDebugFiles: includeDebugFiles);
expectedFiles.Add (Path.Combine (assemblyDirectory, "nunit.framework.dll"));
+ expectedFiles.Add (Path.Combine (assemblyDirectory, "nunit.framework.legacy.dll"));
expectedFiles.Add (Path.Combine (assemblyDirectory, "nunitlite.dll"));
expectedFiles.Add (Path.Combine (assemblyDirectory, "Mono.Options.dll"));
AddMultiRidAssembly (platform, expectedFiles, assemblyDirectory, "Touch.Client", runtimeIdentifiers, platform == ApplePlatform.MacOSX || (platform == ApplePlatform.MacCatalyst && !isReleaseBuild), includeDebugFiles: includeDebugFiles);
@@ -680,7 +681,7 @@ public void Build (ApplePlatform platform, string runtimeIdentifiers, CodeSignat
var appExecutable = GetNativeExecutable (platform, appPath);
CheckAppBundleContents (platform, appPath, rids, signature, isReleaseBuild);
- CollectionAssert.AreEqual (expectedWarnings, warningMessages, "Warnings");
+ Assert.That (warningMessages, Is.EqualTo (expectedWarnings), "Warnings");
ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable);
// touch AppDelegate.cs, and rebuild should succeed and do the right thing
@@ -692,7 +693,7 @@ public void Build (ApplePlatform platform, string runtimeIdentifiers, CodeSignat
warningMessages = FilterWarnings (warnings);
CheckAppBundleContents (platform, appPath, rids, signature, isReleaseBuild);
- CollectionAssert.AreEqual (expectedWarnings, warningMessages, "Warnings Rebuild 1");
+ Assert.That (warningMessages, Is.EqualTo (expectedWarnings), "Warnings Rebuild 1");
ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable);
// remove the bin directory, and rebuild should succeed and do the right thing
@@ -704,7 +705,7 @@ public void Build (ApplePlatform platform, string runtimeIdentifiers, CodeSignat
warningMessages = FilterWarnings (warnings);
CheckAppBundleContents (platform, appPath, rids, signature, isReleaseBuild);
- CollectionAssert.AreEqual (expectedWarnings, warningMessages, "Warnings Rebuild 2");
+ Assert.That (warningMessages, Is.EqualTo (expectedWarnings), "Warnings Rebuild 2");
ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable);
// a simple rebuild should succeed
@@ -713,7 +714,7 @@ public void Build (ApplePlatform platform, string runtimeIdentifiers, CodeSignat
warningMessages = FilterWarnings (warnings);
CheckAppBundleContents (platform, appPath, rids, signature, isReleaseBuild);
- CollectionAssert.AreEqual (expectedWarnings, warningMessages, "Warnings Rebuild 3");
+ Assert.That (warningMessages, Is.EqualTo (expectedWarnings), "Warnings Rebuild 3");
ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable);
}
@@ -794,7 +795,7 @@ static void AssertLibraryArchitectures (string appBundle, string [] runtimeIdent
});
foreach (var lib in libraries) {
var libArchitectures = renderArchitectures (MachO.GetArchitectures (lib));
- Assert.AreEqual (expectedArchitectures, libArchitectures, $"Architectures in {lib}");
+ Assert.That (libArchitectures, Is.EqualTo (expectedArchitectures), $"Architectures in {lib}");
}
}
}
diff --git a/tests/dotnet/UnitTests/DotNetUnitTests.csproj b/tests/dotnet/UnitTests/DotNetUnitTests.csproj
index cacebf7a322e..5a35feef92d1 100644
--- a/tests/dotnet/UnitTests/DotNetUnitTests.csproj
+++ b/tests/dotnet/UnitTests/DotNetUnitTests.csproj
@@ -6,8 +6,8 @@
-
-
+
+
diff --git a/tests/dotnet/UnitTests/Extensions.cs b/tests/dotnet/UnitTests/Extensions.cs
index 1d04abf51f24..ba97980be9a9 100644
--- a/tests/dotnet/UnitTests/Extensions.cs
+++ b/tests/dotnet/UnitTests/Extensions.cs
@@ -96,7 +96,7 @@ public static void AssertWarnings (this IEnumerable actualWarning
Console.WriteLine ($"If this is expected, an updated list of expected warnings in stored in {fn}");
File.WriteAllText (fn, sb.ToString ());
- // Rather than doing an Assert.IsEmpty, which produces a horrendous error message, we'll do an Assert.Multiple which generates a
+ // Rather than doing an Assert.That(..., Is.Empty), which produces a horrendous error message, we'll do an Assert.Multiple which generates a
// nice enumerated output of all the failures.
Assert.Multiple (() => {
// fail for each of the new warnings
diff --git a/tests/dotnet/UnitTests/MauiTest.cs b/tests/dotnet/UnitTests/MauiTest.cs
index cf64f548d8b4..a8f6f3a069ae 100644
--- a/tests/dotnet/UnitTests/MauiTest.cs
+++ b/tests/dotnet/UnitTests/MauiTest.cs
@@ -52,19 +52,19 @@ void BuildMauiAppImpl (ApplePlatform platform, string runtimeIdentifiers, bool d
AssertThatLinkerExecuted (rv);
var infoPlistPath = GetInfoPListPath (platform, appPath);
var infoPlist = PDictionary.FromFile (infoPlistPath)!;
- Assert.AreEqual ("com.xamarin.mymauiapp", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
- Assert.AreEqual ("MyMauiApp", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
- Assert.AreEqual ("1", infoPlist.GetString ("CFBundleVersion").Value, "CFBundleVersion");
- Assert.AreEqual ("1.0", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString");
+ Assert.That (infoPlist.GetString ("CFBundleIdentifier").Value, Is.EqualTo ("com.xamarin.mymauiapp"), "CFBundleIdentifier");
+ Assert.That (infoPlist.GetString ("CFBundleDisplayName").Value, Is.EqualTo ("MyMauiApp"), "CFBundleDisplayName");
+ Assert.That (infoPlist.GetString ("CFBundleVersion").Value, Is.EqualTo ("1"), "CFBundleVersion");
+ Assert.That (infoPlist.GetString ("CFBundleShortVersionString").Value, Is.EqualTo ("1.0"), "CFBundleShortVersionString");
- Assert.IsTrue (BinLog.TryFindPropertyValue (rv.BinLogPath, "TrimMode", out var trimModeValue), "Could not find the property 'TrimMode' in the binlog.");
- Assert.IsTrue (BinLog.TryFindPropertyValue (rv.BinLogPath, "_LinkMode", out var linkModeValue), "Could not find the property '_LinkMode' in the binlog.");
- Assert.IsTrue (BinLog.TryFindPropertyValue (rv.BinLogPath, "MtouchLink", out var mtouchLinkValue), "Could not find the property 'MtouchLink' in the binlog.");
+ Assert.That (BinLog.TryFindPropertyValue (rv.BinLogPath, "TrimMode", out var trimModeValue), Is.True, "Could not find the property 'TrimMode' in the binlog.");
+ Assert.That (BinLog.TryFindPropertyValue (rv.BinLogPath, "_LinkMode", out var linkModeValue), Is.True, "Could not find the property '_LinkMode' in the binlog.");
+ Assert.That (BinLog.TryFindPropertyValue (rv.BinLogPath, "MtouchLink", out var mtouchLinkValue), Is.True, "Could not find the property 'MtouchLink' in the binlog.");
- Assert.AreEqual ("copy", trimModeValue, "TrimMode");
- Assert.AreEqual ("None", linkModeValue, "LinkMode");
- Assert.AreEqual ("None", mtouchLinkValue, "MtouchLink");
+ Assert.That (trimModeValue, Is.EqualTo ("copy"), "TrimMode");
+ Assert.That (linkModeValue, Is.EqualTo ("None"), "LinkMode");
+ Assert.That (mtouchLinkValue, Is.EqualTo ("None"), "MtouchLink");
}
[TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64")]
diff --git a/tests/dotnet/UnitTests/MlaunchTest.cs b/tests/dotnet/UnitTests/MlaunchTest.cs
index fb7c3b9ba8b5..0610eb3f4dd0 100644
--- a/tests/dotnet/UnitTests/MlaunchTest.cs
+++ b/tests/dotnet/UnitTests/MlaunchTest.cs
@@ -48,11 +48,11 @@ public void GetMlaunchInstallArguments (ApplePlatform platform, string runtimeId
expectedArguments.Append ("--installdev ");
expectedArguments.Append (appPath.Substring (Path.GetDirectoryName (project_path)!.Length + 1)).Append ('/');
expectedArguments.Append ($" --wait-for-exit:false");
- Assert.AreEqual (expectedArguments.ToString (), mlaunchInstallArguments);
+ Assert.That (mlaunchInstallArguments, Is.EqualTo (expectedArguments.ToString ()));
var scriptContents = File.ReadAllText (outputPath).Trim ('\n');
var expectedScriptContents = mlaunchPath + " " + expectedArguments.ToString ();
- Assert.AreEqual (expectedScriptContents, scriptContents, "Script contents");
+ Assert.That (scriptContents, Is.EqualTo (expectedScriptContents), "Script contents");
}
public static object [] GetMlaunchRunArgumentsTestCases ()
diff --git a/tests/dotnet/UnitTests/PackTest.cs b/tests/dotnet/UnitTests/PackTest.cs
index a9882a16414a..c5992b43650a 100644
--- a/tests/dotnet/UnitTests/PackTest.cs
+++ b/tests/dotnet/UnitTests/PackTest.cs
@@ -62,8 +62,8 @@ void BindingOldStyleImpl (ApplePlatform platform, Dictionary? pr
var rv = DotNet.AssertPackFailure (project_path, properties, msbuildParallelism: false);
var errors = BinLog.GetBuildLogErrors (rv.BinLogPath).ToArray ();
- Assert.AreEqual (1, errors.Length, "Error count");
- Assert.AreEqual ($"Creating a NuGet package is not supported for projects that have ObjcBindingNativeLibrary items. Migrate to use NativeReference items instead.", errors [0].Message, "Error message");
+ Assert.That (errors.Length, Is.EqualTo (1), "Error count");
+ Assert.That (errors [0].Message, Is.EqualTo ($"Creating a NuGet package is not supported for projects that have ObjcBindingNativeLibrary items. Migrate to use NativeReference items instead."), "Error message");
}
[Test]
@@ -191,8 +191,8 @@ void BindingXcFrameworksProjectImpl (ApplePlatform platform, bool noBindingEmbed
var assemblyName = "bindings-framework-test";
if (!noBindingEmbedding) {
- Assert.IsFalse (platformSpecificXcframework, "Invalid test variation: platformSpecificXcframework");
- Assert.IsFalse (compressedXcframework, "Invalid test variation: compressedXcframework");
+ Assert.That (platformSpecificXcframework, Is.False, "Invalid test variation: platformSpecificXcframework");
+ Assert.That (compressedXcframework, Is.False, "Invalid test variation: compressedXcframework");
}
if (!platformSpecificXcframework) {
@@ -365,7 +365,7 @@ void BindingCompressedXcFrameworksProjectImpl (ApplePlatform platform, bool comp
using var archive = ZipFile.OpenRead (nupkg);
var files = archive.Entries.Select (v => v.FullName).ToHashSet ();
var tfm = platform.ToFrameworkWithPlatformVersion (isExecutable: false);
- Assert.AreEqual (compressed ? 6 : 9, archive.Entries.Count, $"nupkg file count - {nupkg}");
+ Assert.That (archive.Entries.Count, Is.EqualTo (compressed ? 6 : 9), $"nupkg file count - {nupkg}");
Assert.That (files, Does.Contain (assemblyName + ".nuspec"), "nuspec");
Assert.That (files, Does.Contain ("_rels/.rels"), ".rels");
Assert.That (files, Does.Contain ("[Content_Types].xml"), "[Content_Types].xml");
@@ -382,7 +382,7 @@ void BindingCompressedXcFrameworksProjectImpl (ApplePlatform platform, bool comp
"XStaticArTest.xcframework.zip",
"XStaticObjectTest.xcframework.zip",
};
- CollectionAssert.AreEqual (innerZipContents.OrderBy (v => v), innerZip.OrderBy (v => v), "Inner zip");
+ Assert.That (innerZip.OrderBy (v => v), Is.EqualTo (innerZipContents.OrderBy (v => v)), "Inner zip");
manifest = ZipHelpers.GetInnerString (nupkg, resourcesZip, "manifest");
} else {
Assert.That (files, Does.Contain ($"lib/{tfm}/{assemblyName}.resources/manifest"), $"manifest");
@@ -431,7 +431,7 @@ void BindingCompressedXcFrameworksProjectImpl (ApplePlatform platform, bool comp
""";
- Assert.AreEqual (expectedManifest, manifest, "manifest contents");
+ Assert.That (manifest, Is.EqualTo (expectedManifest), "manifest contents");
}
[Test]
diff --git a/tests/dotnet/UnitTests/PartialAppManifestTest.cs b/tests/dotnet/UnitTests/PartialAppManifestTest.cs
index 9d386fcbaea6..d15907131285 100644
--- a/tests/dotnet/UnitTests/PartialAppManifestTest.cs
+++ b/tests/dotnet/UnitTests/PartialAppManifestTest.cs
@@ -18,11 +18,11 @@ public void Build (ApplePlatform platform, string runtimeIdentifiers)
var infoPlistPath = GetInfoPListPath (platform, appPath);
var infoPlist = PDictionary.FromFile (infoPlistPath)!;
- Assert.AreEqual ("com.xamarin.mypartialappmanifestapp", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
- Assert.AreEqual ("MyPartialAppManifestApp", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
- Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleVersion").Value, "CFBundleVersion");
- Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString");
- Assert.AreEqual ("SomeValue", infoPlist.GetString ("Something").Value, "Something");
+ Assert.That (infoPlist.GetString ("CFBundleIdentifier").Value, Is.EqualTo ("com.xamarin.mypartialappmanifestapp"), "CFBundleIdentifier");
+ Assert.That (infoPlist.GetString ("CFBundleDisplayName").Value, Is.EqualTo ("MyPartialAppManifestApp"), "CFBundleDisplayName");
+ Assert.That (infoPlist.GetString ("CFBundleVersion").Value, Is.EqualTo ("3.14"), "CFBundleVersion");
+ Assert.That (infoPlist.GetString ("CFBundleShortVersionString").Value, Is.EqualTo ("3.14"), "CFBundleShortVersionString");
+ Assert.That (infoPlist.GetString ("Something").Value, Is.EqualTo ("SomeValue"), "Something");
var partialAppManifestPath = Path.Combine (Path.GetDirectoryName (project_path)!, "..", "Partial.plist");
Configuration.Touch (partialAppManifestPath);
@@ -56,13 +56,13 @@ public void AppWithLibraryWithResourcesReference (ApplePlatform platform, string
var infoPlistPath = GetInfoPListPath (platform, appPath);
var infoPlist = PDictionary.FromFile (infoPlistPath)!;
- Assert.AreEqual ("Here I am", infoPlist.GetString ("LibraryWithResources").Value, "LibraryWithResources 1");
+ Assert.That (infoPlist.GetString ("LibraryWithResources").Value, Is.EqualTo ("Here I am"), "LibraryWithResources 1");
// build again, nothing should change
DotNet.AssertBuild (project_path, properties);
infoPlist = PDictionary.FromFile (infoPlistPath)!;
- Assert.AreEqual ("Here I am", infoPlist.GetString ("LibraryWithResources").Value, "LibraryWithResources 2");
+ Assert.That (infoPlist.GetString ("LibraryWithResources").Value, Is.EqualTo ("Here I am"), "LibraryWithResources 2");
}
}
}
diff --git a/tests/dotnet/UnitTests/PostBuildTest.cs b/tests/dotnet/UnitTests/PostBuildTest.cs
index 12f20d9901f2..3f8d8b76e8a6 100644
--- a/tests/dotnet/UnitTests/PostBuildTest.cs
+++ b/tests/dotnet/UnitTests/PostBuildTest.cs
@@ -222,14 +222,14 @@ public void PublishFailureTest (ApplePlatform platform, string runtimeIdentifier
var rv = DotNet.AssertPublishFailure (project_path, properties);
var errors = BinLog.GetBuildLogErrors (rv.BinLogPath).ToArray ();
- Assert.AreEqual (1, errors.Length, "Error Count");
+ Assert.That (errors.Length, Is.EqualTo (1), "Error Count");
string expectedErrorMessage;
if (runtimeIdentifiers.IndexOf (';') >= 0) {
expectedErrorMessage = $"A runtime identifier for a device architecture must be specified in order to publish this project. '{runtimeIdentifiers}' are simulator architectures.";
} else {
expectedErrorMessage = $"A runtime identifier for a device architecture must be specified in order to publish this project. '{runtimeIdentifiers}' is a simulator architecture.";
}
- Assert.AreEqual (expectedErrorMessage, errors [0].Message, "Error Message");
+ Assert.That (errors [0].Message, Is.EqualTo (expectedErrorMessage), "Error Message");
Assert.That (pkgPath, Does.Not.Exist, "ipa/pkg creation");
}
diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs
index 23d89f113666..ad174b7015af 100644
--- a/tests/dotnet/UnitTests/ProjectTest.cs
+++ b/tests/dotnet/UnitTests/ProjectTest.cs
@@ -26,10 +26,10 @@ public void BuildMySingleView (string runtimeIdentifier)
AssertAppContents (platform, appPath);
var infoPlistPath = Path.Combine (appPath, "Info.plist");
var infoPlist = PDictionary.FromFile (infoPlistPath)!;
- Assert.AreEqual ("com.xamarin.mysingletitle", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
- Assert.AreEqual ("MySingleTitle", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
- Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleVersion").Value, "CFBundleVersion");
- Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString");
+ Assert.That (infoPlist.GetString ("CFBundleIdentifier").Value, Is.EqualTo ("com.xamarin.mysingletitle"), "CFBundleIdentifier");
+ Assert.That (infoPlist.GetString ("CFBundleDisplayName").Value, Is.EqualTo ("MySingleTitle"), "CFBundleDisplayName");
+ Assert.That (infoPlist.GetString ("CFBundleVersion").Value, Is.EqualTo ("3.14"), "CFBundleVersion");
+ Assert.That (infoPlist.GetString ("CFBundleShortVersionString").Value, Is.EqualTo ("3.14"), "CFBundleShortVersionString");
}
[Test]
@@ -84,10 +84,10 @@ public void BuildMyCatalystApp (string runtimeIdentifier)
AssertAppContents (platform, appPath);
var infoPlistPath = Path.Combine (appPath, "Contents", "Info.plist");
var infoPlist = PDictionary.FromFile (infoPlistPath)!;
- Assert.AreEqual ("com.xamarin.mycatalystapp", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
- Assert.AreEqual ("MyCatalystApp", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
- Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleVersion").Value, "CFBundleVersion");
- Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString");
+ Assert.That (infoPlist.GetString ("CFBundleIdentifier").Value, Is.EqualTo ("com.xamarin.mycatalystapp"), "CFBundleIdentifier");
+ Assert.That (infoPlist.GetString ("CFBundleDisplayName").Value, Is.EqualTo ("MyCatalystApp"), "CFBundleDisplayName");
+ Assert.That (infoPlist.GetString ("CFBundleVersion").Value, Is.EqualTo ("3.14"), "CFBundleVersion");
+ Assert.That (infoPlist.GetString ("CFBundleShortVersionString").Value, Is.EqualTo ("3.14"), "CFBundleShortVersionString");
}
[TestCase (ApplePlatform.iOS)]
@@ -115,7 +115,7 @@ public void BuildMyClassLibrary (ApplePlatform platform)
using var ad = AssemblyDefinition.ReadAssembly (dll, new ReaderParameters { ReadingMode = ReadingMode.Deferred });
var r = ad.MainModule.AssemblyReferences.Where (v => v.Name == $"Microsoft.{platform.AsString ()}").First ();
var actualReferenceVersionString = $"{r.Version.Major}.{r.Version.Minor}";
- Assert.AreEqual (expectedReferenceVersionString, actualReferenceVersionString, $"Referenced version of Microsoft.{platform.AsString ()}.dll");
+ Assert.That (actualReferenceVersionString, Is.EqualTo (expectedReferenceVersionString), $"Referenced version of Microsoft.{platform.AsString ()}.dll");
Assert.That (r.Version.Build, Is.EqualTo (0), "Build");
Assert.That (r.Version.Revision, Is.EqualTo (0), "Revision");
}
@@ -398,10 +398,10 @@ public void BuildFatApp (ApplePlatform platform, string runtimeIdentifiers)
var infoPlistPath = GetInfoPListPath (platform, appPath);
Assert.That (infoPlistPath, Does.Exist, "Info.plist");
var infoPlist = PDictionary.FromFile (infoPlistPath)!;
- Assert.AreEqual ("com.xamarin.mysimpleapp", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
- Assert.AreEqual ("MySimpleApp", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
- Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleVersion").Value, "CFBundleVersion");
- Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString");
+ Assert.That (infoPlist.GetString ("CFBundleIdentifier").Value, Is.EqualTo ("com.xamarin.mysimpleapp"), "CFBundleIdentifier");
+ Assert.That (infoPlist.GetString ("CFBundleDisplayName").Value, Is.EqualTo ("MySimpleApp"), "CFBundleDisplayName");
+ Assert.That (infoPlist.GetString ("CFBundleVersion").Value, Is.EqualTo ("3.14"), "CFBundleVersion");
+ Assert.That (infoPlist.GetString ("CFBundleShortVersionString").Value, Is.EqualTo ("3.14"), "CFBundleShortVersionString");
}
[Test]
@@ -429,8 +429,8 @@ public void BuildFatMonoTouchTest (ApplePlatform platform, string runtimeIdentif
var infoPlistPath = GetInfoPListPath (platform, appPath);
Assert.That (infoPlistPath, Does.Exist, "Info.plist");
var infoPlist = PDictionary.FromFile (infoPlistPath)!;
- Assert.AreEqual ("com.xamarin.monotouch-test", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
- Assert.AreEqual ("MonoTouchTest", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
+ Assert.That (infoPlist.GetString ("CFBundleIdentifier").Value, Is.EqualTo ("com.xamarin.monotouch-test"), "CFBundleIdentifier");
+ Assert.That (infoPlist.GetString ("CFBundleDisplayName").Value, Is.EqualTo ("MonoTouchTest"), "CFBundleDisplayName");
}
[Test]
@@ -448,8 +448,8 @@ public void InvalidRuntimeIdentifiers (ApplePlatform platform, string runtimeIde
var properties = GetDefaultProperties (runtimeIdentifiers);
var rv = DotNet.AssertBuildFailure (project_path, properties);
var errors = BinLog.GetBuildLogErrors (rv.BinLogPath).ToArray ();
- Assert.AreEqual (1, errors.Length, "Error count");
- Assert.AreEqual ($"Building for all the runtime identifiers '{runtimeIdentifiers}' at the same time isn't possible, because they represent different platform variations.", errors [0].Message, "Error message");
+ Assert.That (errors.Length, Is.EqualTo (1), "Error count");
+ Assert.That (errors [0].Message, Is.EqualTo ($"Building for all the runtime identifiers '{runtimeIdentifiers}' at the same time isn't possible, because they represent different platform variations."), "Error message");
}
[Test]
@@ -507,8 +507,8 @@ public void IsOverrideRuntimeIdentifier (ApplePlatform platform, string runtimeI
properties ["cmdline:RuntimeIdentifier"] = "maccatalyst-x64";
var rv = DotNet.AssertBuild (project_path, properties);
var warnings = BinLog.GetBuildLogWarnings (rv.BinLogPath).ToArray ();
- Assert.AreEqual (1, warnings.Length, "Warning Count");
- Assert.AreEqual ("RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file.", warnings [0].Message, "Warning message");
+ Assert.That (warnings.Length, Is.EqualTo (1), "Warning Count");
+ Assert.That (warnings [0].Message, Is.EqualTo ("RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file."), "Warning message");
}
[Test]
@@ -525,8 +525,8 @@ public void IsNotOverrideRuntimeIdentifier (ApplePlatform platform, string runti
props ["RuntimeIdentifiers"] = "maccatalyst-arm64";
var rv = DotNet.AssertBuildFailure (projectPath, props);
var errors = BinLog.GetBuildLogErrors (rv.BinLogPath).ToArray ();
- Assert.AreEqual ("Both RuntimeIdentifier and RuntimeIdentifiers were passed on the command line, but only one of them can be set at a time.", errors [0].Message);
- Assert.AreEqual (1, errors.Length, "Error count");
+ Assert.That (errors [0].Message, Is.EqualTo ("Both RuntimeIdentifier and RuntimeIdentifiers were passed on the command line, but only one of them can be set at a time."));
+ Assert.That (errors.Length, Is.EqualTo (1), "Error count");
}
[Test]
@@ -584,14 +584,14 @@ public void InvalidRuntimeIdentifier (ApplePlatform platform, string runtimeIden
var rv = DotNet.AssertBuildFailure (project_path, properties);
var errors = BinLog.GetBuildLogErrors (rv.BinLogPath).ToArray ();
var uniqueErrors = errors.Select (v => v.Message).Distinct ().ToArray ();
- Assert.AreEqual (1, uniqueErrors.Length, "Error count");
+ Assert.That (uniqueErrors.Length, Is.EqualTo (1), "Error count");
string expectedError;
if (notRecognized) {
expectedError = $"The specified RuntimeIdentifier '{runtimeIdentifier}' is not recognized. See https://aka.ms/netsdk1083 for more information.";
} else {
expectedError = $"The RuntimeIdentifier '{runtimeIdentifier}' is invalid.";
}
- Assert.AreEqual (expectedError, uniqueErrors [0], "Error message");
+ Assert.That (uniqueErrors [0], Is.EqualTo (expectedError), "Error message");
}
[Test]
@@ -611,7 +611,7 @@ public void InvalidRuntimeIdentifier_Restore (ApplePlatform platform, string run
DotNet.AssertRestore (project_path, properties);
} else {
var rv = DotNet.Restore (project_path, properties);
- Assert.AreNotEqual (0, rv.ExitCode, "Expected failure");
+ Assert.That (rv.ExitCode, Is.Not.EqualTo (0), "Expected failure");
var errors = BinLog.GetBuildLogErrors (rv.BinLogPath).ToArray ();
Assert.That (errors.Length, Is.GreaterThan (0), "Error count");
Assert.That (errors [0].Message, Does.Match (failureMessagePattern), "Message failure");
@@ -650,16 +650,16 @@ public void FilesInAppBundle (ApplePlatform platform, string runtimeIdentifiers)
// Build again - this time it'll fail
var rv = DotNet.Build (project_path, properties);
var warnings = BinLog.GetBuildLogWarnings (rv.BinLogPath).ToArray ();
- Assert.AreNotEqual (0, rv.ExitCode, "Unexpected success");
- Assert.AreEqual (1, warnings.Length, "Warning Count");
- Assert.AreEqual ($"Found files in the root directory of the app bundle. This will likely cause codesign to fail. Files:\nbin/Debug/{Configuration.DotNetTfm}-maccatalyst/maccatalyst-x64/MySimpleApp.app/otherfile.txt\nbin/Debug/{Configuration.DotNetTfm}-maccatalyst/maccatalyst-x64/MySimpleApp.app/otherdir\nbin/Debug/{Configuration.DotNetTfm}-maccatalyst/maccatalyst-x64/MySimpleApp.app/otherdir/otherfile.log", warnings [0].Message, "Warning");
+ Assert.That (rv.ExitCode, Is.Not.EqualTo (0), "Unexpected success");
+ Assert.That (warnings.Length, Is.EqualTo (1), "Warning Count");
+ Assert.That (warnings [0].Message, Is.EqualTo ($"Found files in the root directory of the app bundle. This will likely cause codesign to fail. Files:\nbin/Debug/{Configuration.DotNetTfm}-maccatalyst/maccatalyst-x64/MySimpleApp.app/otherfile.txt\nbin/Debug/{Configuration.DotNetTfm}-maccatalyst/maccatalyst-x64/MySimpleApp.app/otherdir\nbin/Debug/{Configuration.DotNetTfm}-maccatalyst/maccatalyst-x64/MySimpleApp.app/otherdir/otherfile.log"), "Warning");
// Build again, asking for automatic removal of the extraneous files.
var enableAutomaticCleanupProperties = new Dictionary (properties);
enableAutomaticCleanupProperties ["EnableAutomaticAppBundleRootDirectoryCleanup"] = "true";
rv = DotNet.AssertBuild (project_path, enableAutomaticCleanupProperties);
warnings = BinLog.GetBuildLogWarnings (rv.BinLogPath).ToArray ();
- Assert.AreEqual (0, warnings.Length, "Warning Count");
+ Assert.That (warnings.Length, Is.EqualTo (0), "Warning Count");
// Verify that the files were in fact removed.
Assert.That (Path.Combine (appPath, "otherfile.txt"), Does.Not.Exist, "otherfile");
@@ -686,10 +686,10 @@ public void BuildCoreCLR (ApplePlatform platform, string runtimeIdentifiers)
var infoPlistPath = GetInfoPListPath (platform, appPath);
Assert.That (infoPlistPath, Does.Exist, "Info.plist");
var infoPlist = PDictionary.FromFile (infoPlistPath)!;
- Assert.AreEqual ("com.xamarin.mysimpleapp", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
- Assert.AreEqual ("MySimpleApp", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
- Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleVersion").Value, "CFBundleVersion");
- Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString");
+ Assert.That (infoPlist.GetString ("CFBundleIdentifier").Value, Is.EqualTo ("com.xamarin.mysimpleapp"), "CFBundleIdentifier");
+ Assert.That (infoPlist.GetString ("CFBundleDisplayName").Value, Is.EqualTo ("MySimpleApp"), "CFBundleDisplayName");
+ Assert.That (infoPlist.GetString ("CFBundleVersion").Value, Is.EqualTo ("3.14"), "CFBundleVersion");
+ Assert.That (infoPlist.GetString ("CFBundleShortVersionString").Value, Is.EqualTo ("3.14"), "CFBundleShortVersionString");
var appExecutable = GetNativeExecutable (platform, appPath);
ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable);
@@ -760,9 +760,9 @@ public void BindingWithDefaultCompileInclude (ApplePlatform platform)
// Verify that the MyNativeClass class exists in the assembly, and that it's actually a class.
var ad = AssemblyDefinition.ReadAssembly (dllPath, new ReaderParameters { ReadingMode = ReadingMode.Deferred });
var myNativeClass = ad.MainModule.Types.FirstOrDefault (v => v.FullName == "MyApiDefinition.MyNativeClass");
- Assert.IsFalse (myNativeClass!.IsInterface, "IsInterface");
+ Assert.That (myNativeClass!.IsInterface, Is.False, "IsInterface");
var myStruct = ad.MainModule.Types.FirstOrDefault (v => v.FullName == "MyClassLibrary.MyStruct");
- Assert.IsTrue (myStruct!.IsValueType, "MyStruct");
+ Assert.That (myStruct!.IsValueType, Is.True, "MyStruct");
var warnings = BinLog.GetBuildLogWarnings (rv.BinLogPath).Select (v => v.Message);
Assert.That (warnings, Is.Empty, $"Build warnings:\n\t{string.Join ("\n\t", warnings)}");
@@ -806,13 +806,13 @@ public void AppWithResources (ApplePlatform platform, string runtimeIdentifiers)
case ApplePlatform.TVOS:
case ApplePlatform.MacCatalyst:
var uiAppFonts = plist.GetArray ("UIAppFonts");
- Assert.IsNotNull (uiAppFonts, "UIAppFonts");
- Assert.AreEqual (1, uiAppFonts.Count, "UIAppFonts.Count");
- Assert.AreEqual ("B.otf", ((PString) uiAppFonts [0]).Value, "UIAppFonts [0]");
+ Assert.That (uiAppFonts, Is.Not.Null, "UIAppFonts");
+ Assert.That (uiAppFonts.Count, Is.EqualTo (1), "UIAppFonts.Count");
+ Assert.That (((PString) uiAppFonts [0]).Value, Is.EqualTo ("B.otf"), "UIAppFonts [0]");
break;
case ApplePlatform.MacOSX:
var applicationFontsPath = plist.GetString ("ATSApplicationFontsPath")?.Value;
- Assert.AreEqual (".", applicationFontsPath, "ATSApplicationFontsPath");
+ Assert.That (applicationFontsPath, Is.EqualTo ("."), "ATSApplicationFontsPath");
break;
default:
throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}");
@@ -840,9 +840,9 @@ public void AppWithResources (ApplePlatform platform, string runtimeIdentifiers)
var arm64txt = Path.Combine (resourcesDirectory, "arm64.txt");
var armtxt = Path.Combine (resourcesDirectory, "arm.txt");
var x64txt = Path.Combine (resourcesDirectory, "x64.txt");
- Assert.AreEqual (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-arm64")), File.Exists (arm64txt), "arm64.txt");
- Assert.AreEqual (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-arm")), File.Exists (armtxt), "arm.txt");
- Assert.AreEqual (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-x64")), File.Exists (x64txt), "x64.txt");
+ Assert.That (File.Exists (arm64txt), Is.EqualTo (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-arm64"))), "arm64.txt");
+ Assert.That (File.Exists (armtxt), Is.EqualTo (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-arm"))), "arm.txt");
+ Assert.That (File.Exists (x64txt), Is.EqualTo (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-x64"))), "x64.txt");
var b_otf = Path.Combine (Path.GetDirectoryName (project_path)!, "Resources", "B.otf");
Configuration.Touch (b_otf);
@@ -1017,7 +1017,7 @@ public void LibraryWithResources (ApplePlatform platform, bool? bundleOriginalRe
} else {
expectedResources = new List ();
}
- CollectionAssert.AreEquivalent (expectedResources, actualResources, "Resources");
+ Assert.That (actualResources, Is.EquivalentTo (expectedResources), "Resources");
var zeroLengthResources = actualAssemblyResources.Where (v => v.ResourceType == ResourceType.Embedded && ((EmbeddedResource) v).GetResourceData ().Length == 0).Select (v => v.Name).ToArray ();
Assert.That (zeroLengthResources, Is.Empty, $"0-length resources");
@@ -1128,7 +1128,7 @@ void AppWithLibraryWithResourcesReferenceImpl (ApplePlatform platform, string ru
if (bundleOriginalResources) {
var infoPlist = appBundleInfo.GetFile (GetInfoPListPath (platform, ""));
var appManifest = PDictionary.FromByteArray (infoPlist, out var _)!;
- Assert.AreEqual ("Here I am", appManifest.GetString ("LibraryWithResources").Value, "Partial plist entry");
+ Assert.That (appManifest.GetString ("LibraryWithResources").Value, Is.EqualTo ("Here I am"), "Partial plist entry");
}
});
@@ -1904,7 +1904,7 @@ void BuildProjectsWithExtensionsImpl (ApplePlatform platform, string runtimeIden
var pathToSearch = Path.Combine (Path.GetDirectoryName (consumingProjectDir)!, "bin", "Debug");
string [] configFiles = Directory.GetFiles (pathToSearch, "*.runtimeconfig.*", SearchOption.AllDirectories);
- Assert.AreNotEqual (0, configFiles.Length, "runtimeconfig.json file does not exist");
+ Assert.That (configFiles.Length, Is.Not.EqualTo (0), "runtimeconfig.json file does not exist");
}
[TestCase (ApplePlatform.iOS, "iossimulator-x64", false)]
@@ -1937,11 +1937,11 @@ public void BuildProjectsWithExtensionsAndFrameworks (ApplePlatform platform, st
var extensionPath = Path.Combine (appPath, GetPlugInsRelativePath (platform), "ExtensionProjectWithFrameworks.appex");
Assert.That (Directory.Exists (extensionPath), $"App extension directory does not exist: {extensionPath}");
var extensionFrameworksPath = Path.Combine (extensionPath, GetFrameworksRelativePath (platform));
- Assert.IsFalse (Directory.Exists (extensionFrameworksPath), $"App extension framework directory exists when it shouldn't: {extensionFrameworksPath}");
+ Assert.That (Directory.Exists (extensionFrameworksPath), Is.False, $"App extension framework directory exists when it shouldn't: {extensionFrameworksPath}");
var pathToSearch = Path.Combine (Path.GetDirectoryName (consumingProjectDir)!, "bin", "Debug");
var configFiles = Directory.GetFiles (pathToSearch, "*.runtimeconfig.*", SearchOption.AllDirectories);
- Assert.AreNotEqual (0, configFiles.Length, "runtimeconfig.json file does not exist");
+ Assert.That (configFiles.Length, Is.Not.EqualTo (0), "runtimeconfig.json file does not exist");
var appFrameworksPath = Path.Combine (appPath, GetFrameworksRelativePath (platform));
Assert.That (Directory.Exists (appFrameworksPath), $"App Frameworks directory does not exist: {appFrameworksPath}");
@@ -2026,8 +2026,8 @@ public void CatalystAppOptimizedForMacOS (ApplePlatform platform, string runtime
if (failureExpected) {
var rv = DotNet.AssertBuildFailure (project_path, properties);
var errors = BinLog.GetBuildLogErrors (rv.BinLogPath).ToArray ();
- Assert.AreEqual (1, errors.Length, "Error count");
- Assert.AreEqual ($"The UIDeviceFamily value '6' is not valid for this platform. It's only valid for Mac Catalyst.", errors [0].Message, "Error message");
+ Assert.That (errors.Length, Is.EqualTo (1), "Error count");
+ Assert.That (errors [0].Message, Is.EqualTo ($"The UIDeviceFamily value '6' is not valid for this platform. It's only valid for Mac Catalyst."), "Error message");
} else {
DotNet.AssertBuild (project_path, properties);
}
@@ -2147,10 +2147,10 @@ void BuildSupportedNetVersionApp (ApplePlatform platform, string runtimeIdentifi
var infoPlistPath = GetInfoPListPath (platform, appPath);
Assert.That (infoPlistPath, Does.Exist, "Info.plist");
var infoPlist = PDictionary.FromFile (infoPlistPath)!;
- Assert.AreEqual ("com.xamarin.mysimpleapp", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
- Assert.AreEqual ("MySimpleApp", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
- Assert.AreEqual (netVersion, infoPlist.GetString ("CFBundleVersion").Value, "CFBundleVersion");
- Assert.AreEqual (netVersion, infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString");
+ Assert.That (infoPlist.GetString ("CFBundleIdentifier").Value, Is.EqualTo ("com.xamarin.mysimpleapp"), "CFBundleIdentifier");
+ Assert.That (infoPlist.GetString ("CFBundleDisplayName").Value, Is.EqualTo ("MySimpleApp"), "CFBundleDisplayName");
+ Assert.That (infoPlist.GetString ("CFBundleVersion").Value, Is.EqualTo (netVersion), "CFBundleVersion");
+ Assert.That (infoPlist.GetString ("CFBundleShortVersionString").Value, Is.EqualTo (netVersion), "CFBundleShortVersionString");
var appExecutable = GetNativeExecutable (platform, appPath);
ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable);
@@ -2297,7 +2297,7 @@ public void CustomizedCodeSigning (ApplePlatform platform, string runtimeIdentif
foreach (var dylib in signedDylibs) {
var path = Path.Combine (appPath, dylib);
Assert.That (path, Does.Exist, "dylib exists");
- Assert.IsTrue (IsDylibSigned (path), $"Signed: {path}");
+ Assert.That (IsDylibSigned (path), Is.True, $"Signed: {path}");
}
appBundleContents.ExceptWith (signedDylibs);
// And that there are unsigned dylibs, but not the system ones
@@ -2307,9 +2307,9 @@ public void CustomizedCodeSigning (ApplePlatform platform, string runtimeIdentif
foreach (var unsignedDylib in remainingDylibs) {
var path = Path.Combine (appPath, unsignedDylib);
Assert.That (path, Does.Exist, "unsigned dylib existence");
- Assert.IsFalse (IsDylibSigned (path), $"Unsigned: {path}");
+ Assert.That (IsDylibSigned (path), Is.False, $"Unsigned: {path}");
}
- Assert.AreEqual (2, remainingDylibs.Length, "Unsigned count");
+ Assert.That (remainingDylibs.Length, Is.EqualTo (2), "Unsigned count");
// Verify that a Resources subdirectory causes the build to fail.
switch (platform) {
@@ -2379,11 +2379,11 @@ public void AutoAllowJitEntitlements (ApplePlatform platform, string runtimeIden
var executable = GetNativeExecutable (platform, appPath);
var foundEntitlements = TryGetEntitlements (executable, out var entitlements);
if (configuration == "Release") {
- Assert.IsTrue (foundEntitlements, "Found in Release");
- Assert.IsTrue (entitlements!.Get ("com.apple.security.cs.allow-jit")?.Value, "Jit Allowed");
+ Assert.That (foundEntitlements, Is.True, "Found in Release");
+ Assert.That (entitlements!.Get ("com.apple.security.cs.allow-jit")?.Value, Is.True, "Jit Allowed");
} else {
var jitNotAllowed = !foundEntitlements || !entitlements!.ContainsKey ("com.apple.security.cs.allow-jit");
- Assert.True (jitNotAllowed, "Jit Not Allowed");
+ Assert.That (jitNotAllowed, Is.True, "Jit Not Allowed");
}
}
@@ -2491,8 +2491,8 @@ public void BuildAndExecuteAppWithWinExeOutputType (ApplePlatform platform, stri
var rv = DotNet.AssertBuildFailure (project_path, properties);
var errors = BinLog.GetBuildLogErrors (rv.BinLogPath).ToArray ();
- Assert.AreEqual (1, errors.Length, "Error count");
- Assert.AreEqual ($"WinExe is not a valid output type for macOS", errors [0].Message, "Error message");
+ Assert.That (errors.Length, Is.EqualTo (1), "Error count");
+ Assert.That (errors [0].Message, Is.EqualTo ($"WinExe is not a valid output type for macOS"), "Error message");
}
[Test]
@@ -2535,9 +2535,9 @@ public void BuildMyNativeAotAppWithTrimAnalysisWarning (ApplePlatform platform,
warnings = warnings.Where (w => w.Message?.Trim () != "Supported iPhone orientations have not been set").ToArray ();
}
- Assert.AreEqual (1, warnings.Length, "Warning count");
- Assert.AreEqual (warnings [0].Code, "IL2075", "Warning code");
- Assert.AreEqual (warnings [0].Message, "'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperties()'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.");
+ Assert.That (warnings.Length, Is.EqualTo (1), "Warning count");
+ Assert.That ("IL2075", Is.EqualTo (warnings [0].Code), "Warning code");
+ Assert.That ("'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperties()'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.", Is.EqualTo (warnings [0].Message));
}
[Test]
@@ -2571,7 +2571,7 @@ public void PublishAot (ApplePlatform platform, string runtimeIdentifiers, strin
properties ["TrimmerSingleWarn"] = "false"; // don't be shy, we want to know what the problem is
var rv = DotNet.AssertBuild (project_path, properties);
- Assert.True (Directory.Exists (appPath), $"App file expected at: {appPath}");
+ Assert.That (Directory.Exists (appPath), Is.True, $"App file expected at: {appPath}");
// Verify that we have no warnings, but unfortunately we still have some we haven't fixed yet.
// Ignore those, and fail the test if we stop getting them (so that we can update the test to not ignore them anymore).
@@ -2853,14 +2853,14 @@ public void SourcelinkTest (ApplePlatform platform, string runtimeIdentifiers, s
.GetFiles (Path.GetDirectoryName (project_path)!, $"Microsoft.{platformName}.pdb", SearchOption.AllDirectories)
.FirstOrDefault ();
- Assert.NotNull (pdbFile, "No PDB file found");
+ Assert.That (pdbFile, Is.Not.Null, "No PDB file found");
var tool = "sourcelink";
var toolPath = Directory.GetCurrentDirectory ();
DotNet.InstallTool (tool, toolPath);
var test = DotNet.RunTool (Path.Combine (toolPath, tool), "test", pdbFile!);
- Assert.AreEqual ($"sourcelink test passed: {pdbFile}", test.StandardOutput.ToString ().TrimEnd ('\n'));
+ Assert.That (test.StandardOutput.ToString ().TrimEnd ('\n'), Is.EqualTo ($"sourcelink test passed: {pdbFile}"));
}
@@ -2922,7 +2922,7 @@ public void DedupEnabledTest (ApplePlatform platform, string runtimeIdentifiers,
DotNet.AssertBuild (project_path, properties);
var objDir = GetObjDir (project_path, platform, runtimeIdentifiers);
- Assert.True (FindAOTedAssemblyFile (objDir, "aot-instances.dll"), $"Dedup optimization should be enabled for AOT compilation on: {platform} with RID: {runtimeIdentifiers}");
+ Assert.That (FindAOTedAssemblyFile (objDir, "aot-instances.dll"), Is.True, $"Dedup optimization should be enabled for AOT compilation on: {platform} with RID: {runtimeIdentifiers}");
}
[Test]
@@ -2946,7 +2946,7 @@ public void DedupDisabledTest (ApplePlatform platform, string runtimeIdentifiers
DotNet.AssertBuild (project_path, properties);
var objDir = GetObjDir (project_path, platform, runtimeIdentifiers);
- Assert.False (FindAOTedAssemblyFile (objDir, "aot-instances.dll"), $"Dedup optimization should not be enabled for AOT compilation on: {platform} with RID: {runtimeIdentifiers}");
+ Assert.That (FindAOTedAssemblyFile (objDir, "aot-instances.dll"), Is.False, $"Dedup optimization should not be enabled for AOT compilation on: {platform} with RID: {runtimeIdentifiers}");
}
[Test]
@@ -2968,10 +2968,10 @@ public void DedupUniversalAppTest (ApplePlatform platform, string runtimeIdentif
var objDir = GetObjDir (project_path, platform, runtimeIdentifiers);
var objDirMacCatalystArm64 = Path.Combine (objDir, "maccatalyst-arm64");
- Assert.True (FindAOTedAssemblyFile (objDirMacCatalystArm64, "aot-instances.dll"), $"Dedup optimization should be enabled for AOT compilation on: {platform} with RID: maccatalyst-arm64");
+ Assert.That (FindAOTedAssemblyFile (objDirMacCatalystArm64, "aot-instances.dll"), Is.True, $"Dedup optimization should be enabled for AOT compilation on: {platform} with RID: maccatalyst-arm64");
var objDirMacCatalystx64 = Path.Combine (objDir, "maccatalyst-x64");
- Assert.False (FindAOTedAssemblyFile (objDirMacCatalystx64, "aot-instances.dll"), $"Dedup optimization should not be enabled for AOT compilation on: {platform} with RID: maccatalyst-x64");
+ Assert.That (FindAOTedAssemblyFile (objDirMacCatalystx64, "aot-instances.dll"), Is.False, $"Dedup optimization should not be enabled for AOT compilation on: {platform} with RID: maccatalyst-x64");
var appExecutable = GetNativeExecutable (platform, appPath);
@@ -3751,9 +3751,9 @@ public void LinkedWithNativeLibraries (ApplePlatform platform, string runtimeIde
var appExecutable = GetNativeExecutable (platform, appPath);
var actualFrameworks = GetLinkedWithFrameworks (appExecutable);
- CollectionAssert.AreEquivalent (
- expectedFrameworks.OrderBy (v => v).ToArray (),
+ Assert.That (
actualFrameworks.OrderBy (v => v).ToArray (),
+ Is.EquivalentTo (expectedFrameworks.OrderBy (v => v).ToArray ()),
"Frameworks");
}
@@ -3792,8 +3792,8 @@ public void SpacedAppTitle (ApplePlatform platform, string runtimeIdentifiers)
var infoPlistPath = GetInfoPListPath (platform, appPath);
var infoPlist = PDictionary.FromFile (infoPlistPath)!;
- Assert.AreEqual ("com.xamarin.spacedapp", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
- Assert.AreEqual ("Spaced App Title", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
+ Assert.That (infoPlist.GetString ("CFBundleIdentifier").Value, Is.EqualTo ("com.xamarin.spacedapp"), "CFBundleIdentifier");
+ Assert.That (infoPlist.GetString ("CFBundleDisplayName").Value, Is.EqualTo ("Spaced App Title"), "CFBundleDisplayName");
var appName = Path.GetFileNameWithoutExtension (appPath);
switch (platform) {
diff --git a/tests/dotnet/UnitTests/PublishTrimmedTest.cs b/tests/dotnet/UnitTests/PublishTrimmedTest.cs
index f7675e066d2f..8e6a1296ebf0 100644
--- a/tests/dotnet/UnitTests/PublishTrimmedTest.cs
+++ b/tests/dotnet/UnitTests/PublishTrimmedTest.cs
@@ -21,9 +21,9 @@ public void DisableLinker (ApplePlatform platform, string runtimeIdentifiers)
var rv = DotNet.AssertBuildFailure (project_path, properties);
var errors = BinLog.GetBuildLogErrors (rv.BinLogPath).ToArray ();
- Assert.AreEqual (1, errors.Length, "Error count");
+ Assert.That (errors.Length, Is.EqualTo (1), "Error count");
var linkModeName = platform == ApplePlatform.MacOSX ? "LinkMode" : "MtouchLink";
- Assert.AreEqual ($"{platform.AsString ()} projects must build with PublishTrimmed=true. Current value: false. Set '{linkModeName}=None' instead to disable trimming for all assemblies.", errors [0].Message, "Error message");
+ Assert.That (errors [0].Message, Is.EqualTo ($"{platform.AsString ()} projects must build with PublishTrimmed=true. Current value: false. Set '{linkModeName}=None' instead to disable trimming for all assemblies."), "Error message");
}
}
}
diff --git a/tests/dotnet/UnitTests/RegistrarTest.cs b/tests/dotnet/UnitTests/RegistrarTest.cs
index 767e5bda46e6..003efbdc3281 100644
--- a/tests/dotnet/UnitTests/RegistrarTest.cs
+++ b/tests/dotnet/UnitTests/RegistrarTest.cs
@@ -48,7 +48,7 @@ public void InvalidStaticRegistrarValidation (ApplePlatform platform, string? ru
ExecuteProjectWithMagicWordAndAssert (projectPath, platform, runtimeIdentifiers);
} else if (CanExecute (platform, runtimeIdentifiers)) {
var rv = base.Execute (GetNativeExecutable (platform, appDir), out var output, out _);
- Assert.AreEqual (1, rv.ExitCode, "Expected no validation");
+ Assert.That (rv.ExitCode, Is.EqualTo (1), "Expected no validation");
}
} finally {
Environment.SetEnvironmentVariable ("XAMARIN_VALIDATE_STATIC_REGISTRAR_CODE", null);
@@ -89,7 +89,7 @@ public void ClassRewriterTest (ApplePlatform platform, bool rewriteHandles)
Assert.That (File.Exists (platformDll), "No platform dll.");
var module = ModuleDefinition.ReadModule (platformDll);
var classHandlesMaybe = AllTypes (module).FirstOrDefault (t => t.FullName == "ObjCRuntime.Runtime/ClassHandles");
- Assert.NotNull (classHandlesMaybe, "Couldn't find ClassHandles type.");
+ Assert.That (classHandlesMaybe, Is.Not.Null, "Couldn't find ClassHandles type.");
var classHandles = classHandlesMaybe!;
if (!rewriteHandles) {
// NB: there is always at least one field named "unused"
@@ -103,7 +103,7 @@ public void ClassRewriterTest (ApplePlatform platform, bool rewriteHandles)
// NB: there is always at least one field named "unused"
Assert.That (classHandles.HasFields && classHandles.Fields.Count () > 1, "There are no fields in ClassHandles - rewriter did nothing.");
var field = classHandles.Fields.FirstOrDefault (f => f.Name.Contains ("SomeObj"));
- Assert.IsNotNull (field, "Didn't find a field for 'SomeObj'");
+ Assert.That (field, Is.Not.Null, "Didn't find a field for 'SomeObj'");
}
}
diff --git a/tests/dotnet/UnitTests/ResourcePrefixTest.cs b/tests/dotnet/UnitTests/ResourcePrefixTest.cs
index f4860ff1489e..60836d12716d 100644
--- a/tests/dotnet/UnitTests/ResourcePrefixTest.cs
+++ b/tests/dotnet/UnitTests/ResourcePrefixTest.cs
@@ -17,7 +17,7 @@ public void ResourcePrefix_DefaultValues ()
foreach (var platform in platforms) {
// Act & Assert
var defaultValue = GetResourcePrefix (platform.AsString ().ToLower ());
- Assert.AreEqual ("Resources", defaultValue, $"Default value for {platform} should be 'Resources'");
+ Assert.That (defaultValue, Is.EqualTo ("Resources"), $"Default value for {platform} should be 'Resources'");
}
}
@@ -33,7 +33,7 @@ public void ResourcePrefix_AppBundleResourcePrefix ()
var value = GetResourcePrefix (platform.AsString ().ToLower (), ("AppBundleResourcePrefix", customPrefix));
// Assert
- Assert.AreEqual (customPrefix, value, $"{platform}: AppBundleResourcePrefix should be used");
+ Assert.That (value, Is.EqualTo (customPrefix), $"{platform}: AppBundleResourcePrefix should be used");
}
}
@@ -48,27 +48,27 @@ public void ResourcePrefix_PlatformSpecific ()
// iOS and tvOS use IPhoneResourcePrefix
if (Configuration.include_ios) {
var iOSValue = GetResourcePrefix ("ios", ("IPhoneResourcePrefix", customPrefix));
- Assert.AreEqual (customPrefix, iOSValue, "iOS should use IPhoneResourcePrefix");
+ Assert.That (iOSValue, Is.EqualTo (customPrefix), "iOS should use IPhoneResourcePrefix");
}
if (Configuration.include_tvos) {
var tvOSValue = GetResourcePrefix ("tvos", ("IPhoneResourcePrefix", customPrefix));
- Assert.AreEqual (customPrefix, tvOSValue, "tvOS should use IPhoneResourcePrefix");
+ Assert.That (tvOSValue, Is.EqualTo (customPrefix), "tvOS should use IPhoneResourcePrefix");
}
// Mac Catalyst uses IPhoneResourcePrefix
if (Configuration.include_maccatalyst) {
var macCatalystValue = GetResourcePrefix ("maccatalyst", ("IPhoneResourcePrefix", customPrefix));
- Assert.AreEqual (customPrefix, macCatalystValue, "Mac Catalyst should use IPhoneResourcePrefix");
+ Assert.That (macCatalystValue, Is.EqualTo (customPrefix), "Mac Catalyst should use IPhoneResourcePrefix");
}
// macOS can use either XamMacResourcePrefix or MonoMacResourcePrefix
if (Configuration.include_mac) {
var macOSXamValue = GetResourcePrefix ("macos", ("XamMacResourcePrefix", customPrefix));
- Assert.AreEqual (customPrefix, macOSXamValue, "macOS should use XamMacResourcePrefix");
+ Assert.That (macOSXamValue, Is.EqualTo (customPrefix), "macOS should use XamMacResourcePrefix");
var macOSMonoValue = GetResourcePrefix ("macos", ("MonoMacResourcePrefix", customPrefix));
- Assert.AreEqual (customPrefix, macOSMonoValue, "macOS should use MonoMacResourcePrefix");
+ Assert.That (macOSMonoValue, Is.EqualTo (customPrefix), "macOS should use MonoMacResourcePrefix");
}
}
@@ -86,7 +86,7 @@ public void ResourcePrefix_Precedence ()
var iOSValue = GetResourcePrefix ("ios",
("AppBundleResourcePrefix", appBundlePrefix),
("IPhoneResourcePrefix", platformPrefix));
- Assert.AreEqual (appBundlePrefix, iOSValue, "iOS should prioritize AppBundleResourcePrefix over IPhoneResourcePrefix");
+ Assert.That (iOSValue, Is.EqualTo (appBundlePrefix), "iOS should prioritize AppBundleResourcePrefix over IPhoneResourcePrefix");
}
// tvOS - AppBundleResourcePrefix should take precedence over IPhoneResourcePrefix
@@ -94,7 +94,7 @@ public void ResourcePrefix_Precedence ()
var tvOSValue = GetResourcePrefix ("tvos",
("AppBundleResourcePrefix", appBundlePrefix),
("IPhoneResourcePrefix", platformPrefix));
- Assert.AreEqual (appBundlePrefix, tvOSValue, "tvOS should prioritize AppBundleResourcePrefix over IPhoneResourcePrefix");
+ Assert.That (tvOSValue, Is.EqualTo (appBundlePrefix), "tvOS should prioritize AppBundleResourcePrefix over IPhoneResourcePrefix");
}
// Mac Catalyst - AppBundleResourcePrefix should take precedence over IPhoneResourcePrefix
@@ -102,7 +102,7 @@ public void ResourcePrefix_Precedence ()
var macCatalystValue = GetResourcePrefix ("maccatalyst",
("AppBundleResourcePrefix", appBundlePrefix),
("IPhoneResourcePrefix", platformPrefix));
- Assert.AreEqual (appBundlePrefix, macCatalystValue, "Mac Catalyst should prioritize AppBundleResourcePrefix over IPhoneResourcePrefix");
+ Assert.That (macCatalystValue, Is.EqualTo (appBundlePrefix), "Mac Catalyst should prioritize AppBundleResourcePrefix over IPhoneResourcePrefix");
}
// macOS - AppBundleResourcePrefix should take precedence over XamMacResourcePrefix
@@ -110,13 +110,13 @@ public void ResourcePrefix_Precedence ()
var macOSXamValue = GetResourcePrefix ("macos",
("AppBundleResourcePrefix", appBundlePrefix),
("XamMacResourcePrefix", platformPrefix));
- Assert.AreEqual (appBundlePrefix, macOSXamValue, "macOS should prioritize AppBundleResourcePrefix over XamMacResourcePrefix");
+ Assert.That (macOSXamValue, Is.EqualTo (appBundlePrefix), "macOS should prioritize AppBundleResourcePrefix over XamMacResourcePrefix");
// macOS - AppBundleResourcePrefix should take precedence over MonoMacResourcePrefix
var macOSMonoValue = GetResourcePrefix ("macos",
("AppBundleResourcePrefix", appBundlePrefix),
("MonoMacResourcePrefix", platformPrefix));
- Assert.AreEqual (appBundlePrefix, macOSMonoValue, "macOS should prioritize AppBundleResourcePrefix over MonoMacResourcePrefix");
+ Assert.That (macOSMonoValue, Is.EqualTo (appBundlePrefix), "macOS should prioritize AppBundleResourcePrefix over MonoMacResourcePrefix");
}
}
diff --git a/tests/dotnet/UnitTests/TemplateProjectTest.cs b/tests/dotnet/UnitTests/TemplateProjectTest.cs
index ea4318b9294f..dfa469bbd044 100644
--- a/tests/dotnet/UnitTests/TemplateProjectTest.cs
+++ b/tests/dotnet/UnitTests/TemplateProjectTest.cs
@@ -177,8 +177,8 @@ public void NoBundleIdentifierError (ApplePlatform platform)
var properties = GetDefaultProperties ();
var result = DotNet.AssertBuildFailure (project_path, properties);
var errors = BinLog.GetBuildLogErrors (result.BinLogPath).ToArray ();
- Assert.AreEqual (1, errors.Length, "Errors");
- Assert.AreEqual ("A bundle identifier is required. Either add an 'ApplicationId' property in the project file, or add a 'CFBundleIdentifier' entry in the project's Info.plist file.", errors [0].Message);
+ Assert.That (errors.Length, Is.EqualTo (1), "Errors");
+ Assert.That (errors [0].Message, Is.EqualTo ("A bundle identifier is required. Either add an 'ApplicationId' property in the project file, or add a 'CFBundleIdentifier' entry in the project's Info.plist file."));
}
}
}
diff --git a/tests/dotnet/UnitTests/TemplateTest.cs b/tests/dotnet/UnitTests/TemplateTest.cs
index 11da53ac3e5a..24c9e1d54dca 100644
--- a/tests/dotnet/UnitTests/TemplateTest.cs
+++ b/tests/dotnet/UnitTests/TemplateTest.cs
@@ -227,7 +227,7 @@ public void CreateAndBuildProjectTemplate (TemplateInfo info)
var platform = info.Platform;
var runtimeIdentifiers = GetDefaultRuntimeIdentifier (platform);
- Assert.IsTrue (CanExecute (info.Platform, runtimeIdentifiers), "Must be executable to execute!");
+ Assert.That (CanExecute (info.Platform, runtimeIdentifiers), Is.True, "Must be executable to execute!");
// First add some code to exit the template if it launches successfully.
InsertCodeToExitAppAfterLaunch (language, outputDir);
@@ -286,7 +286,7 @@ bool IsMatching (TemplateLanguage lang, TemplateLanguage? value)
if (info.Execute) {
var runtimeIdentifiers = GetDefaultRuntimeIdentifier (platform);
- Assert.IsTrue (CanExecute (info.Platform, runtimeIdentifiers), "Must be executable to execute!");
+ Assert.That (CanExecute (info.Platform, runtimeIdentifiers), Is.True, "Must be executable to execute!");
// First add some code to exit the template if it launches successfully.
InsertCodeToExitAppAfterLaunch (language, outputDir);
@@ -333,7 +333,7 @@ static void InsertCSharpCodeToExitAppAfterLaunch (string outputDir)
var modifiedMainContents =
mainContents.Replace ("// This is the main entry point of the application.",
exitSampleWithSuccess);
- Assert.AreNotEqual (modifiedMainContents, mainContents, "Failed to modify the main content");
+ Assert.That (mainContents, Is.Not.EqualTo (modifiedMainContents), "Failed to modify the main content");
File.WriteAllText (mainFile, modifiedMainContents);
}
@@ -349,7 +349,7 @@ static void InsertFSharpCodeToExitAppAfterLaunch (string outputDir)
var modifiedMainContents =
mainContents.Replace ("// This is the main entry point of the application.",
exitSampleWithSuccess);
- Assert.AreNotEqual (modifiedMainContents, mainContents, "Failed to modify the main content");
+ Assert.That (mainContents, Is.Not.EqualTo (modifiedMainContents), "Failed to modify the main content");
File.WriteAllText (mainFile, modifiedMainContents);
}
@@ -367,7 +367,7 @@ End Sub
var modifiedMainContents =
mainContents.Replace ("' This is the main entry point of the application.",
exitSampleWithSuccess);
- Assert.AreNotEqual (modifiedMainContents, mainContents, "Failed to modify the main content");
+ Assert.That (mainContents, Is.Not.EqualTo (modifiedMainContents), "Failed to modify the main content");
File.WriteAllText (mainFile, modifiedMainContents);
}
}
diff --git a/tests/dotnet/UnitTests/TestBaseClass.cs b/tests/dotnet/UnitTests/TestBaseClass.cs
index 19e3511ada80..0d95abd4db43 100644
--- a/tests/dotnet/UnitTests/TestBaseClass.cs
+++ b/tests/dotnet/UnitTests/TestBaseClass.cs
@@ -492,7 +492,7 @@ public static StringBuilder AssertExecute (string executable, string [] argument
Console.WriteLine ($"'{executable} {StringUtils.FormatArguments (arguments)}' exited with exit code {rv}:");
Console.WriteLine ("\t" + output.ToString ().Replace ("\n", "\n\t").TrimEnd (new char [] { '\n', '\t' }));
}
- Assert.AreEqual (0, rv, $"Unable to execute '{executable} {StringUtils.FormatArguments (arguments)}': exit code {rv}");
+ Assert.That (rv, Is.EqualTo (0), $"Unable to execute '{executable} {StringUtils.FormatArguments (arguments)}': exit code {rv}");
return output;
}
@@ -528,7 +528,7 @@ protected bool TryGetEntitlements (string nativeExecutable, [NotNullWhen (true)]
nativeExecutable
};
var rv = ExecutionHelper.Execute ("codesign", args, out var codesignOutput, TimeSpan.FromSeconds (15));
- Assert.AreEqual (0, rv, $"'codesign {string.Join (" ", args)}' failed:\n{codesignOutput}");
+ Assert.That (rv, Is.EqualTo (0), $"'codesign {string.Join (" ", args)}' failed:\n{codesignOutput}");
if (File.Exists (entitlementsPath)) {
entitlements = PDictionary.FromFile (entitlementsPath);
return entitlements is not null;
diff --git a/tests/dotnet/UnitTests/WindowsTest.cs b/tests/dotnet/UnitTests/WindowsTest.cs
index d546af38e4a9..b71e01bcab70 100644
--- a/tests/dotnet/UnitTests/WindowsTest.cs
+++ b/tests/dotnet/UnitTests/WindowsTest.cs
@@ -377,7 +377,7 @@ public void RemoteTest (ApplePlatform platform, string runtimeIdentifiers)
using var zip = ZipFile.OpenRead (zippedAppBundlePath);
ZipHelpers.DumpZipFile (zip, zippedAppBundlePath);
var infoPlistEntry = zip.Entries.SingleOrDefault (v => v.Name == "Info.plist")!;
- Assert.NotNull (infoPlistEntry, "Info.plist");
+ Assert.That (infoPlistEntry, Is.Not.Null, "Info.plist");
// Parse the Info.plist
// PDictionary.FromStream requires a seekable stream, but the zip stream isn't seekable, so copy to a
@@ -387,10 +387,10 @@ public void RemoteTest (ApplePlatform platform, string runtimeIdentifiers)
plistStream.CopyTo (memoryStream);
var infoPlist = (PDictionary) PDictionary.FromStream (memoryStream)!;
- Assert.AreEqual ("com.xamarin.mysimpleapp", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
- Assert.AreEqual ("MySimpleApp", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
- Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleVersion").Value, "CFBundleVersion");
- Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString");
+ Assert.That (infoPlist.GetString ("CFBundleIdentifier").Value, Is.EqualTo ("com.xamarin.mysimpleapp"), "CFBundleIdentifier");
+ Assert.That (infoPlist.GetString ("CFBundleDisplayName").Value, Is.EqualTo ("MySimpleApp"), "CFBundleDisplayName");
+ Assert.That (infoPlist.GetString ("CFBundleVersion").Value, Is.EqualTo ("3.14"), "CFBundleVersion");
+ Assert.That (infoPlist.GetString ("CFBundleShortVersionString").Value, Is.EqualTo ("3.14"), "CFBundleShortVersionString");
//Validate that the output assemblies report file with the list of local assemblies, lengths and MVIDs has been created
var outputAssembliesReportFileName = "OutputAssembliesReport.txt";
@@ -427,7 +427,7 @@ public void RemoteTest (ApplePlatform platform, string runtimeIdentifiers)
Guid mvid = metadataReader.GetGuid (metadataReader.GetModuleDefinition ().Mvid);
var fileWasUpdated = fileInfo.Length != localInfo.length || mvid != localInfo.mvid;
- Assert.IsTrue (fileWasUpdated, $"The file '{fileName}' is identical to the one present in the output assemblies report file '{outputAssembliesReportFile}'");
+ Assert.That (fileWasUpdated, Is.True, $"The file '{fileName}' is identical to the one present in the output assemblies report file '{outputAssembliesReportFile}'");
}
}
}
diff --git a/tests/dotnet/UnitTests/XcodeProjectTests.cs b/tests/dotnet/UnitTests/XcodeProjectTests.cs
index 2d213de9203f..89096c0cb944 100644
--- a/tests/dotnet/UnitTests/XcodeProjectTests.cs
+++ b/tests/dotnet/UnitTests/XcodeProjectTests.cs
@@ -32,8 +32,7 @@ void AssertXcFrameworkOutput (ApplePlatform platform, string testDir, string xco
Assert.That (expectedXcodeFxOutput, Does.Exist, $"Expected xcframework output '{expectedXcodeFxOutput}' did not exist.");
} else {
var resourcesZip = Path.Combine (testDir, "bin", config, platform.ToFramework (), $"{TestName}.resources.zip");
- Assert.Contains ($"{xcodeProjName}{platform.AsString ()}.xcframework/Info.plist", ZipHelpers.List (resourcesZip),
- $"Expected xcframework output was not found in '{resourcesZip}'.");
+ Assert.That (ZipHelpers.List (resourcesZip), Does.Contain ($"{xcodeProjName}{platform.AsString ()}.xcframework/Info.plist"), $"Expected xcframework output was not found in '{resourcesZip}'.");
}
}
@@ -66,7 +65,7 @@ public void BuildAppiOS (string projConfig, string rid)
Assert.That (appDir, Does.Exist, $"Expected app dir '{appDir}' did not exist.");
var appContent = Directory.GetFiles (appDir, "*", SearchOption.AllDirectories);
var expectedAppOutput = Path.Combine (testDir, "bin", projConfig, platform.ToFramework (), rid, $"{TestName}.app", "Frameworks", $"{xcodeProjName}.framework", "Info.plist");
- Assert.Contains (expectedAppOutput, appContent, $"Expected framework output '{expectedAppOutput}' did not exist.");
+ Assert.That (appContent, Does.Contain (expectedAppOutput), $"Expected framework output '{expectedAppOutput}' did not exist.");
}
@@ -189,7 +188,7 @@ public void PackBinding (ApplePlatform platform)
zipContent = ZipHelpers.ListInnerZip (expectedNupkgOutput, $"lib/{tfm}/{TestName}.resources.zip");
expectedFxPath = $"{xcodeProjName}{platform.AsString ()}.xcframework/Info.plist";
}
- Assert.Contains (expectedFxPath, zipContent, $"Expected xcframework output was not found in '{expectedNupkgOutput}'.");
+ Assert.That (zipContent, Does.Contain (expectedFxPath), $"Expected xcframework output was not found in '{expectedNupkgOutput}'.");
}
[Test]
@@ -241,7 +240,7 @@ public void BuildIncremental (ApplePlatform platform)
AssertTargetExecuted (allTargets, "_BuildXcodeProjects", "Third _BuildXcodeProjects");
Assert.That (expectedXcodeFxOutput, Does.Exist, $"Expected xcframework output '{expectedXcodeFxOutput}' did not exist.");
var outputFxThirdWriteTime = File.GetLastWriteTime (expectedXcodeFxOutput);
- Assert.IsTrue (outputFxThirdWriteTime > outputFxFirstWriteTime, $"Expected '{outputFxThirdWriteTime}' write time of '{outputFxThirdWriteTime}' to be greater than first write '{outputFxFirstWriteTime}'");
+ Assert.That (outputFxThirdWriteTime > outputFxFirstWriteTime, Is.True, $"Expected '{outputFxThirdWriteTime}' write time of '{outputFxThirdWriteTime}' to be greater than first write '{outputFxFirstWriteTime}'");
}
[Test]
@@ -323,7 +322,7 @@ public void BuildMultiTargeting ()
var existingProjContent = File.ReadAllText (proj);
var newProjContent = existingProjContent.Replace ($"{templatePlatform.ToFramework ()}", tfxs);
File.WriteAllText (proj, newProjContent);
- StringAssert.Contains (tfxs, File.ReadAllText (proj));
+ Assert.That (File.ReadAllText (proj), Does.Contain (tfxs));
var xcodeProjName = "TemplateFx";
var xcodeProjDirSrc = Path.Combine (XCodeTestProjectDir, xcodeProjName);
diff --git a/tests/framework-test/FrameworkTests.cs b/tests/framework-test/FrameworkTests.cs
index da279d818e21..6092954415c4 100644
--- a/tests/framework-test/FrameworkTests.cs
+++ b/tests/framework-test/FrameworkTests.cs
@@ -19,10 +19,10 @@ public class FrameworkTests {
[Test]
public void CFunction ()
{
- Assert.AreEqual (42, CFunctions.theUltimateAnswer (), "a");
+ Assert.That (CFunctions.theUltimateAnswer (), Is.EqualTo (42), "a");
#if !__MACOS__
- Assert.AreEqual (42, CFunctions.object_theUltimateAnswer (), "object");
- Assert.AreEqual (42, CFunctions.ar_theUltimateAnswer (), "ar");
+ Assert.That (CFunctions.object_theUltimateAnswer (), Is.EqualTo (42), "object");
+ Assert.That (CFunctions.ar_theUltimateAnswer (), Is.EqualTo (42), "ar");
#endif
}
@@ -30,7 +30,7 @@ public void CFunction ()
public void ObjCClass ()
{
using (var obj = new FrameworkTest ()) {
- Assert.AreEqual (42, obj.Func (), "a");
+ Assert.That (obj.Func (), Is.EqualTo (42), "a");
}
}
}
diff --git a/tests/fsharp/FSharpTests.fs b/tests/fsharp/FSharpTests.fs
index ed4c75bb2031..5e05fcec9dc8 100644
--- a/tests/fsharp/FSharpTests.fs
+++ b/tests/fsharp/FSharpTests.fs
@@ -24,4 +24,4 @@ type FSharpTest () =
let e = 5555
let pr = sprintf "%d %d %d %d %d" a b c d e
- Assert.AreEqual ("1111 2222 3333 4444 5555", pr)
+ Assert.That (pr, Is.EqualTo ("1111 2222 3333 4444 5555"))
diff --git a/tests/interdependent-binding-projects/Main.cs b/tests/interdependent-binding-projects/Main.cs
index 2c08bd2dc725..892a12493f39 100644
--- a/tests/interdependent-binding-projects/Main.cs
+++ b/tests/interdependent-binding-projects/Main.cs
@@ -15,6 +15,6 @@ static partial void AddTestAssembliesImpl (HashSet assemblies)
public class LoaderTest {
public void TestAssemblyCount ()
{
- Assert.AreEqual (3, TestLoader.GetTestAssemblies ().Count (), "Test assembly count");
+ Assert.That (TestLoader.GetTestAssemblies ().Count (), Is.EqualTo (3), "Test assembly count");
}
}
diff --git a/tests/introspection/ApiBaseTest.cs b/tests/introspection/ApiBaseTest.cs
index 66122f4b2326..2c59f52b1ae3 100644
--- a/tests/introspection/ApiBaseTest.cs
+++ b/tests/introspection/ApiBaseTest.cs
@@ -109,7 +109,7 @@ protected TextWriter Writer {
protected void ReportError (string s, params object? [] parameters)
{
if (!ContinueOnFailure)
- Assert.Fail (s, parameters);
+ Assert.Fail (string.Format (s, parameters));
else {
Writer.Write ("[FAIL] ");
Writer.WriteLine (s, parameters);
diff --git a/tests/introspection/ApiCMAttachmentTest.cs b/tests/introspection/ApiCMAttachmentTest.cs
index a375ad550856..b8d243321409 100644
--- a/tests/introspection/ApiCMAttachmentTest.cs
+++ b/tests/introspection/ApiCMAttachmentTest.cs
@@ -548,9 +548,9 @@ public void CheckAttachments ()
obj.SetAttachment ("key", attch, CMAttachmentMode.ShouldNotPropagate);
using (var otherAttch = obj.GetAttachment ("key", out otherMode)!) {
obj.RemoveAllAttachments ();
- Assert.AreEqual (mode, otherMode);
- Assert.IsNotNull (otherAttch, "For type {0}", t.Name);
- Assert.AreEqual (attch.ToString (), otherAttch.ToString (), "For type {0}", t.Name);
+ Assert.That (otherMode, Is.EqualTo (mode));
+ Assert.That (otherAttch, Is.Not.Null, $"For type {t.Name}");
+ Assert.That (otherAttch.ToString (), Is.EqualTo (attch.ToString ()), "For type {0}", t.Name);
}
}
if (obj is IDisposable disp) {
@@ -575,7 +575,7 @@ public void CheckFailAttachments ()
continue;
var n = GetINativeInstance (t);
if (n is null)
- Assert.Fail ("Could not create instance of '{0}'.", t);
+ Assert.Fail ($"Could not create instance of '{t}'.");
var obj = new AttachableNativeObject (n!);
Assert.That (obj.Handle, Is.Not.EqualTo (IntPtr.Zero), t.Name + ".Handle");
using (var attch = new CFString ("myAttch")) {
@@ -583,7 +583,7 @@ public void CheckFailAttachments ()
obj.SetAttachment ("key", attch, CMAttachmentMode.ShouldNotPropagate);
using (var otherAttch = obj.GetAttachment ("key", out otherMode)) {
obj.RemoveAllAttachments ();
- Assert.Null (otherAttch, "For type {0}", t.Name);
+ Assert.That (otherAttch, Is.Null, $"For type {t.Name}");
}
}
if (t is IDisposable disp) {
diff --git a/tests/introspection/ApiClassPtrTest.cs b/tests/introspection/ApiClassPtrTest.cs
index bace683cfc92..2a718408526d 100644
--- a/tests/introspection/ApiClassPtrTest.cs
+++ b/tests/introspection/ApiClassPtrTest.cs
@@ -81,7 +81,7 @@ public void VerifyClassPtr ()
IntPtr class_ptr = (IntPtr) (NativeHandle) fi.GetValue (null)!;
IntPtr register_class_ptr = GetClassPtrFromRegister (t);
- Assert.AreEqual (class_ptr, register_class_ptr, "class_ptr and RegisterAttribute are different: " + t.Name);
+ Assert.That (register_class_ptr, Is.EqualTo (class_ptr), "class_ptr and RegisterAttribute are different: " + t.Name);
}
}
@@ -104,7 +104,7 @@ public void VerifyClassPtrCategories ()
else
extended_class_ptr = GetClassPtrFromRegister (extendedType);
- Assert.AreEqual (class_ptr, extended_class_ptr, "class_ptr and RegisterAttribute from extended class are different: " + t.Name);
+ Assert.That (extended_class_ptr, Is.EqualTo (class_ptr), "class_ptr and RegisterAttribute from extended class are different: " + t.Name);
}
}
}
diff --git a/tests/introspection/ApiCoreImageFiltersTest.cs b/tests/introspection/ApiCoreImageFiltersTest.cs
index 0915d646eabf..a7f7114ff9fe 100644
--- a/tests/introspection/ApiCoreImageFiltersTest.cs
+++ b/tests/introspection/ApiCoreImageFiltersTest.cs
@@ -98,7 +98,7 @@ public void CheckNativeFilters ()
}
n++;
}
- Assert.That (filters.Count, Is.EqualTo (0), "{0} native filters missing: {1}", filters.Count, String.Join (", ", filters));
+ Assert.That (filters.Count, Is.EqualTo (0), $"{filters.Count} native filters missing: {String.Join (", ", filters)}");
}
[Test]
@@ -149,7 +149,7 @@ public void CheckManagedFilters ()
if (Skip (filters [i]))
filters.RemoveAt (i);
}
- Assert.That (filters.Count, Is.EqualTo (0), "Managed filters not found for {0}", String.Join (", ", filters));
+ Assert.That (filters.Count, Is.EqualTo (0), $"Managed filters not found for {String.Join (", ", filters)}");
}
static void GenerateBinding (NSObject filter, TextWriter writer)
@@ -366,7 +366,7 @@ public void Protocols ()
if (to_confirm_manually.Length > 0) {
Console.WriteLine (to_confirm_manually);
}
- Assert.AreEqual (0, Errors, "{0} potential errors found{1}", Errors, Errors == 0 ? string.Empty : ":\n" + ErrorData.ToString () + "\n");
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} potential errors found:\n{ErrorData}\n");
}
[Test]
@@ -535,7 +535,7 @@ public void Keys ()
ReportError ($"{t.Name}: Property `{po.Name}` should NOT have a setter.");
}
}
- Assert.AreEqual (0, Errors, "{0} potential errors found{1}", Errors, Errors == 0 ? string.Empty : ":\n" + ErrorData.ToString () + "\n");
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} potential errors found:\n{ErrorData}\n");
}
}
}
diff --git a/tests/introspection/ApiCtorInitTest.cs b/tests/introspection/ApiCtorInitTest.cs
index bbfe6aef1e44..2d218ec6ae11 100644
--- a/tests/introspection/ApiCtorInitTest.cs
+++ b/tests/introspection/ApiCtorInitTest.cs
@@ -319,7 +319,7 @@ public void DefaultCtorAllowed ()
}
n++;
}
- Assert.AreEqual (0, Errors, "{0} potential errors found in {1} default ctor validated{2}", Errors, n, Errors == 0 ? string.Empty : ":\n" + ErrorData.ToString () + "\n");
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} potential errors found in {n} default ctor validated:\n{ErrorData}\n");
}
// .NET constructors are not virtual, so we need to re-expose the base class .ctor when a subclass is created.
@@ -371,7 +371,7 @@ public void DesignatedInitializer ()
n++;
}
}
- Assert.AreEqual (0, Errors, "{0} potential errors found in {1} designated initializer validated", Errors, n);
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} potential errors found in {n} designated initializer validated");
}
protected virtual bool Match (ConstructorInfo ctor, Type type)
@@ -639,7 +639,7 @@ public void ShouldNotExposeDefaultCtorTest ()
}
n++;
}
- Assert.AreEqual (0, Errors, $"{Errors} potential errors found in {n} BaseType empty ctor validated: \n{ErrorData}\n{(genObjCTestCode ? $"\n\n{objCCode}\n" : string.Empty)}");
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} potential errors found in {n} BaseType empty ctor validated: \n{ErrorData}\n{(genObjCTestCode ? $"\n\n{objCCode}\n" : string.Empty)}");
}
protected virtual bool SkipCheckShouldNotExposeDefaultCtor (Type type)
@@ -681,7 +681,7 @@ public void ARAnchorCopyingCtorTest ()
ReportError ("{0} should re-expose IARAnchorCopying::.ctor(ARAnchor)", t);
}
- Assert.AreEqual (0, Errors, "{0} potential errors found when validating if subclasses of 'ARAnchor' re-expose 'IARAnchorCopying' constructor", Errors);
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} potential errors found when validating if subclasses of 'ARAnchor' re-expose 'IARAnchorCopying' constructor");
}
#endif
}
diff --git a/tests/introspection/ApiFieldTest.cs b/tests/introspection/ApiFieldTest.cs
index d850e49a0669..1c2ffebdc05d 100644
--- a/tests/introspection/ApiFieldTest.cs
+++ b/tests/introspection/ApiFieldTest.cs
@@ -200,7 +200,7 @@ public void Notifications ()
}
n++;
}
- Assert.AreEqual (0, Errors, "{0} errors found in {1} fields validated: {2}", Errors, n, string.Join (", ", failed_fields));
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} errors found in {n} fields validated: {string.Join (", ", failed_fields)}");
}
[Test]
@@ -225,7 +225,7 @@ public void NonNullNSStringFields ()
}
n++;
}
- Assert.AreEqual (0, Errors, "{0} errors found in {1} fields validated: {2}", Errors, n, string.Join (", ", failed_fields));
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} errors found in {n} fields validated: {string.Join (", ", failed_fields)}");
}
[Test]
@@ -264,7 +264,7 @@ public void FieldExists ()
Dlfcn.dlclose (lib);
n++;
}
- Assert.AreEqual (0, Errors, "{0} errors found in {1} fields validated: {2}", Errors, n, string.Join (", ", failed_fields));
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} errors found in {n} fields validated: {string.Join (", ", failed_fields)}");
}
}
}
diff --git a/tests/introspection/ApiPInvokeTest.cs b/tests/introspection/ApiPInvokeTest.cs
index 9407f80b3fb8..65d216667185 100644
--- a/tests/introspection/ApiPInvokeTest.cs
+++ b/tests/introspection/ApiPInvokeTest.cs
@@ -176,7 +176,7 @@ public void SymbolExists ()
Dlfcn.dlclose (lib);
n++;
}
- Assert.AreEqual (0, Errors, "{0} errors found in {1} functions validated: {2}", Errors, n, string.Join (", ", failed_api));
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} errors found in {n} functions validated: {string.Join (", ", failed_api)}");
}
bool SkipDueToDeviceCapabilities (Type type)
@@ -282,7 +282,7 @@ protected void Check (Assembly a)
n++;
}
}
- Assert.AreEqual (0, Errors, "{0} errors found in {1} symbol lookups{2}", Errors, n, Errors == 0 ? string.Empty : ":\n" + ErrorData.ToString () + "\n");
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} errors found in {n} symbol lookups:\n{ErrorData}\n");
}
protected string ResolveLibrarySymlinks (string path)
diff --git a/tests/introspection/ApiProtocolTest.cs b/tests/introspection/ApiProtocolTest.cs
index e4b65416d49f..e556f72676a2 100644
--- a/tests/introspection/ApiProtocolTest.cs
+++ b/tests/introspection/ApiProtocolTest.cs
@@ -846,7 +846,7 @@ protected virtual bool Skip (Type type, string protocolName)
void CheckProtocol (string protocolName, Action action)
{
IntPtr protocol = Runtime.GetProtocol (protocolName);
- Assert.AreNotEqual (protocol, IntPtr.Zero, protocolName);
+ Assert.That (IntPtr.Zero, Is.Not.EqualTo (protocol), protocolName);
int n = 0;
foreach (Type t in Assembly.GetTypes ()) {
@@ -881,7 +881,7 @@ public void Coding ()
// FIXME: and implement the .ctor(NSCoder)
}
});
- Assert.AreEqual (Errors, 0, "{0} types conforms to NSCoding but does not implement INSCoding: {1}", Errors, String.Join ('\n', list));
+ Assert.That (0, Is.EqualTo (Errors), $"{Errors} types conforms to NSCoding but does not implement INSCoding: {String.Join ('\n', list)}");
}
// [Test] -> iOS 6.0+ and Mountain Lion (10.8) +
@@ -898,7 +898,7 @@ public virtual void SecureCoding ()
}
}
});
- Assert.AreEqual (Errors, 0, "{0} types conforms to NSSecureCoding but does not implement INSSecureCoding: {1}", Errors, String.Join ('\n', list));
+ Assert.That (0, Is.EqualTo (Errors), $"{Errors} types conforms to NSSecureCoding but does not implement INSSecureCoding: {String.Join ('\n', list)}");
}
bool SupportsSecureCoding (Type type)
@@ -941,11 +941,11 @@ public virtual void SupportsSecureCoding ()
} else if (type.IsPublic && supports) {
// there are internal types, e.g. DataWrapper : NSData, that subclass NSSecureCoding-types without
// [re-]declaring their allegiance - but we can live with those small betrayals
- Assert.IsFalse (NSSecureCoding.SupportsSecureCoding (type), "{0} !SupportsSecureCoding", type.Name);
+ Assert.That (NSSecureCoding.SupportsSecureCoding (type), Is.False, $"{type.Name} !SupportsSecureCoding");
ReportError ("SupportsSecureCoding returns true but {0} does not conforms to NSSecureCoding", type.Name);
}
});
- Assert.AreEqual (Errors, 0, "{0} types conforms to NSCoding but does not implement INSSecureCoding", Errors);
+ Assert.That (0, Is.EqualTo (Errors), $"{Errors} types conforms to NSCoding but does not implement INSSecureCoding");
}
[Test]
@@ -964,7 +964,7 @@ public void Copying ()
}
}
});
- Assert.AreEqual (Errors, 0, "{0} types conforms to NSCopying but does not implement INSCopying: {1}", Errors, String.Join ('\n', list));
+ Assert.That (0, Is.EqualTo (Errors), $"{Errors} types conforms to NSCopying but does not implement INSCopying: {String.Join ('\n', list)}");
}
[Test]
@@ -983,7 +983,7 @@ public void MutableCopying ()
}
}
});
- Assert.AreEqual (Errors, 0, "{0} types conforms to NSMutableCopying but does not implement INSMutableCopying: {1}", Errors, String.Join ('\n', list));
+ Assert.That (0, Is.EqualTo (Errors), $"{Errors} types conforms to NSMutableCopying but does not implement INSMutableCopying: {String.Join ('\n', list)}");
}
[Test]
diff --git a/tests/introspection/ApiSelectorTest.cs b/tests/introspection/ApiSelectorTest.cs
index 2f089ffa2ad3..d22c7b8829d2 100644
--- a/tests/introspection/ApiSelectorTest.cs
+++ b/tests/introspection/ApiSelectorTest.cs
@@ -1398,7 +1398,7 @@ public void Protocols ()
}
}
}
- Assert.AreEqual (0, Errors, "{0} errors found in {1} protocol selectors validated", Errors, n);
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} errors found in {n} protocol selectors validated");
}
void ProcessProtocolMember (Type t, MethodBase m, ref int n)
@@ -1465,7 +1465,7 @@ public void InstanceMethods ()
Process (class_ptr, t, m, ref n);
}
}
- Assert.AreEqual (0, Errors, "{0} errors found in {1} instance selector validated{2}", Errors, n, Errors == 0 ? string.Empty : ":\n" + ErrorData.ToString () + "\n");
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} errors found in {n} instance selector validated:\n{ErrorData}\n");
}
void Process (IntPtr class_ptr, Type t, MethodBase m, ref int n)
@@ -1573,7 +1573,7 @@ public void StaticMethods ()
}
}
}
- Assert.AreEqual (0, Errors, "{0} errors found in {1} static selector validated{2}", Errors, n, Errors == 0 ? string.Empty : ":\n" + ErrorData.ToString () + "\n");
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} errors found in {n} static selector validated:\n{ErrorData}\n");
}
}
}
diff --git a/tests/introspection/ApiSignatureTest.cs b/tests/introspection/ApiSignatureTest.cs
index 4d88583eb5cf..d9c1fa6bd2b5 100644
--- a/tests/introspection/ApiSignatureTest.cs
+++ b/tests/introspection/ApiSignatureTest.cs
@@ -57,7 +57,7 @@ public abstract class ApiSignatureTest : ApiBaseTest {
if (encoded [end] != '@' || encoded [end + 1] != '0' || encoded [end + 2] != ':') {
if (!ContinueOnFailure)
- Assert.Fail ("Unexpected format, missing '@0:', inside '{0}'", encoded);
+ Assert.Fail ($"Unexpected format, missing '@0:', inside '{encoded}'");
return null;
}
diff --git a/tests/introspection/ApiStructTest.cs b/tests/introspection/ApiStructTest.cs
index cc71f137b548..5106fe6ebd68 100644
--- a/tests/introspection/ApiStructTest.cs
+++ b/tests/introspection/ApiStructTest.cs
@@ -44,9 +44,7 @@ public void Structs ()
}
}
- Assert.AreEqual (0, totalErrors,
- "{0} errors found in {1} structures validated",
- totalErrors, totalStructs);
+ Assert.That (totalErrors, Is.EqualTo (0), $"{totalErrors} errors found in {totalStructs} structures validated");
}
protected virtual bool CheckStruct (Type type)
diff --git a/tests/introspection/ApiTypoTest.cs b/tests/introspection/ApiTypoTest.cs
index a42f62aa4141..078b13536101 100644
--- a/tests/introspection/ApiTypoTest.cs
+++ b/tests/introspection/ApiTypoTest.cs
@@ -843,7 +843,7 @@ public virtual void AttributeTypoTest ()
foreach (Type t in types)
AttributeTypo (t, ref totalErrors);
- Assert.AreEqual (0, totalErrors, "Attributes have typos!");
+ Assert.That (totalErrors, Is.EqualTo (0), "Attributes have typos!");
}
void AttributeTypo (Type t, ref int totalErrors)
@@ -951,7 +951,7 @@ public virtual void TypoTest ()
ReportError ($"Unnecessary allowed typo \"{typo}\" is not present in any API name");
totalErrors++;
}
- Assert.AreEqual (0, totalErrors, "Typos!");
+ Assert.That (totalErrors, Is.EqualTo (0), "Typos!");
}
string? GetMessage (object attribute)
@@ -1137,7 +1137,7 @@ public void ConstantsCheck ()
switch (fi.Name) {
case "Version":
case "SdkVersion":
- Assert.True (Version.TryParse (s, out _), fi.Name);
+ Assert.That (Version.TryParse (s, out _), Is.True, fi.Name);
break;
#if !XAMCORE_5_0
case "AssetsLibraryLibrary":
@@ -1151,7 +1151,7 @@ public void ConstantsCheck ()
case "MLComputeLibrary":
// Xcode 12 beta 2 does not ship these framework/headers for the simulators
if (TestRuntime.IsDevice)
- Assert.True (CheckLibrary (s), fi.Name);
+ Assert.That (CheckLibrary (s), Is.True, fi.Name);
break;
#endif
#if __TVOS__
@@ -1190,7 +1190,7 @@ public void ConstantsCheck ()
if (fi.Name == "AutomaticAssessmentConfigurationLibrary" && !TestRuntime.CheckXcodeVersion (11, 4))
continue;
#endif
- Assert.True (CheckLibrary (s), fi.Name);
+ Assert.That (CheckLibrary (s), Is.True, fi.Name);
} else {
Assert.Fail ($"Unknown '{fi.Name}' field cannot be verified - please fix me!");
}
diff --git a/tests/introspection/ApiWeakPropertyTest.cs b/tests/introspection/ApiWeakPropertyTest.cs
index e11770ba8dbb..da5e64d5025b 100644
--- a/tests/introspection/ApiWeakPropertyTest.cs
+++ b/tests/introspection/ApiWeakPropertyTest.cs
@@ -102,7 +102,7 @@ public void WeakPropertiesHaveArgumentSemantic ()
n++;
}
}
- Assert.AreEqual (0, Errors, "{0} errors found in {1} fields validated: {2}", Errors, n, string.Join (", ", failed_properties));
+ Assert.That (Errors, Is.EqualTo (0), $"{Errors} errors found in {n} fields validated: {string.Join (", ", failed_properties)}");
}
bool CheckArgumentSemantic (MethodInfo meth, [NotNullWhen (true)] out string? error)
diff --git a/tests/linker/AppDelegate.cs b/tests/linker/AppDelegate.cs
index aada6d6653f9..052309946b8d 100644
--- a/tests/linker/AppDelegate.cs
+++ b/tests/linker/AppDelegate.cs
@@ -12,6 +12,6 @@ static partial void AddTestAssembliesImpl (HashSet assemblies)
public class LoaderTest {
public void TestAssemblyCount ()
{
- Assert.AreEqual (2, TestLoader.GetTestAssemblies ().Count (), "Test assembly count");
+ Assert.That (TestLoader.GetTestAssemblies ().Count (), Is.EqualTo (2), "Test assembly count");
}
}
diff --git a/tests/linker/BaseOptimizeGeneratedCodeTest.cs b/tests/linker/BaseOptimizeGeneratedCodeTest.cs
index 50d32b49afb0..82b58582d550 100644
--- a/tests/linker/BaseOptimizeGeneratedCodeTest.cs
+++ b/tests/linker/BaseOptimizeGeneratedCodeTest.cs
@@ -33,7 +33,7 @@ public void SetupBlock_CustomDelegate ()
var action = new Action (() => counter++);
Custom (action);
CustomWithAttribute (action);
- Assert.AreEqual (2, counter, "Counter");
+ Assert.That (counter, Is.EqualTo (2), "Counter");
}
delegate void CustomDelegate (IntPtr block);
@@ -91,7 +91,7 @@ public void SetupBlockPerfTest ()
for (var i = 0; i < iterations; i++)
SetupBlockUnoptimized (unoptimizedAction);
unoptimizedWatch.Stop ();
- Assert.AreEqual (iterations, unoptimizedCounter, "Unoptimized Counter");
+ Assert.That (unoptimizedCounter, Is.EqualTo (iterations), "Unoptimized Counter");
// Run optimized
var optimizedWatch = System.Diagnostics.Stopwatch.StartNew ();
@@ -99,7 +99,7 @@ public void SetupBlockPerfTest ()
for (var i = 0; i < iterations; i++)
SetupBlockOptimized (optimizedAction);
optimizedWatch.Stop ();
- Assert.AreEqual (iterations, optimizedCounter, "Optimized Counter");
+ Assert.That (optimizedCounter, Is.EqualTo (iterations), "Optimized Counter");
//Console.WriteLine ("Optimized: {0} ms", optimizedWatch.ElapsedMilliseconds);
//Console.WriteLine ("Unoptimized: {0} ms", unoptimizedWatch.ElapsedMilliseconds);
@@ -145,7 +145,7 @@ public void SetupBlockCodeTest ()
SetupBlockOptimized_LoadLocalVariable4 (action);
SetupBlockOptimized_LoadLocalVariable (action);
- Assert.AreEqual (19, counter, "Counter");
+ Assert.That (counter, Is.EqualTo (19), "Counter");
}
public delegate void Action_IntPtr (IntPtr param);
@@ -517,22 +517,22 @@ public void IsARM64CallingConvention ()
method = typeof (BaseOptimizeGeneratedCodeTest).GetMethod (nameof (GetIsARM64CallingConventionOptimized), BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static)!;
instructions = new ILReader (method);
call_instructions = instructions.Where ((v) => v.OpCode.Name == "ldsfld");
- Assert.AreEqual (0, call_instructions.Count (), "optimized: no ldsfld instruction");
+ Assert.That (call_instructions.Count (), Is.EqualTo (0), "optimized: no ldsfld instruction");
method = typeof (BaseOptimizeGeneratedCodeTest).GetMethod (nameof (GetIsARM64CallingConventionNotOptimized), BindingFlags.NonPublic | BindingFlags.Instance)!;
instructions = new ILReader (method);
call_instructions = instructions.Where ((v) => v.OpCode.Name == "ldsfld");
- Assert.AreEqual (1, call_instructions.Count (), "not optimized: 1 ldsfld instruction");
+ Assert.That (call_instructions.Count (), Is.EqualTo (1), "not optimized: 1 ldsfld instruction");
method = typeof (Runtime).GetMethod ("GetIsARM64CallingConvention", BindingFlags.Static | BindingFlags.NonPublic)!;
instructions = new ILReader (method);
- Assert.AreEqual (2, instructions.Count (), "IL Count");
+ Assert.That (instructions.Count (), Is.EqualTo (2), "IL Count");
Assert.That (instructions.Skip (0).First ().OpCode, Is.EqualTo (OpCodes.Ldc_I4_0).Or.EqualTo (OpCodes.Ldc_I4_1), "IL 1");
Assert.That (instructions.Skip (1).First ().OpCode, Is.EqualTo (OpCodes.Ret), "IL 2");
#endif
- Assert.AreEqual (Runtime.IsARM64CallingConvention, GetIsARM64CallingConventionOptimized (), "Value optimized");
- Assert.AreEqual (Runtime.IsARM64CallingConvention, GetIsARM64CallingConventionNotOptimized (), "Value unoptimized");
+ Assert.That (GetIsARM64CallingConventionOptimized (), Is.EqualTo (Runtime.IsARM64CallingConvention), "Value optimized");
+ Assert.That (GetIsARM64CallingConventionNotOptimized (), Is.EqualTo (Runtime.IsARM64CallingConvention), "Value unoptimized");
}
[BindingImplAttribute (BindingImplOptions.Optimizable)]
diff --git a/tests/linker/CommonLinkAllTest.cs b/tests/linker/CommonLinkAllTest.cs
index 3a98d3d7ce96..58fe0325c34d 100644
--- a/tests/linker/CommonLinkAllTest.cs
+++ b/tests/linker/CommonLinkAllTest.cs
@@ -69,7 +69,7 @@ public void BindingsAndBeforeInitField_2 ()
[Test]
public void TypeConverter_BuiltIn ()
{
- Assert.NotNull (TypeDescriptor.GetConverter (new BuiltInConverter ()), "BuiltInConverter");
+ Assert.That (TypeDescriptor.GetConverter (new BuiltInConverter ()), Is.Not.Null, "BuiltInConverter");
string? name = (typeof (BuiltInConverter).GetCustomAttributes (false) [0] as TypeConverterAttribute)?.ConverterTypeName;
var typename = $"System.ComponentModel.BooleanConverter, System.ComponentModel.TypeConverter, Version={typeof (int).Assembly.GetName ().Version}, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
@@ -79,7 +79,7 @@ public void TypeConverter_BuiltIn ()
[Test]
public void TypeConverter_Custom ()
{
- Assert.NotNull (TypeDescriptor.GetConverter (new TypeDescriptorTest ()), "TypeDescriptorTest");
+ Assert.That (TypeDescriptor.GetConverter (new TypeDescriptorTest ()), Is.Not.Null, "TypeDescriptorTest");
string? name = (typeof (TypeDescriptorTest).GetCustomAttributes (false) [0] as TypeConverterAttribute)?.ConverterTypeName;
var typename = "LinkAll.CustomConverter, link all, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
@@ -91,7 +91,7 @@ public void ConstantsVersion_4859 ()
{
// Check that the Makefile generated a valid version number, e.g. "12.3." was not
// reference: https://github.com/dotnet/macios/issues/4859
- Assert.True (Version.TryParse (ObjCRuntime.Constants.Version, out var _), "Version");
+ Assert.That (Version.TryParse (ObjCRuntime.Constants.Version, out var _), Is.True, "Version");
}
}
}
diff --git a/tests/linker/CommonLinkAnyTest.cs b/tests/linker/CommonLinkAnyTest.cs
index e873edbcff10..256ab6641fce 100644
--- a/tests/linker/CommonLinkAnyTest.cs
+++ b/tests/linker/CommonLinkAnyTest.cs
@@ -25,10 +25,10 @@ public void Blocks ()
b = obj.ToString ()!;
});
// test behavior (we did not break anything)
- Assert.AreEqual ("b", b, "Stop");
+ Assert.That (b, Is.EqualTo ("b"), "Stop");
// test that BlockLiteral is fully preserved
int size = Marshal.SizeOf (typeof (BlockLiteral)); // e.g. unused 'reserved' must not be removed
- Assert.AreEqual (IntPtr.Size == 8 ? 48 : 28, size, "BlockLiteral size");
+ Assert.That (size, Is.EqualTo (IntPtr.Size == 8 ? 48 : 28), "BlockLiteral size");
}
@@ -41,15 +41,15 @@ public void CallerFilePath ()
// https://bugzilla.xamarin.com/show_bug.cgi?id=7114
public static void Bug7114 ([CallerFilePath] string? filePath = null)
{
- Assert.IsNotNull (filePath, "CallerFilePath");
+ Assert.That (filePath, Is.Not.Null, "CallerFilePath");
}
[Test]
public void AppContextGetData ()
{
// https://github.com/dotnet/runtime/issues/50290
- Assert.IsNotNull (AppContext.GetData ("APP_PATHS"), "APP_PATHS");
- Assert.IsNotNull (AppContext.GetData ("PINVOKE_OVERRIDE"), "PINVOKE_OVERRIDE");
+ Assert.That (AppContext.GetData ("APP_PATHS"), Is.Not.Null, "APP_PATHS");
+ Assert.That (AppContext.GetData ("PINVOKE_OVERRIDE"), Is.Not.Null, "PINVOKE_OVERRIDE");
}
[Test]
@@ -68,26 +68,26 @@ public void BackingFieldInGenericType ()
public void JsonSerializer_Serialize ()
{
var a = JsonSerializer.Serialize (42);
- Assert.AreEqual ("42", a, "serialized 42");
+ Assert.That (a, Is.EqualTo ("42"), "serialized 42");
var b = JsonSerializer.Serialize (new int [] { 42, 3, 14, 15 });
- Assert.AreEqual ("[42,3,14,15]", b, "serialized array");
+ Assert.That (b, Is.EqualTo ("[42,3,14,15]"), "serialized array");
}
[Test]
public void JsonSerializer_Deserialize ()
{
var a = JsonSerializer.Deserialize ("42");
- Assert.AreEqual (42, a, "deserialized 42");
+ Assert.That (a, Is.EqualTo (42), "deserialized 42");
var b = JsonSerializer.Deserialize ("[42,3,14,15]");
- CollectionAssert.AreEqual (new int [] { 42, 3, 14, 15 }, b, "deserialized array");
+ Assert.That (b!, Is.EqualTo (new int [] { 42, 3, 14, 15 }), "deserialized array");
}
[Test]
public void AES ()
{
- Assert.NotNull (Aes.Create (), "AES");
+ Assert.That (Aes.Create (), Is.Not.Null, "AES");
}
static bool waited;
@@ -122,7 +122,7 @@ static async Task GetWebPageAsync ()
string content = await response.Content.ReadAsStringAsync ();
waited = true;
bool success = !String.IsNullOrEmpty (content);
- Assert.IsTrue (success, $"received {content.Length} bytes");
+ Assert.That (success, Is.True, $"received {content.Length} bytes");
}
}
}
@@ -138,7 +138,7 @@ public void GetWebPageAsyncTest ()
if (requestError) {
Assert.Inconclusive ($"Test cannot be trusted. Issues performing the request. Status code '{statusCode}'");
} else {
- Assert.IsTrue (waited, "async/await worked");
+ Assert.That (waited, Is.True, "async/await worked");
}
} finally {
SynchronizationContext.SetSynchronizationContext (current_sc);
diff --git a/tests/linker/dont link/DontLinkRegressionTests.cs b/tests/linker/dont link/DontLinkRegressionTests.cs
index 017cf20ce65b..dc7cbed346fb 100644
--- a/tests/linker/dont link/DontLinkRegressionTests.cs
+++ b/tests/linker/dont link/DontLinkRegressionTests.cs
@@ -30,7 +30,7 @@ public class DontLinkRegressionTests {
public void Bug587_FullAotRuntime ()
{
KeyValuePair valuePair = queued.FirstOrDefault (delegate { return true; });
- Assert.NotNull (valuePair);
+ Assert.That (valuePair, Is.Not.Null);
// should not crash with System.ExecutionEngineException
}
@@ -39,7 +39,7 @@ public void RemovedAttributes ()
{
// since we do not link the attributes will be available - used or not by the application
var fullname = typeof (NSObject).Assembly.FullName;
- Assert.NotNull (Type.GetType ("ObjCRuntime.ThreadSafeAttribute, " + fullname), "ThreadSafeAttribute");
+ Assert.That (Type.GetType ("ObjCRuntime.ThreadSafeAttribute, " + fullname), Is.Not.Null, "ThreadSafeAttribute");
}
#if !__MACOS__
@@ -65,7 +65,7 @@ public void DefaultEncoding ()
// https://bugzilla.xamarin.com/show_bug.cgi?id=29928
var de = System.Text.Encoding.Default;
Assert.That (de.WebName, Is.EqualTo ("utf-8"), "Name");
- Assert.True (de.IsReadOnly, "IsReadOnly");
+ Assert.That (de.IsReadOnly, Is.True, "IsReadOnly");
}
#if __TVOS__
@@ -77,7 +77,7 @@ void AssertThrowsWrappedNotSupportedException (Action action, string message)
} catch (TargetInvocationException tie) {
var nse = tie.InnerException as TargetInvocationException;
if (nse is not null)
- Assert.Fail ("An exception was thrown, but {0} instead of NotSupportedException. " + message, nse.GetType ().FullName);
+ Assert.Fail ($"An exception was thrown, but {nse.GetType ().FullName} instead of NotSupportedException. " + message);
}
}
[Test]
diff --git a/tests/linker/link all/AttributeTest.cs b/tests/linker/link all/AttributeTest.cs
index 99f69af92667..c34f11e25783 100644
--- a/tests/linker/link all/AttributeTest.cs
+++ b/tests/linker/link all/AttributeTest.cs
@@ -115,9 +115,9 @@ public void DebugAssemblyAttributes ()
result = true;
}
#if DEBUG
- Assert.True (result, "DebuggableAttribute");
+ Assert.That (result, Is.True, "DebuggableAttribute");
#else
- Assert.False (result, "DebuggableAttribute");
+ Assert.That (result, Is.False, "DebuggableAttribute");
#endif
}
@@ -157,9 +157,9 @@ public void DebugPropertyAttributes ()
result = true;
}
#if DEBUG
- Assert.True (result, "DebuggerBrowsable");
+ Assert.That (result, Is.True, "DebuggerBrowsable");
#else
- Assert.False (result, "DebuggerBrowsable");
+ Assert.That (result, Is.False, "DebuggerBrowsable");
#endif
}
@@ -167,15 +167,15 @@ public void DebugPropertyAttributes ()
public void DebuggerTypeProxy_24203 ()
{
var d = new Dictionary () { { "key", 0 } };
- Assert.NotNull (d); // just to be 100% sure it won't be linked away (with the attribute we'll be looking for)
+ Assert.That (d, Is.Not.Null); // just to be 100% sure it won't be linked away (with the attribute we'll be looking for)
var proxy = Type.GetType ("System.Collections.Generic.IDictionaryDebugView`2, " + mscorlib)!;
#if DEBUG
- Assert.NotNull (proxy, "proxy");
+ Assert.That (proxy, Is.Not.Null, "proxy");
// having the type is nice, but it must not be empty to be useful
Assert.That (proxy.GetConstructors ().Length, Is.GreaterThan (0), "constructors");
Assert.That (proxy.GetProperties ().Length, Is.GreaterThan (0), "properties");
#else
- Assert.Null (proxy, "proxy");
+ Assert.That (proxy, Is.Null, "proxy");
#endif
}
@@ -185,19 +185,19 @@ public void CustomAttributesWithTypes ()
var assembly = GetType ().Assembly;
var ta = assembly.GetCustomAttributes ();
Assert.That (ta.Count (), Is.EqualTo (3), "Type[]");
- Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeA"), "CustomTypeA");
- Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeAA"), "CustomTypeAA");
- Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeAAA"), "CustomTypeAAA");
- //Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeAAAA"), "CustomTypeAAAA");
+ Assert.That (Type.GetType ("LinkAll.Attributes.CustomTypeA"), Is.Not.Null, "CustomTypeA");
+ Assert.That (Type.GetType ("LinkAll.Attributes.CustomTypeAA"), Is.Not.Null, "CustomTypeAA");
+ Assert.That (Type.GetType ("LinkAll.Attributes.CustomTypeAAA"), Is.Not.Null, "CustomTypeAAA");
+ //Assert.That (Type.GetType ("LinkAll.Attributes.CustomTypeAAAA"), Is.Not.Null, "CustomTypeAAAA");
var t = assembly.GetCustomAttributes ();
Assert.That (t.Count (), Is.EqualTo (2), "Type");
- Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomType"), "CustomType");
- Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeG"), "CustomTypeG");
+ Assert.That (Type.GetType ("LinkAll.Attributes.CustomType"), Is.Not.Null, "CustomType");
+ Assert.That (Type.GetType ("LinkAll.Attributes.CustomTypeG"), Is.Not.Null, "CustomTypeG");
//var to = assembly.GetCustomAttributes ();
//Assert.That (to.Count (), Is.EqualTo (1), "Object");
- //Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeO"), "CustomTypeO");
+ //Assert.That (Type.GetType ("LinkAll.Attributes.CustomTypeO"), Is.Not.Null, "CustomTypeO");
}
}
}
diff --git a/tests/linker/link all/ClassLayoutTest.cs b/tests/linker/link all/ClassLayoutTest.cs
index 0d5a200c8f9d..1c626ed35d1a 100644
--- a/tests/linker/link all/ClassLayoutTest.cs
+++ b/tests/linker/link all/ClassLayoutTest.cs
@@ -54,9 +54,9 @@ public void DefaultLayoutClass () // auto
Assert.That (fields.Length, Is.EqualTo (1), "Length");
Assert.That (fields [0].Name, Is.EqualTo ("used"), "Name");
- Assert.True (t.IsAutoLayout, "IsAutoLayout");
- Assert.False (t.IsExplicitLayout, "IsExplicitLayout");
- Assert.False (t.IsLayoutSequential, "IsLayoutSequential");
+ Assert.That (t.IsAutoLayout, Is.True, "IsAutoLayout");
+ Assert.That (t.IsExplicitLayout, Is.False, "IsExplicitLayout");
+ Assert.That (t.IsLayoutSequential, Is.False, "IsLayoutSequential");
}
[Test]
@@ -70,9 +70,9 @@ public void AutoLayoutClass ()
Assert.That (fields.Length, Is.EqualTo (1), "Length");
Assert.That (fields [0].Name, Is.EqualTo ("used"), "Name");
- Assert.True (t.IsAutoLayout, "IsAutoLayout");
- Assert.False (t.IsExplicitLayout, "IsExplicitLayout");
- Assert.False (t.IsLayoutSequential, "IsLayoutSequential");
+ Assert.That (t.IsAutoLayout, Is.True, "IsAutoLayout");
+ Assert.That (t.IsExplicitLayout, Is.False, "IsExplicitLayout");
+ Assert.That (t.IsLayoutSequential, Is.False, "IsLayoutSequential");
}
[Test]
@@ -85,9 +85,9 @@ public void LayoutSequential ()
var fields = t.GetFields ();
Assert.That (fields.Length, Is.EqualTo (2), "Length");
- Assert.False (t.IsAutoLayout, "IsAutoLayout");
- Assert.False (t.IsExplicitLayout, "IsExplicitLayout");
- Assert.True (t.IsLayoutSequential, "IsLayoutSequential");
+ Assert.That (t.IsAutoLayout, Is.False, "IsAutoLayout");
+ Assert.That (t.IsExplicitLayout, Is.False, "IsExplicitLayout");
+ Assert.That (t.IsLayoutSequential, Is.True, "IsLayoutSequential");
}
[Test]
@@ -100,9 +100,9 @@ public void ExplicitLayout ()
var fields = t.GetFields ();
Assert.That (fields.Length, Is.EqualTo (3), "Length");
- Assert.False (t.IsAutoLayout, "IsAutoLayout");
- Assert.True (t.IsExplicitLayout, "IsExplicitLayout");
- Assert.False (t.IsLayoutSequential, "IsLayoutSequential");
+ Assert.That (t.IsAutoLayout, Is.False, "IsAutoLayout");
+ Assert.That (t.IsExplicitLayout, Is.True, "IsExplicitLayout");
+ Assert.That (t.IsLayoutSequential, Is.False, "IsLayoutSequential");
}
}
}
diff --git a/tests/linker/link all/DataContractTest.cs b/tests/linker/link all/DataContractTest.cs
index 4648807189d6..4c9daae79b30 100644
--- a/tests/linker/link all/DataContractTest.cs
+++ b/tests/linker/link all/DataContractTest.cs
@@ -67,7 +67,7 @@ public void Flags ()
var t1 = new TestClass (SomeTypes.Audio | SomeTypes.Image);
var st = ToXml (t1);
var t2 = FromXml (st);
- Assert.AreEqual (t2.Types, t1.Types);
+ Assert.That (t1.Types, Is.EqualTo (t2.Types));
}
}
}
diff --git a/tests/linker/link all/InterfacesTest.cs b/tests/linker/link all/InterfacesTest.cs
index 9b46ca26b4d0..326eb3d741a6 100644
--- a/tests/linker/link all/InterfacesTest.cs
+++ b/tests/linker/link all/InterfacesTest.cs
@@ -74,23 +74,23 @@ public void Bug10866 ()
F (new A ());
// Foo and Bar methods are both used on A and must be present
- Assert.NotNull (type_a.GetMethod ("Foo", BindingFlags.Instance | BindingFlags.Public), "A::Foo");
- Assert.NotNull (type_a.GetMethod ("Bar", BindingFlags.Instance | BindingFlags.Public), "A::Bar");
+ Assert.That (type_a.GetMethod ("Foo", BindingFlags.Instance | BindingFlags.Public), Is.Not.Null, "A::Foo");
+ Assert.That (type_a.GetMethod ("Bar", BindingFlags.Instance | BindingFlags.Public), Is.Not.Null, "A::Bar");
// I::Foo is never used and can be removed
- Assert.Null (type_i.GetMethod ("Foo", BindingFlags.Instance | BindingFlags.Public), "I::Foo");
+ Assert.That (type_i.GetMethod ("Foo", BindingFlags.Instance | BindingFlags.Public), Is.Null, "I::Foo");
// I::Bar is used in F so everyone implementing I needs Bar
- Assert.NotNull (type_i.GetMethod ("Bar", BindingFlags.Instance | BindingFlags.Public), "I::Bar");
+ Assert.That (type_i.GetMethod ("Bar", BindingFlags.Instance | BindingFlags.Public), Is.Not.Null, "I::Bar");
// Foo and Bar are never used on B - so they can be removed
- Assert.Null (type_b.GetMethod ("Foo", BindingFlags.Instance | BindingFlags.Public), "B::Foo");
+ Assert.That (type_b.GetMethod ("Foo", BindingFlags.Instance | BindingFlags.Public), Is.Null, "B::Foo");
}
[Test]
public void Issue9566 ()
{
var ifaces = (I []) (object) new B [0];
- Assert.IsNotNull (ifaces, "Array cast");
+ Assert.That (ifaces, Is.Not.Null, "Array cast");
}
[DllImport ("/usr/lib/system/libsystem_dnssd.dylib")]
diff --git a/tests/linker/link all/InternalsTest.cs b/tests/linker/link all/InternalsTest.cs
index 31ef3ef2f3b8..480681065b7f 100644
--- a/tests/linker/link all/InternalsTest.cs
+++ b/tests/linker/link all/InternalsTest.cs
@@ -22,7 +22,7 @@ public class InternalsTest {
[Test]
public void RegionInfo_CountryCode ()
{
- Assert.IsNotNull (xamarin_get_locale_country_code (), "xamarin_get_locale_country_code");
+ Assert.That (xamarin_get_locale_country_code (), Is.Not.Null, "xamarin_get_locale_country_code");
}
[DllImport ("__Internal", CharSet = CharSet.Unicode)]
@@ -47,7 +47,7 @@ public void TimeZone_Names ()
for (int i = 0, offset = 0; i < count; i++, offset += IntPtr.Size) {
IntPtr p = Marshal.ReadIntPtr (array, offset);
string s = Marshal.PtrToStringAnsi (p)!;
- Assert.NotNull (s, i.ToString ());
+ Assert.That (s, Is.Not.Null, i.ToString ());
Marshal.FreeHGlobal (p);
}
Marshal.FreeHGlobal (array);
diff --git a/tests/linker/link all/LinkAllMacTest.cs b/tests/linker/link all/LinkAllMacTest.cs
index ba5c7d8ec071..363e29d8d920 100644
--- a/tests/linker/link all/LinkAllMacTest.cs
+++ b/tests/linker/link all/LinkAllMacTest.cs
@@ -18,14 +18,14 @@ public void EnsureUIThreadException ()
NSApplication.EnsureUIThread ();
ThreadPool.QueueUserWorkItem ((v) => Tester.Test ());
- Assert.IsTrue (Tester.mre.WaitOne (TimeSpan.FromSeconds (10)), "Successful wait");
+ Assert.That (Tester.mre.WaitOne (TimeSpan.FromSeconds (10)), Is.True, "Successful wait");
// The UI thread check only happens for debug builds, on release build it's linked away.
#if DEBUG
var expected_ex_thrown = true;
#else
var expected_ex_thrown = false;
#endif
- Assert.AreEqual (expected_ex_thrown, Tester.exception_thrown, "Success");
+ Assert.That (Tester.exception_thrown, Is.EqualTo (expected_ex_thrown), "Success");
}
@@ -59,7 +59,7 @@ public void XmlSerialization ()
using (var xr = new XmlTextReader (sr)) {
var xs = new XmlSerializer (typeof (SerializeMe));
var item = xs.Deserialize (xr) as SerializeMe;
- Assert.AreEqual (2, item!.SetMe, "SetMe");
+ Assert.That (item!.SetMe, Is.EqualTo (2), "SetMe");
}
}
diff --git a/tests/linker/link all/LinkAllTest.cs b/tests/linker/link all/LinkAllTest.cs
index ec798c25fac5..ead9ba0be8c4 100644
--- a/tests/linker/link all/LinkAllTest.cs
+++ b/tests/linker/link all/LinkAllTest.cs
@@ -100,8 +100,8 @@ public void GetterOnly ()
PropertyInfo pi = not_preserved_type.GetProperty ("Two")!;
// check the *unused* setter absence from the application
- Assert.NotNull (pi.GetGetMethod (), "getter");
- Assert.Null (pi.GetSetMethod (), "setter");
+ Assert.That (pi.GetGetMethod (), Is.Not.Null, "getter");
+ Assert.That (pi.GetSetMethod (), Is.Null, "setter");
}
[Test]
@@ -113,8 +113,8 @@ public void SetterOnly ()
PropertyInfo pi = not_preserved_type.GetProperty ("One")!;
// check the *unused* setter absence from the application
- Assert.Null (pi.GetGetMethod (), "getter");
- Assert.NotNull (pi.GetSetMethod (), "setter");
+ Assert.That (pi.GetGetMethod (), Is.Null, "getter");
+ Assert.That (pi.GetSetMethod (), Is.Not.Null, "setter");
}
[Test]
@@ -131,14 +131,14 @@ public void MEF_3862 ()
break;
}
}
- Assert.True (default_value, "DefaultValue");
+ Assert.That (default_value, Is.True, "DefaultValue");
}
static void Check (string calendarName, bool present)
{
var type = Type.GetType ("System.Globalization." + calendarName);
bool success = present == (type is not null);
- Assert.AreEqual (present, type is not null, calendarName);
+ Assert.That (type is not null, Is.EqualTo (present), calendarName);
}
[Test]
@@ -176,8 +176,8 @@ public void DetectPlatform ()
{
// for (future) nunit[lite] platform detection - if this test fails then platform detection won't work
var typename = NamespacePrefix + "UIKit.UIApplicationDelegate, " + AssemblyName;
- Assert.NotNull (Helper.GetType (typename), typename);
- Assert.Null (Helper.GetType ("Mono.Runtime"), "Mono.Runtime");
+ Assert.That (Helper.GetType (typename), Is.Not.Null, typename);
+ Assert.That (Helper.GetType ("Mono.Runtime"), Is.Null, "Mono.Runtime");
}
#endif // !__MACOS__
@@ -194,20 +194,20 @@ public void RemovedAttributes ()
string suffix = AssemblyName;
// since we're linking the attributes will NOT be available - even if they are used
- Assert.Null (Helper.GetType (prefix + "ObjCRuntime.IntroducedAttribute, " + suffix), "IntroducedAttribute");
- Assert.Null (Helper.GetType (prefix + "ObjCRuntime.DeprecatedAttribute, " + suffix), "DeprecatedAttribute");
- Assert.Null (Helper.GetType (prefix + "ObjCRuntime.ObsoletedAttribute, " + suffix), "ObsoletedAttribute");
- Assert.Null (Helper.GetType (prefix + "ObjCRuntime.UnavailableAttribute, " + suffix), "UnavailableAttribute");
- Assert.Null (Helper.GetType (prefix + "ObjCRuntime.ThreadSafeAttribute, " + suffix), "ThreadSafeAttribute");
- Assert.Null (Helper.GetType ("System.Runtime.Versioning.SupportedOSPlatformAttribute, " + suffix), "SupportedOSPlatformAttribute");
- Assert.Null (Helper.GetType ("System.Runtime.Versioning.UnsupportedOSPlatformAttribute, " + suffix), "UnsupportedOSPlatformAttribute");
+ Assert.That (Helper.GetType (prefix + "ObjCRuntime.IntroducedAttribute, " + suffix), Is.Null, "IntroducedAttribute");
+ Assert.That (Helper.GetType (prefix + "ObjCRuntime.DeprecatedAttribute, " + suffix), Is.Null, "DeprecatedAttribute");
+ Assert.That (Helper.GetType (prefix + "ObjCRuntime.ObsoletedAttribute, " + suffix), Is.Null, "ObsoletedAttribute");
+ Assert.That (Helper.GetType (prefix + "ObjCRuntime.UnavailableAttribute, " + suffix), Is.Null, "UnavailableAttribute");
+ Assert.That (Helper.GetType (prefix + "ObjCRuntime.ThreadSafeAttribute, " + suffix), Is.Null, "ThreadSafeAttribute");
+ Assert.That (Helper.GetType ("System.Runtime.Versioning.SupportedOSPlatformAttribute, " + suffix), Is.Null, "SupportedOSPlatformAttribute");
+ Assert.That (Helper.GetType ("System.Runtime.Versioning.UnsupportedOSPlatformAttribute, " + suffix), Is.Null, "UnsupportedOSPlatformAttribute");
}
[Test]
public void Assembly_Load ()
{
Assembly mscorlib = Assembly.Load ("System.Private.CoreLib.dll");
- Assert.NotNull (mscorlib, "System.Private.CoreLib.dll");
+ Assert.That (mscorlib, Is.Not.Null, "System.Private.CoreLib.dll");
}
string FindAssemblyPath ()
@@ -238,14 +238,14 @@ string FindAssemblyPath ()
public void Assembly_LoadFile ()
{
string filename = FindAssemblyPath ();
- Assert.NotNull (Assembly.LoadFile (Path.GetFullPath (filename)), "1");
+ Assert.That (Assembly.LoadFile (Path.GetFullPath (filename)), Is.Not.Null, "1");
}
[Test]
public void Assembly_LoadFrom ()
{
string filename = FindAssemblyPath ();
- Assert.NotNull (Assembly.LoadFrom (filename), "1");
+ Assert.That (Assembly.LoadFrom (filename), Is.Not.Null, "1");
}
[Test]
@@ -268,14 +268,14 @@ public void Pasteboard_ImagesTest ()
using (var img = new UIImage (cgimg)) {
UIPasteboard.General.Images = new UIImage [] { img };
if (TestRuntime.CheckXcodeVersion (8, 0))
- Assert.True (UIPasteboard.General.HasImages, "HasImages");
+ Assert.That (UIPasteboard.General.HasImages, Is.True, "HasImages");
- Assert.AreEqual (1, UIPasteboard.General.Images.Length, "a - length");
+ Assert.That (UIPasteboard.General.Images.Length, Is.EqualTo (1), "a - length");
UIPasteboard.General.Images = new UIImage [] { img, img };
- Assert.AreEqual (2, UIPasteboard.General.Images.Length, "b - length");
- Assert.IsNotNull (UIPasteboard.General.Images [0], "b - nonnull[0]");
- Assert.IsNotNull (UIPasteboard.General.Images [1], "b - nonnull[0]");
+ Assert.That (UIPasteboard.General.Images.Length, Is.EqualTo (2), "b - length");
+ Assert.That (UIPasteboard.General.Images [0], Is.Not.Null, "b - nonnull[0]");
+ Assert.That (UIPasteboard.General.Images [1], Is.Not.Null, "b - nonnull[0]");
}
}
}
@@ -285,7 +285,7 @@ public void Pasteboard_ImagesTest ()
[Test]
public void UltimateBindings ()
{
- Assert.IsNotNull (Bindings.Test.UltimateMachine.SharedInstance, "SharedInstance");
+ Assert.That (Bindings.Test.UltimateMachine.SharedInstance, Is.Not.Null, "SharedInstance");
}
#region bug 14456
@@ -371,14 +371,14 @@ public void NestedNSObject ()
{
// Parent type is not used - but it's not linked out
var p = Helper.GetType ("LinkAll.Parent");
- Assert.NotNull (p, "Parent");
+ Assert.That (p, Is.Not.Null, "Parent");
// because a nested type is a subclass of NSObject (and not part of monotouch.dll)
var n = p.GetNestedType ("Derived")!;
- Assert.NotNull (n, "Derived");
+ Assert.That (n, Is.Not.Null, "Derived");
// however other stuff in Parent, like unused methods, will be removed
- Assert.Null (p.GetMethod ("UnusedMethod"), "unused method");
+ Assert.That (p.GetMethod ("UnusedMethod"), Is.Null, "unused method");
// while exported stuff will be present
- Assert.NotNull (n.GetMethod ("Foo"), "unused Export method");
+ Assert.That (n.GetMethod ("Foo"), Is.Not.Null, "unused Export method");
}
[Test]
@@ -386,7 +386,7 @@ public void Bug20363 ()
{
// testing compile time error
CancelEventArgs cea = new CancelEventArgs ();
- Assert.NotNull (cea, "CancelEventArgs");
+ Assert.That (cea, Is.Not.Null, "CancelEventArgs");
}
string? GetField (object o, string s)
@@ -420,14 +420,14 @@ public void AnonymousType ()
id = 1234,
contentType = "xml"
});
- Assert.Null (result, result);
+ Assert.That (result, Is.Null, result);
}
[Test]
public void Events ()
{
using (var pr = new SKProductsRequest ()) {
- Assert.Null (pr.WeakDelegate, "none");
+ Assert.That (pr.WeakDelegate, Is.Null, "none");
// event on SKProductsRequest itself
pr.ReceivedResponse += (object? sender, SKProductsRequestResponseEventArgs e) => { };
@@ -435,15 +435,15 @@ public void Events ()
Assert.That (t.Name, Is.EqualTo ("_SKProductsRequestDelegate"), "delegate");
var fi = t.GetField ("receivedResponse", BindingFlags.NonPublic | BindingFlags.Instance)!;
- Assert.NotNull (fi, "receivedResponse");
+ Assert.That (fi, Is.Not.Null, "receivedResponse");
var value = fi.GetValue (pr.WeakDelegate);
- Assert.NotNull (value, "value");
+ Assert.That (value, Is.Not.Null, "value");
// and on the SKRequest defined one
pr.RequestFailed += (object? sender, SKRequestErrorEventArgs e) => { };
// and the existing (initial field) is still set
fi = t.GetField ("receivedResponse", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.NotNull (fi, "receivedResponse/SKRequest");
+ Assert.That (fi, Is.Not.Null, "receivedResponse/SKRequest");
}
}
@@ -453,7 +453,7 @@ public void Aot_27116 ()
var nix = (from nic in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces ()
where nic.Id.StartsWith ("en") || nic.Id.StartsWith ("pdp_ip")
select nic);
- Assert.NotNull (nix);
+ Assert.That (nix, Is.Not.Null);
}
[Test]
@@ -461,7 +461,7 @@ public void AppleTls ()
{
// make test work for classic (monotouch) and unified (iOS, tvOS)
var fqn = typeof (NSObject).AssemblyQualifiedName!.Replace ("Foundation.NSObject", "Security.Tls.AppleTlsProvider");
- Assert.Null (Helper.GetType (fqn), "Should NOT be included (no SslStream or Socket support)");
+ Assert.That (Helper.GetType (fqn), Is.Null, "Should NOT be included (no SslStream or Socket support)");
}
[Test]
@@ -470,7 +470,7 @@ public void WebKit_NSProxy ()
{
// this test works only because "Link all" does not use WebKit
var fqn = typeof (NSObject).AssemblyQualifiedName!.Replace ("Foundation.NSObject", "Foundation.NSProxy");
- Assert.Null (Helper.GetType (fqn), fqn);
+ Assert.That (Helper.GetType (fqn), Is.Null, fqn);
}
static Type type_Task = typeof (Task);
@@ -482,24 +482,24 @@ public void Bug59015 ()
CheckAsyncTaskMethodBuilder (typeof (AsyncTaskMethodBuilder));
var snfwc = type_Task.GetMethod ("NotifyDebuggerOfWaitCompletion", BindingFlags.Instance | BindingFlags.NonPublic);
#if DEBUG
- Assert.NotNull (snfwc, "Task.NotifyDebuggerOfWaitCompletion");
+ Assert.That (snfwc, Is.Not.Null, "Task.NotifyDebuggerOfWaitCompletion");
#else
// something keeps it from being removed
- // Assert.Null (snfwc, "Task.NotifyDebuggerOfWaitCompletion");
+ // Assert.That (snfwc, Is.Null, "Task.NotifyDebuggerOfWaitCompletion");
#endif
}
void CheckAsyncTaskMethodBuilder (Type atmb)
{
- Assert.NotNull (atmb, "AsyncTaskMethodBuilder");
+ Assert.That (atmb, Is.Not.Null, "AsyncTaskMethodBuilder");
var snfwc = atmb.GetMethod ("SetNotificationForWaitCompletion", BindingFlags.Instance | BindingFlags.NonPublic);
var oifd = atmb.GetProperty ("ObjectIdForDebugger", BindingFlags.Instance | BindingFlags.NonPublic);
#if DEBUG
- Assert.NotNull (snfwc, atmb.FullName + ".SetNotificationForWaitCompletion");
- Assert.NotNull (oifd, atmb.FullName + ".ObjectIdForDebugger");
+ Assert.That (snfwc, Is.Not.Null, atmb.FullName + ".SetNotificationForWaitCompletion");
+ Assert.That (oifd, Is.Not.Null, atmb.FullName + ".ObjectIdForDebugger");
#else
- Assert.Null (snfwc, atmb.FullName + ".SetNotificationForWaitCompletion");
- Assert.Null (oifd, atmb.FullName + ".ObjectIdForDebugger");
+ Assert.That (snfwc, Is.Null, atmb.FullName + ".SetNotificationForWaitCompletion");
+ Assert.That (oifd, Is.Null, atmb.FullName + ".ObjectIdForDebugger");
#endif
}
@@ -509,7 +509,7 @@ public void LinkedAwayGenericTypeAsOptionalMemberInProtocol ()
{
// https://github.com/dotnet/macios/issues/3523
// This test will fail at build time if it regresses (usually these types of build tests go into monotouch-test, but monotouch-test uses NSSet elsewhere, which this test requires to be linked away).
- Assert.IsNull (typeof (NSObject).Assembly.GetType (NamespacePrefix + "Foundation.NSSet`1"), "NSSet must be linked away, otherwise this test is useless");
+ Assert.That (typeof (NSObject).Assembly.GetType (NamespacePrefix + "Foundation.NSSet`1"), Is.Null, "NSSet must be linked away, otherwise this test is useless");
}
[Protocol (Name = "ProtocolWithGenericsInOptionalMember", WrapperType = typeof (ProtocolWithGenericsInOptionalMemberWrapper))]
@@ -550,7 +550,7 @@ public void CGPdfPage ()
using var view = new PdfView ();
view.Document = new PdfDocument (NSUrl.FromFilename (pdfPath)!);
using var page = view.CurrentPage!;
- Assert.IsNotNull (page.Page, "Page");
+ Assert.That (page.Page, Is.Not.Null, "Page");
}
#endif
}
diff --git a/tests/linker/link all/LinqExpressionTest.cs b/tests/linker/link all/LinqExpressionTest.cs
index d6ee2f545335..0607cba0d7a7 100644
--- a/tests/linker/link all/LinqExpressionTest.cs
+++ b/tests/linker/link all/LinqExpressionTest.cs
@@ -17,7 +17,7 @@ public void Expression_T_Ctor ()
{
var ctor = typeof (LinqExpressionTest).GetConstructor (Type.EmptyTypes)!;
var expr = Expression.New (ctor, new Expression [0]);
- Assert.NotNull (Expression.Lambda (typeof (Bug14863Delegate), expr, null), "Lambda");
+ Assert.That (Expression.Lambda (typeof (Bug14863Delegate), expr, null), Is.Not.Null, "Lambda");
// note: reflection is used to create an instance of Expression using an internal ctor
// it can be indirectly "preserved" by other code (in Expression) but it can fail in other cases
// ref: https://bugzilla.xamarin.com/show_bug.cgi?id=14863
diff --git a/tests/linker/link all/PreserveTest.cs b/tests/linker/link all/PreserveTest.cs
index 19dee363f3ad..cd019ddd9592 100644
--- a/tests/linker/link all/PreserveTest.cs
+++ b/tests/linker/link all/PreserveTest.cs
@@ -58,8 +58,8 @@ public void PreserveTypeWithMembers ()
{
var t = Type.GetType ("LinkAll.Attributes.TypeWithMembers" + WorkAroundLinkerHeuristics)!;
// both type and members are preserved
- Assert.NotNull (t, "type");
- Assert.NotNull (t.GetProperty ("Present"), "members");
+ Assert.That (t, Is.Not.Null, "type");
+ Assert.That (t.GetProperty ("Present"), Is.Not.Null, "members");
}
[Test]
@@ -67,9 +67,9 @@ public void PreserveTypeWithoutMembers ()
{
var t = Type.GetType ("LinkAll.Attributes.TypeWithoutMembers" + WorkAroundLinkerHeuristics)!;
// type is preserved
- Assert.NotNull (t, "type");
+ Assert.That (t, Is.Not.Null, "type");
// but we did not ask the linker to preserve it's members
- Assert.Null (t.GetProperty ("Absent"), "members");
+ Assert.That (t.GetProperty ("Absent"), Is.Null, "members");
}
[Test]
@@ -78,7 +78,7 @@ public void Runtime_RegisterEntryAssembly ()
TestRuntime.AssertSimulator ("https://github.com/dotnet/macios/issues/10457");
var klass = Type.GetType ("ObjCRuntime.Runtime, " + AssemblyName)!;
- Assert.NotNull (klass, "Runtime");
+ Assert.That (klass, Is.Not.Null, "Runtime");
// RegisterEntryAssembly is only needed for the simulator (not on devices) so it's only preserved for sim builds
var method = klass.GetMethod ("RegisterEntryAssembly", BindingFlags.NonPublic | BindingFlags.Static, null, new [] { typeof (Assembly) }, null);
#if __MACOS__
@@ -94,81 +94,81 @@ public void MonoTouchException_Unconditional ()
{
const string klassName = "ObjCRuntime.ObjCException";
var klass = Type.GetType (klassName + ", " + AssemblyName);
- Assert.NotNull (klass, klassName);
+ Assert.That (klass, Is.Not.Null, klassName);
}
[Test]
public void Class_Unconditional ()
{
var klass = Type.GetType ("ObjCRuntime.Class, " + AssemblyName)!;
- Assert.NotNull (klass, "Class");
+ Assert.That (klass, Is.Not.Null, "Class");
// handle is unconditionally preserved
var field = klass.GetField ("handle", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.NotNull (field, "handle");
+ Assert.That (field, Is.Not.Null, "handle");
}
[Test]
public void Runtime_Unconditional ()
{
var klass = Type.GetType ("ObjCRuntime.Runtime, " + AssemblyName)!;
- Assert.NotNull (klass, "Runtime");
+ Assert.That (klass, Is.Not.Null, "Runtime");
// Initialize and a few other methods are unconditionally preserved
var method = klass.GetMethod ("Initialize", BindingFlags.NonPublic | BindingFlags.Static);
- Assert.NotNull (method, "Initialize");
+ Assert.That (method, Is.Not.Null, "Initialize");
method = klass.GetMethod ("RegisterNSObject", BindingFlags.NonPublic | BindingFlags.Static, null, new Type [] { typeof (NSObject), typeof (IntPtr) }, null);
- Assert.NotNull (method, "RegisterNSObject");
+ Assert.That (method, Is.Not.Null, "RegisterNSObject");
}
[Test]
public void Selector_Unconditional ()
{
var klass = Type.GetType ("ObjCRuntime.Selector, " + AssemblyName)!;
- Assert.NotNull (klass, "Selector");
+ Assert.That (klass, Is.Not.Null, "Selector");
// handle and is unconditionally preserved
var field = klass.GetField ("handle", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.NotNull (field, "handle");
+ Assert.That (field, Is.Not.Null, "handle");
var method = klass.GetMethod ("GetHandle", BindingFlags.Public | BindingFlags.Static);
- Assert.NotNull (method, "GetHandle");
+ Assert.That (method, Is.Not.Null, "GetHandle");
}
[Test]
public void SmartEnumTest ()
{
var consumer = GetType ().Assembly.GetType ("LinkAll.Attributes.SmartConsumer" + WorkAroundLinkerHeuristics)!;
- Assert.NotNull (consumer, "SmartConsumer");
- Assert.NotNull (consumer.GetMethod ("GetSmartEnumValue"), "GetSmartEnumValue");
- Assert.NotNull (consumer.GetMethod ("SetSmartEnumValue"), "SetSmartEnumValue");
+ Assert.That (consumer, Is.Not.Null, "SmartConsumer");
+ Assert.That (consumer.GetMethod ("GetSmartEnumValue"), Is.Not.Null, "GetSmartEnumValue");
+ Assert.That (consumer.GetMethod ("SetSmartEnumValue"), Is.Not.Null, "SetSmartEnumValue");
var smartEnum = GetType ().Assembly.GetType ("LinkAll.Attributes.SmartEnum")!;
- Assert.NotNull (smartEnum, "SmartEnum");
+ Assert.That (smartEnum, Is.Not.Null, "SmartEnum");
var smartExtensions = GetType ().Assembly.GetType ("LinkAll.Attributes.SmartEnumExtensions" + WorkAroundLinkerHeuristics)!;
- Assert.NotNull (smartExtensions, "SmartEnumExtensions");
- Assert.NotNull (smartExtensions.GetMethod ("GetConstant"), "GetConstant");
- Assert.NotNull (smartExtensions.GetMethod ("GetValue"), "GetValue");
+ Assert.That (smartExtensions, Is.Not.Null, "SmartEnumExtensions");
+ Assert.That (smartExtensions.GetMethod ("GetConstant"), Is.Not.Null, "GetConstant");
+ Assert.That (smartExtensions.GetMethod ("GetValue"), Is.Not.Null, "GetValue");
// Unused smart enums and their extensions should be linked away
- Assert.IsNull (typeof (NSObject).Assembly.GetType ("AVFoundation.AVMediaTypes"), "AVMediaTypes");
- Assert.IsNull (typeof (NSObject).Assembly.GetType ("AVFoundation.AVMediaTypesExtensions"), "AVMediaTypesExtensions");
+ Assert.That (typeof (NSObject).Assembly.GetType ("AVFoundation.AVMediaTypes"), Is.Null, "AVMediaTypes");
+ Assert.That (typeof (NSObject).Assembly.GetType ("AVFoundation.AVMediaTypesExtensions"), Is.Null, "AVMediaTypesExtensions");
}
[Test]
public void PreserveAllExcludesNestedTypes ()
{
var parentClass = GetType ().Assembly.GetType ("LinkAll.Attributes.ParentClass" + WorkAroundLinkerHeuristics);
- Assert.NotNull (parentClass, "ParentClass");
+ Assert.That (parentClass, Is.Not.Null, "ParentClass");
var nestedEnum = GetType ().Assembly.GetType ("LinkAll.Attributes.ParentClass.NestedEnum" + WorkAroundLinkerHeuristics);
- Assert.Null (nestedEnum, "NestedEnum");
+ Assert.That (nestedEnum, Is.Null, "NestedEnum");
var nestedStruct = GetType ().Assembly.GetType ("LinkAll.Attributes.ParentClass.NestedStruct" + WorkAroundLinkerHeuristics);
- Assert.Null (nestedStruct, "NestedStruct");
+ Assert.That (nestedStruct, Is.Null, "NestedStruct");
var nestedClass = GetType ().Assembly.GetType ("LinkAll.Attributes.ParentClass.NestedClass" + WorkAroundLinkerHeuristics);
- Assert.Null (nestedClass, "NestedClass");
+ Assert.That (nestedClass, Is.Null, "NestedClass");
}
[Test]
public void PreserveAllKeepsEnumValues ()
{
var enumType = GetType ().Assembly.GetType ("LinkAll.Attributes.MyEnum" + WorkAroundLinkerHeuristics)!;
- Assert.NotNull (enumType, "MyEnum");
- Assert.AreEqual (3, enumType.GetFields (BindingFlags.Public | BindingFlags.Static).Length, "fields");
+ Assert.That (enumType, Is.Not.Null, "MyEnum");
+ Assert.That (enumType.GetFields (BindingFlags.Public | BindingFlags.Static).Length, Is.EqualTo (3), "fields");
AssertHasStaticField ("A", 1);
AssertHasStaticField ("B", 2);
AssertHasStaticField ("C", 4);
@@ -176,8 +176,8 @@ public void PreserveAllKeepsEnumValues ()
void AssertHasStaticField (string name, int value)
{
var field = enumType.GetField (name, BindingFlags.Public | BindingFlags.Static)!;
- Assert.NotNull (field, name);
- Assert.AreEqual (value, (int) field.GetValue (null)!, $"{name} == {value}");
+ Assert.That (field, Is.Not.Null, name);
+ Assert.That ((int) field.GetValue (null)!, Is.EqualTo (value), $"{name} == {value}");
}
}
}
diff --git a/tests/linker/link all/SealerTest.cs b/tests/linker/link all/SealerTest.cs
index 423a88f4be52..152978877278 100644
--- a/tests/linker/link all/SealerTest.cs
+++ b/tests/linker/link all/SealerTest.cs
@@ -45,22 +45,22 @@ public void SetUp ()
public void Sealed ()
{
// this can not be optimized into a sealed type
- Assert.False (typeof (Unsealable).IsSealed, "Unsealed");
+ Assert.That (typeof (Unsealable).IsSealed, Is.False, "Unsealed");
#if DEBUG || __MACOS__
// this is not a sealed type (in the source)
- Assert.False (typeof (Sealable).IsSealed, "Sealable");
- Assert.False (typeof (Base).IsSealed, "Base");
- Assert.False (typeof (Subclass).IsSealed, "Subclass");
- Assert.False (typeof (Interface).IsSealed, "Interface");
+ Assert.That (typeof (Sealable).IsSealed, Is.False, "Sealable");
+ Assert.That (typeof (Base).IsSealed, Is.False, "Base");
+ Assert.That (typeof (Subclass).IsSealed, Is.False, "Subclass");
+ Assert.That (typeof (Interface).IsSealed, Is.False, "Interface");
#else
// Sealable can be optimized / sealed as nothing else is (or can) subclass it
- Assert.True (typeof (Sealable).IsSealed, "Sealable");
+ Assert.That (typeof (Sealable).IsSealed, Is.True, "Sealable");
// Base is subclassed so it can't be sealed
- Assert.False (typeof (Base).IsSealed, "Base");
+ Assert.That (typeof (Base).IsSealed, Is.False, "Base");
// Subclass is not subclassed anymore and can be sealed
- Assert.True (typeof (Subclass).IsSealed, "Subclass");
+ Assert.That (typeof (Subclass).IsSealed, Is.True, "Subclass");
// interface can not be sealed
- Assert.False (typeof (Interface).IsSealed, "Interface");
+ Assert.That (typeof (Interface).IsSealed, Is.False, "Interface");
#endif
}
@@ -73,14 +73,14 @@ public void Final ()
var c = t.GetMethod ("C")!;
#if DEBUG || __MACOS__
// this is not a sealed (C#) method (in the source)
- Assert.False (a.IsFinal, "A");
- Assert.False (b.IsFinal, "B");
- Assert.False (c.IsFinal, "C");
+ Assert.That (a.IsFinal, Is.False, "A");
+ Assert.That (b.IsFinal, Is.False, "B");
+ Assert.That (c.IsFinal, Is.False, "C");
#else
// but it can be optimized / sealed as nothing else is (or can) overrides it
- Assert.True (a.IsFinal, "A");
- Assert.True (b.IsFinal, "B");
- Assert.False (c.IsFinal, "C"); // devirtualized
+ Assert.That (a.IsFinal, Is.True, "A");
+ Assert.That (b.IsFinal, Is.True, "B");
+ Assert.That (c.IsFinal, Is.False, "C"); // devirtualized
#endif
}
@@ -93,16 +93,16 @@ public void Virtual ()
var c = t.GetMethod ("C")!;
#if DEBUG || __MACOS__
// both methods are virtual (both in C# and IL)
- Assert.True (a.IsVirtual, "A");
- Assert.True (b.IsVirtual, "B");
- Assert.True (c.IsVirtual, "C");
+ Assert.That (a.IsVirtual, Is.True, "A");
+ Assert.That (b.IsVirtual, Is.True, "B");
+ Assert.That (c.IsVirtual, Is.True, "C");
#else
// calling A needs dispatch to base type Unsealable
- Assert.True (a.IsVirtual, "A");
+ Assert.That (a.IsVirtual, Is.True, "A");
// B is an override and must remain virtual
- Assert.True (b.IsVirtual, "B");
+ Assert.That (b.IsVirtual, Is.True, "B");
// C has no special requirement and can be de-virtualized
- Assert.False (c.IsVirtual, "C");
+ Assert.That (c.IsVirtual, Is.False, "C");
#endif
}
@@ -112,7 +112,7 @@ public void Interface ()
var t = typeof (Subclass);
var a = t.GetMethod ("A")!;
// A cannot be de-virtualized since Concrete must satisfy Interface thru Base
- Assert.True (a.IsVirtual, "A");
+ Assert.That (a.IsVirtual, Is.True, "A");
}
}
}
diff --git a/tests/linker/link all/SerializationTest.cs b/tests/linker/link all/SerializationTest.cs
index 45e9dfa9b5f6..3c0b9eae60f6 100644
--- a/tests/linker/link all/SerializationTest.cs
+++ b/tests/linker/link all/SerializationTest.cs
@@ -84,7 +84,7 @@ public void UnusedType ()
// the serialization attributes only keeps the method(s) if the type was used
var t = Helper.GetType ("LinkAll.Serialization.Unused");
// since it's not used in the app then it's removed by the linker
- Assert.Null (t, "type");
+ Assert.That (t, Is.Null, "type");
}
[Test]
@@ -93,9 +93,9 @@ public void UsedType ()
// the serialization attributes only keeps the method(s) if the type was used
var t = Helper.GetType ("LinkAll.Serialization.Used");
// since it's used here...
- Assert.NotNull (new Used (), "reference");
+ Assert.That (new Used (), Is.Not.Null, "reference");
// it's not removed by the linker
- Assert.NotNull (t, "type");
+ Assert.That (t, Is.Not.Null, "type");
// and since it's not the 4 decorated methods are also kept (even if uncalled)
Assert.That (t.GetMethods ().Length, Is.EqualTo (4), "4");
}
diff --git a/tests/linker/link all/StructLayoutTest.cs b/tests/linker/link all/StructLayoutTest.cs
index b47621117b5e..e6fc5d2dca2e 100644
--- a/tests/linker/link all/StructLayoutTest.cs
+++ b/tests/linker/link all/StructLayoutTest.cs
@@ -53,9 +53,9 @@ public void DefaultLayoutStruct () // sequential
var fields = t.GetFields ();
Assert.That (fields.Length, Is.EqualTo (2), "Length");
- Assert.False (t.IsAutoLayout, "IsAutoLayout");
- Assert.False (t.IsExplicitLayout, "IsExplicitLayout");
- Assert.True (t.IsLayoutSequential, "IsLayoutSequential");
+ Assert.That (t.IsAutoLayout, Is.False, "IsAutoLayout");
+ Assert.That (t.IsExplicitLayout, Is.False, "IsExplicitLayout");
+ Assert.That (t.IsLayoutSequential, Is.True, "IsLayoutSequential");
}
[Test]
@@ -68,9 +68,9 @@ public void AutoLayoutStruct ()
var fields = t.GetFields ();
Assert.That (fields.Length, Is.EqualTo (2), "Length");
- Assert.True (t.IsAutoLayout, "IsAutoLayout");
- Assert.False (t.IsExplicitLayout, "IsExplicitLayout");
- Assert.False (t.IsLayoutSequential, "IsLayoutSequential");
+ Assert.That (t.IsAutoLayout, Is.True, "IsAutoLayout");
+ Assert.That (t.IsExplicitLayout, Is.False, "IsExplicitLayout");
+ Assert.That (t.IsLayoutSequential, Is.False, "IsLayoutSequential");
}
[Test]
@@ -83,9 +83,9 @@ public void LayoutSequential ()
var fields = t.GetFields ();
Assert.That (fields.Length, Is.EqualTo (2), "Length");
- Assert.False (t.IsAutoLayout, "IsAutoLayout");
- Assert.False (t.IsExplicitLayout, "IsExplicitLayout");
- Assert.True (t.IsLayoutSequential, "IsLayoutSequential");
+ Assert.That (t.IsAutoLayout, Is.False, "IsAutoLayout");
+ Assert.That (t.IsExplicitLayout, Is.False, "IsExplicitLayout");
+ Assert.That (t.IsLayoutSequential, Is.True, "IsLayoutSequential");
}
[Test]
@@ -98,9 +98,9 @@ public void ExplicitLayout ()
var fields = t.GetFields ();
Assert.That (fields.Length, Is.EqualTo (3), "Length");
- Assert.False (t.IsAutoLayout, "IsAutoLayout");
- Assert.True (t.IsExplicitLayout, "IsExplicitLayout");
- Assert.False (t.IsLayoutSequential, "IsLayoutSequential");
+ Assert.That (t.IsAutoLayout, Is.False, "IsAutoLayout");
+ Assert.That (t.IsExplicitLayout, Is.True, "IsExplicitLayout");
+ Assert.That (t.IsLayoutSequential, Is.False, "IsLayoutSequential");
}
}
}
diff --git a/tests/linker/link sdk/AotBugs.cs b/tests/linker/link sdk/AotBugs.cs
index ff7e8209013d..a63cc4205247 100644
--- a/tests/linker/link sdk/AotBugs.cs
+++ b/tests/linker/link sdk/AotBugs.cs
@@ -40,27 +40,27 @@ public partial class AotBugsTest : IAotTest {
public void Aot_3285 ()
{
// called as an extension method (always worked)
- Assert.False (GetType ().GetInterfaces (typeof (IExpectException)).Select (interf => interf is not null).FirstOrDefault (), "false");
+ Assert.That (GetType ().GetInterfaces (typeof (IExpectException)).Select (interf => interf is not null).FirstOrDefault (), Is.False, "false");
// workaround for #3285 - similar to previous fix for monotouch/aot
// called as a static method (does not change the result - but it was closer to the original test case)
- Assert.True (AotExtension.GetInterfaces (GetType (), typeof (IAotTest)).Select (interf => interf is not null).FirstOrDefault (delegate { return true; }), "delegate");
+ Assert.That (AotExtension.GetInterfaces (GetType (), typeof (IAotTest)).Select (interf => interf is not null).FirstOrDefault (delegate { return true; }), Is.True, "delegate");
// actual, failing, test case (fixed by inlining code)
- Assert.True (GetType ().GetInterfaces (typeof (IAotTest)).Select (interf => interf is not null).FirstOrDefault (), "FirstOrDefault/true");
+ Assert.That (GetType ().GetInterfaces (typeof (IAotTest)).Select (interf => interf is not null).FirstOrDefault (), Is.True, "FirstOrDefault/true");
// other similar cases (returning bool with optional predicate delegate)
var enumerable = GetType ().GetInterfaces (typeof (IAotTest)).Select (interf => interf is not null);
- Assert.True (enumerable.Any (), "Any");
- Assert.True (enumerable.ElementAt (0), "ElementAt");
- Assert.True (enumerable.ElementAtOrDefault (0), "ElementAtOrDefault");
- Assert.True (enumerable.First (), "First");
- Assert.True (enumerable.Last (), "Last"); // failed before fix
- Assert.True (enumerable.LastOrDefault (), "LastOrDefault"); // failed before fix
- Assert.True (enumerable.Max (), "Max");
- Assert.True (enumerable.Min (), "Min");
- Assert.True (enumerable.Single (), "Single"); // failed before fix
- Assert.True (enumerable.SingleOrDefault (), "SingleOrDefault"); // failed before fix
+ Assert.That (enumerable.Any (), Is.True, "Any");
+ Assert.That (enumerable.ElementAt (0), Is.True, "ElementAt");
+ Assert.That (enumerable.ElementAtOrDefault (0), Is.True, "ElementAtOrDefault");
+ Assert.That (enumerable.First (), Is.True, "First");
+ Assert.That (enumerable.Last (), Is.True, "Last"); // failed before fix
+ Assert.That (enumerable.LastOrDefault (), Is.True, "LastOrDefault"); // failed before fix
+ Assert.That (enumerable.Max (), Is.True, "Max");
+ Assert.That (enumerable.Min (), Is.True, "Min");
+ Assert.That (enumerable.Single (), Is.True, "Single"); // failed before fix
+ Assert.That (enumerable.SingleOrDefault (), Is.True, "SingleOrDefault"); // failed before fix
}
[Test]
@@ -149,7 +149,7 @@ public void Linq_Join_3627 ()
var query = (from wqual in c
join personTable in p on wqual.FK_PERSON equals personTable.Id
select new CounselingWithPerson (wqual, personTable));
- Assert.NotNull (query.ToList ());
+ Assert.That (query.ToList (), Is.Not.Null);
// above throws ExecutionEngineException
}
@@ -164,7 +164,7 @@ public void Workaround_3627 ()
var query = (from wqual in c
join personTable in p on wqual.FK_PERSON.ToString () equals personTable.Id.ToString ()
select new CounselingWithPerson (wqual, personTable));
- Assert.NotNull (query.ToList ());
+ Assert.That (query.ToList (), Is.Not.Null);
}
public class Foo {
@@ -226,7 +226,7 @@ public void Any_3735 ()
Environment.SpecialFolder.ApplicationData,
Environment.SpecialFolder.CommonApplicationData
};
- Assert.True (array.Any (folder => folder == Environment.SpecialFolder.ApplicationData));
+ Assert.That (array.Any (folder => folder == Environment.SpecialFolder.ApplicationData), Is.True);
// above throws ExecutionEngineException
// Attempting to JIT compile method '(wrapper managed-to-managed) System.Environment/SpecialFolder[]:System.Collections.Generic.IEnumerable`1.GetEnumerator ()' while running with --aot-only.
}
@@ -239,7 +239,7 @@ public void Workaround_3735 ()
List list = new List () {
MidpointRounding.AwayFromZero
};
- Assert.True (list.Any (rounding => rounding == MidpointRounding.AwayFromZero));
+ Assert.That (list.Any (rounding => rounding == MidpointRounding.AwayFromZero), Is.True);
}
Task InnerTestB ()
@@ -289,7 +289,7 @@ join s in Table () on q.SectionId equals s.Id
select q;
// note: orderby causing:
// Attempting to JIT compile method 'System.Linq.OrderedEnumerable`1<<>__AnonType0`2>:CreateOrderedEnumerable (System.Func`2<<>__AnonType0`2, int>,System.Collections.Generic.IComparer`1,bool)' while running with --aot-only.
- Assert.NotNull (result);
+ Assert.That (result, Is.Not.Null);
}
[Test]
@@ -302,7 +302,7 @@ join s in Table () on q.SectionId equals s.Id
where s.BoardId == boardId
orderby q.IsAnswered.ToString (), s.Position.ToString (), q.Position.ToString ()
select q;
- Assert.NotNull (result);
+ Assert.That (result, Is.Not.Null);
}
[Test]
@@ -316,7 +316,7 @@ join s in Table () on q.SectionId equals s.Id
select q;
// query is ok
foreach (var result in results)
- Assert.NotNull (result);
+ Assert.That (result, Is.Not.Null);
}
[Test]
@@ -329,7 +329,7 @@ join s in Table () on q.SectionId.ToString () equals s.Id.ToString ()
where s.BoardId == boardId
select q;
foreach (var result in results)
- Assert.NotNull (result);
+ Assert.That (result, Is.Not.Null);
}
public class VirtualGeneric {
@@ -347,7 +347,7 @@ public virtual ICollection MakeCollectionOfInputs (T input1, T input2, T i
public void Virtual_4114 ()
{
VirtualGeneric g = new VirtualGeneric ();
- Assert.NotNull (g.MakeCollectionOfInputs (1.0, 2.0, 3.0));
+ Assert.That (g.MakeCollectionOfInputs (1.0, 2.0, 3.0), Is.Not.Null);
}
public class OverrideGeneric : VirtualGeneric {
@@ -469,7 +469,7 @@ public void Bug12811a ()
{
int n = 1;
foreach (var e in GetStringList ()) {
- Assert.NotNull (e, n.ToString ());
+ Assert.That (e, Is.Not.Null, n.ToString ());
n++;
}
}
@@ -479,7 +479,7 @@ public void Bug12811b ()
{
int n = 1;
foreach (var e in Enum.GetValues (typeof (NSFileManagerItemReplacementOptions)).Cast ().Select (x => x.ToString ())) {
- Assert.NotNull (e, n.ToString ());
+ Assert.That (e, Is.Not.Null, n.ToString ());
n++;
}
}
@@ -530,10 +530,10 @@ public enum MyEnum8ElementsInUInt16 : ushort {
[Test]
public void Bug12605 ()
{
- Assert.AreEqual ("One", Convert.ToString ((MyEnum8ElementsInInt32) 1), "1");
- Assert.AreEqual ("One", Convert.ToString ((MyEnum8ElementsInUInt32) 1), "2");
- Assert.AreEqual ("One", Convert.ToString ((MyEnum7ElementsInUInt16) 1), "3");
- Assert.AreEqual ("One", Convert.ToString ((MyEnum8ElementsInUInt16) 1), "4");
+ Assert.That (Convert.ToString ((MyEnum8ElementsInInt32) 1), Is.EqualTo ("One"), "1");
+ Assert.That (Convert.ToString ((MyEnum8ElementsInUInt32) 1), Is.EqualTo ("One"), "2");
+ Assert.That (Convert.ToString ((MyEnum7ElementsInUInt16) 1), Is.EqualTo ("One"), "3");
+ Assert.That (Convert.ToString ((MyEnum8ElementsInUInt16) 1), Is.EqualTo ("One"), "4");
}
[Test]
@@ -560,7 +560,7 @@ public void Bug12895 ()
(?:[Ee][+-]?[0-9]+)? # Optional exponent
(?![A-Za-z0-9_]) # Must not be followed by an alphanumeric character
)", System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace);
- Assert.NotNull (r); // looking got EEE while executing, on devices, the above code
+ Assert.That (r, Is.Not.Null); // looking got EEE while executing, on devices, the above code
}
[Test]
diff --git a/tests/linker/link sdk/BitcodeTest.cs b/tests/linker/link sdk/BitcodeTest.cs
index af8a7f520985..4255bcf9d742 100644
--- a/tests/linker/link sdk/BitcodeTest.cs
+++ b/tests/linker/link sdk/BitcodeTest.cs
@@ -9,8 +9,8 @@ public void FilterClauseTest ()
{
var supported = true;
if (supported) {
- Assert.AreEqual (0, FilterClause (), "Filter me");
- Assert.AreEqual (10, FilterClauseProperty, "Filter me getter");
+ Assert.That (FilterClause (), Is.EqualTo (0), "Filter me");
+ Assert.That (FilterClauseProperty, Is.EqualTo (10), "Filter me getter");
Assert.DoesNotThrow (() => FilterClauseProperty = 20, "Filter me setter");
} else {
Assert.Throws (() => FilterClause (), "Filter me not supported");
@@ -47,7 +47,7 @@ static int FilterClauseProperty {
throw new Exception ("FilterMe");
} catch (Exception e) when (e.Message == "FilterMe") {
} catch {
- Assert.Fail ("Filter failure: {0}", value);
+ Assert.Fail ($"Filter failure: {value}");
}
}
}
@@ -68,12 +68,12 @@ public void FaultClauseTest ()
var body = method.GetMethodBody ();
if (body is null)
throw new InvalidOperationException ("MoveNext body");
- Assert.IsTrue (body.ExceptionHandlingClauses.Any ((v) => v.Flags == ExceptionHandlingClauseOptions.Fault), "Any fault clauses");
+ Assert.That (body.ExceptionHandlingClauses.Any ((v) => v.Flags == ExceptionHandlingClauseOptions.Fault), Is.True, "Any fault clauses");
// Then assert that the method can be called successfully.
var rv = FaultClause ().ToArray ();
- Assert.AreEqual (1, rv.Count (), "Count");
- Assert.AreEqual (1, rv [0], "Item 1");
+ Assert.That (rv.Count (), Is.EqualTo (1), "Count");
+ Assert.That (rv [0], Is.EqualTo (1), "Item 1");
}
diff --git a/tests/linker/link sdk/CryptoTest.cs b/tests/linker/link sdk/CryptoTest.cs
index 277b85f21b8c..866aee26ff81 100644
--- a/tests/linker/link sdk/CryptoTest.cs
+++ b/tests/linker/link sdk/CryptoTest.cs
@@ -27,7 +27,7 @@ public void AesCreate ()
// Aes resides in mscorlib.dll but needs to create instance of types that are
// located inside System.Core.dll - IOW the linker needs to be aware of this
Aes aes = Aes.Create ();
- Assert.NotNull (aes, "Aes");
+ Assert.That (aes, Is.Not.Null, "Aes");
const string prefix = "System.Security.Cryptography, ";
Assert.That (aes.GetType ().Assembly.FullName, Does.StartWith (prefix), prefix);
}
@@ -47,12 +47,12 @@ public void TrustUsingNewCallback ()
return false;
Assert.That (errors, Is.EqualTo (SslPolicyErrors.None), "certificateProblem");
X509Certificate2 c2 = X509CertificateLoader.LoadCertificate (cert.GetRawCertData ());
- Assert.True (chain.Build (c2), "Build");
+ Assert.That (chain.Build (c2), Is.True, "Build");
trust_validation_callback++;
return true;
};
WebClient wc = new WebClient ();
- Assert.IsNotNull (wc.DownloadString (NetworkResources.XamarinUrl));
+ Assert.That (wc.DownloadString (NetworkResources.XamarinUrl), Is.Not.Null);
// caching means it will be called at least for the first run, but it might not
// be called again in subsequent requests (unless it expires)
Assert.That (trust_validation_callback, Is.GreaterThan (0), "validation done");
@@ -101,13 +101,13 @@ public void TLS1_ServerNameExtension ()
return false;
Assert.That (errors, Is.EqualTo (SslPolicyErrors.None), "certificateProblem");
X509Certificate2 c2 = X509CertificateLoader.LoadCertificate (cert.GetRawCertData ());
- Assert.True (chain.Build (c2), "Build");
+ Assert.That (chain.Build (c2), Is.True, "Build");
sne_validation_callback++;
return true;
};
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
WebClient wc = new WebClient ();
- Assert.IsNotNull (wc.DownloadString (NetworkResources.StatsUrl));
+ Assert.That (wc.DownloadString (NetworkResources.StatsUrl), Is.Not.Null);
} catch (WebException we) {
// failing to get data does not mean the SSL/TLS session was not established
if (sne_validation_callback == 0) {
@@ -137,16 +137,16 @@ public void Chain ()
chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust;
chain.ChainPolicy.CustomTrustStore.Add (rootCert);
- Assert.False (chain.Build (cert), "Online");
- Assert.True (chain.ChainStatus.Any (s => s.Status.HasFlag (X509ChainStatusFlags.RevocationStatusUnknown)), "Online");
+ Assert.That (chain.Build (cert), Is.False, "Online");
+ Assert.That (chain.ChainStatus.Any (s => s.Status.HasFlag (X509ChainStatusFlags.RevocationStatusUnknown)), Is.True, "Online");
chain.ChainPolicy.RevocationMode = X509RevocationMode.Offline;
- Assert.False (chain.Build (cert), "Offline");
- Assert.True (chain.ChainStatus.Any (s => s.Status.HasFlag (X509ChainStatusFlags.RevocationStatusUnknown)), "Offline");
+ Assert.That (chain.Build (cert), Is.False, "Offline");
+ Assert.That (chain.ChainStatus.Any (s => s.Status.HasFlag (X509ChainStatusFlags.RevocationStatusUnknown)), Is.True, "Offline");
chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;
- Assert.True (chain.Build (cert), "NoCheck");
- Assert.AreEqual (0, chain.ChainStatus.Length, "NoCheck");
+ Assert.That (chain.Build (cert), Is.True, "NoCheck");
+ Assert.That (chain.ChainStatus.Length, Is.EqualTo (0), "NoCheck");
}
byte [] sha256_data = {
@@ -209,7 +209,7 @@ public void Sha256 ()
{
X509Certificate2 c = X509CertificateLoader.LoadCertificate (sha256_data);
// can't build is fine - as long as we do not throw
- Assert.False (new X509Chain (false).Build (c), "Build");
+ Assert.That (new X509Chain (false).Build (c), Is.False, "Build");
}
}
}
diff --git a/tests/linker/link sdk/DllImportTest.cs b/tests/linker/link sdk/DllImportTest.cs
index 1c014a4fe788..eafc04fbeec8 100644
--- a/tests/linker/link sdk/DllImportTest.cs
+++ b/tests/linker/link sdk/DllImportTest.cs
@@ -34,7 +34,7 @@ public class NestedSecondLevel {
public void ScanForStrip_17327 ()
{
// note: must be tested on a release (strip'ed) build
- Assert.NotNull (NestedFirstLevel.NestedSecondLevel.xamarin_get_locale_country_code ());
+ Assert.That (NestedFirstLevel.NestedSecondLevel.xamarin_get_locale_country_code (), Is.Not.Null);
}
[Test]
@@ -89,7 +89,7 @@ public void PingSend ()
};
var timeout = TimeSpan.FromSeconds (10);
var tasks = hosts.Select (host => (new Ping ()).SendPingAsync (host, timeout)).ToArray ();
- Assert.IsTrue (Task.WaitAll (tasks, timeout.Add (TimeSpan.FromSeconds (10))), "One or more of the ping requests timed out.");
+ Assert.That (Task.WaitAll (tasks, timeout.Add (TimeSpan.FromSeconds (10))), Is.True, "One or more of the ping requests timed out.");
var results = tasks.Select (task => task.Result.Status).ToArray ();
Assert.That (results, Has.Some.EqualTo (IPStatus.Success), "Pong any host");
}
diff --git a/tests/linker/link sdk/HttpClientHandlerTest.cs b/tests/linker/link sdk/HttpClientHandlerTest.cs
index 321bc565397f..fd9d6d3bda85 100644
--- a/tests/linker/link sdk/HttpClientHandlerTest.cs
+++ b/tests/linker/link sdk/HttpClientHandlerTest.cs
@@ -15,20 +15,20 @@ public class HttpClientHandlerTest {
public void HttpClient ()
{
using (var handler = new HttpClientHandler ()) {
- Assert.True (handler.AllowAutoRedirect, "AllowAutoRedirect");
- Assert.NotNull (handler.CookieContainer, "CookieContainer");
- Assert.Null (handler.Credentials, "Credentials");
+ Assert.That (handler.AllowAutoRedirect, Is.True, "AllowAutoRedirect");
+ Assert.That (handler.CookieContainer, Is.Not.Null, "CookieContainer");
+ Assert.That (handler.Credentials, Is.Null, "Credentials");
// (so far) not exposed in other, native handlers
Assert.That (handler.AutomaticDecompression, Is.EqualTo (DecompressionMethods.None), "AutomaticDecompression");
Assert.That (handler.ClientCertificateOptions, Is.EqualTo (ClientCertificateOption.Manual), "ClientCertificateOptions");
Assert.That (handler.MaxAutomaticRedirections, Is.EqualTo (50), "MaxAutomaticRedirections");
- Assert.Null (handler.Proxy, "Proxy");
- Assert.True (handler.SupportsAutomaticDecompression, "SupportsAutomaticDecompression");
- Assert.True (handler.SupportsProxy, "SupportsProxy");
- Assert.True (handler.SupportsRedirectConfiguration, "SupportsRedirectConfiguration");
- Assert.True (handler.UseCookies, "UseCookies");
- Assert.False (handler.UseDefaultCredentials, "UseDefaultCredentials");
- Assert.True (handler.UseProxy, "UseProxy");
+ Assert.That (handler.Proxy, Is.Null, "Proxy");
+ Assert.That (handler.SupportsAutomaticDecompression, Is.True, "SupportsAutomaticDecompression");
+ Assert.That (handler.SupportsProxy, Is.True, "SupportsProxy");
+ Assert.That (handler.SupportsRedirectConfiguration, Is.True, "SupportsRedirectConfiguration");
+ Assert.That (handler.UseCookies, Is.True, "UseCookies");
+ Assert.That (handler.UseDefaultCredentials, Is.False, "UseDefaultCredentials");
+ Assert.That (handler.UseProxy, Is.True, "UseProxy");
}
}
@@ -36,10 +36,10 @@ public void HttpClient ()
public void CFNetwork ()
{
using (var handler = new CFNetworkHandler ()) {
- Assert.True (handler.AllowAutoRedirect, "AllowAutoRedirect");
- Assert.NotNull (handler.CookieContainer, "CookieContainer");
+ Assert.That (handler.AllowAutoRedirect, Is.True, "AllowAutoRedirect");
+ Assert.That (handler.CookieContainer, Is.Not.Null, "CookieContainer");
// custom, not in HttpClientHandler
- Assert.False (handler.UseSystemProxy, "UseSystemProxy");
+ Assert.That (handler.UseSystemProxy, Is.False, "UseSystemProxy");
}
}
@@ -47,10 +47,10 @@ public void CFNetwork ()
public void NSUrlSession ()
{
using (var handler = new NSUrlSessionHandler ()) {
- Assert.True (handler.AllowAutoRedirect, "AllowAutoRedirect");
- Assert.Null (handler.Credentials, "Credentials");
+ Assert.That (handler.AllowAutoRedirect, Is.True, "AllowAutoRedirect");
+ Assert.That (handler.Credentials, Is.Null, "Credentials");
// custom, not in HttpClientHandler
- Assert.False (handler.DisableCaching, "DisableCaching");
+ Assert.That (handler.DisableCaching, Is.False, "DisableCaching");
}
}
}
diff --git a/tests/linker/link sdk/LinkExtraDefsTest.cs b/tests/linker/link sdk/LinkExtraDefsTest.cs
index 4b30648f3e51..85a510fb9417 100644
--- a/tests/linker/link sdk/LinkExtraDefsTest.cs
+++ b/tests/linker/link sdk/LinkExtraDefsTest.cs
@@ -27,7 +27,7 @@ public class LinkExtraDefsTest {
public void Corlib ()
{
var t = Type.GetType ("System.Security.PermissionSet, " + typeof (int).Assembly.GetName ().Name);
- Assert.NotNull (t, "System.Security.PermissionSet");
+ Assert.That (t, Is.Not.Null, "System.Security.PermissionSet");
if (t is null)
throw new InvalidOperationException ("System.Security.PermissionSet");
}
@@ -36,11 +36,11 @@ public void Corlib ()
public void System ()
{
var t = Type.GetType ("System.Net.Mime.ContentType, System.Net.Mail");
- Assert.NotNull (t, "System.Net.Mime.ContentType");
+ Assert.That (t, Is.Not.Null, "System.Net.Mime.ContentType");
if (t is null)
throw new InvalidOperationException ("System.Net.Mime.ContentType");
// we asked for ParseValue to be preserved
- Assert.NotNull (t.GetMethod ("ParseValue", BindingFlags.Instance | BindingFlags.NonPublic), "Parse");
+ Assert.That (t.GetMethod ("ParseValue", BindingFlags.Instance | BindingFlags.NonPublic), Is.Not.Null, "Parse");
}
#if !__MACOS__
@@ -48,7 +48,7 @@ public void System ()
public void MonoTouch ()
{
var t = Type.GetType ("CoreBluetooth.CBUUID, " + typeof (NSObject).Assembly.ToString ());
- Assert.NotNull (t, "[MonoTouch.]CoreBluetooth.CBUUID");
+ Assert.That (t, Is.Not.Null, "[MonoTouch.]CoreBluetooth.CBUUID");
if (t is null)
throw new InvalidOperationException ("CoreBluetooth.CBUUID");
// check (generated) fields since we instructed the linker to keep them
diff --git a/tests/linker/link sdk/LinkSdkRegressionTest.cs b/tests/linker/link sdk/LinkSdkRegressionTest.cs
index b1bc9b1c2e1b..4d189bfe9b7a 100644
--- a/tests/linker/link sdk/LinkSdkRegressionTest.cs
+++ b/tests/linker/link sdk/LinkSdkRegressionTest.cs
@@ -69,7 +69,7 @@ public void Bug205_ExposingIEnumerable ()
public void Bug234_Interlocked ()
{
string? str = null;
- Assert.Null (Interlocked.Exchange (ref str, "one"), "Exchange");
+ Assert.That (Interlocked.Exchange (ref str, "one"), Is.Null, "Exchange");
// the above should not crash with System.ExecutionEngineException
Assert.That (str, Is.EqualTo ("one"), "one");
}
@@ -82,7 +82,7 @@ public void Bug300_Linker_PredicateOf ()
Dictionary queued = new Dictionary ();
KeyValuePair valuePair = queued.FirstOrDefault ();
// above should not crash with System.ExecutionEngineException
- Assert.NotNull (valuePair);
+ Assert.That (valuePair, Is.Not.Null);
}
[Test]
@@ -103,7 +103,7 @@ public void Bug769_UnregistredDelegate ()
var tmp = Class.ThrowOnInitFailure;
Class.ThrowOnInitFailure = false;
try {
- Assert.NotNull (new MKMapViewDelegate ());
+ Assert.That (new MKMapViewDelegate (), Is.Not.Null);
// the above should not throw an Exception
} finally {
Class.ThrowOnInitFailure = tmp;
@@ -120,12 +120,12 @@ public void Bug865_CanOpenUrl ()
Assert.Ignore ("NSUrl was fixed with Xcode 15.0");
#pragma warning disable CS8625 // Intentional null test case
- Assert.False (UIApplication.SharedApplication.CanOpenUrl (null), "null");
+ Assert.That (UIApplication.SharedApplication.CanOpenUrl (null), Is.False, "null");
#pragma warning restore CS8625
// the above should not throw an ArgumentNullException
// and that's important because NSUrl.FromString and NSUrl.ctor(string) differs
const string bad_tel = "tel://1800 023 009";
- Assert.Null (NSUrl.FromString (bad_tel), "bad url");
+ Assert.That (NSUrl.FromString (bad_tel), Is.Null, "bad url");
// we now throw if `init*` fails
Assert.Throws (() => new NSUrl (bad_tel), "ctor, bad url");
}
@@ -150,9 +150,9 @@ public void Bug980_AddressBook_NRE ()
using (ABPeoplePickerNavigationController picker = new ABPeoplePickerNavigationController ()) {
// no NRE should occur
if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0))
- Assert.Null (picker.AddressBook);
+ Assert.That (picker.AddressBook, Is.Null);
else
- Assert.NotNull (picker.AddressBook);
+ Assert.That (picker.AddressBook, Is.Not.Null);
}
}
@@ -168,7 +168,7 @@ public void AddressBook_Constants ()
}
#endif // !__MACOS__
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false); // The AddressBook framework was introduced in Mac Catalyst 14.0
- Assert.IsNotNull (ABPersonAddressKey.City, "ABPersonAddressKey");
+ Assert.That (ABPersonAddressKey.City, Is.Not.Null, "ABPersonAddressKey");
}
#endif // HAS_ADDRESSBOOKUI
@@ -178,7 +178,7 @@ public void AddressBook_Constants ()
public void Bug1387_UIEdgeInsets_ToString ()
{
var insets = new UIEdgeInsets (1, 2, 3, 4);
- Assert.False (insets.ToString ().Contains ("UIEdgeInsets"));
+ Assert.That (insets.ToString ().Contains ("UIEdgeInsets"), Is.False);
}
#endif // !__MACOS__
@@ -193,8 +193,8 @@ void CheckExceptionDetailProperty (PropertyInfo pi)
}
// to be valid both getter and setter must be present if [DataMember]
if (data_member) {
- Assert.NotNull (pi.GetGetMethod (true), "get_" + pi.Name);
- Assert.NotNull (pi.GetSetMethod (true), "set_" + pi.Name);
+ Assert.That (pi.GetGetMethod (true), Is.Not.Null, "get_" + pi.Name);
+ Assert.That (pi.GetSetMethod (true), Is.Not.Null, "set_" + pi.Name);
} else {
// check well-known [DataMember]
switch (pi.Name) {
@@ -203,7 +203,7 @@ void CheckExceptionDetailProperty (PropertyInfo pi)
case "Message":
case "StackTrace":
case "Type":
- Assert.Fail ("{0} is missing it's [DataMember] attribute", pi.Name);
+ Assert.Fail ($"{pi.Name} is missing it's [DataMember] attribute");
break;
}
}
@@ -242,7 +242,7 @@ public void Bug1790_TimeZoneInfo_Local ()
// the simulator has complete file access but the device won't have - i.e. we can't depend on it
var hasFileAccess = TestRuntime.IsSimulatorOrDesktop;
Assert.That (File.Exists ("/etc/localtime"), Is.EqualTo (hasFileAccess), "/etc/localtime");
- Assert.NotNull (TimeZoneInfo.Local, "Local");
+ Assert.That (TimeZoneInfo.Local, Is.Not.Null, "Local");
// should not throw a TimeZoneNotFoundException on devices
}
@@ -295,7 +295,7 @@ public void Bug2000_NSPersistentStoreCoordinator ()
NSError error;
var c = new NSPersistentStoreCoordinator (model);
c.AddPersistentStore (NSPersistentStoreCoordinator.SQLiteStoreType, null, url, null, out error);
- Assert.IsNull (error, "error");
+ Assert.That (error, Is.Null, "error");
} finally {
File.Delete (sqlitePath);
}
@@ -459,7 +459,7 @@ public static HardwareVersion Version {
// could not be duplicated on iPad2 (rolf), iPad1 (spouliot), iPodTouch4 (spouliot)
public void Hardware_SO ()
{
- Assert.NotNull (DeviceHardware.Version, "Hardware");
+ Assert.That (DeviceHardware.Version, Is.Not.Null, "Hardware");
}
public class Location { }
@@ -478,7 +478,7 @@ public static Location getInstance ()
public void Synchronized_3904 ()
{
// crash with LLVM
- Assert.NotNull (getInstance (), "Location");
+ Assert.That (getInstance (), Is.Not.Null, "Location");
}
[Test]
@@ -492,7 +492,7 @@ public void ConvertToDouble_4620 ()
[Test]
public void NetworkInterface_4631 ()
{
- Assert.NotNull (NetworkInterface.GetAllNetworkInterfaces ());
+ Assert.That (NetworkInterface.GetAllNetworkInterfaces (), Is.Not.Null);
}
[Test]
@@ -504,7 +504,7 @@ public void WebClient_SSL_Leak ()
try {
// note: needs to be executed under Instrument to verify it does not leak
string s = wc.DownloadString (url);
- Assert.NotNull (s);
+ Assert.That (s, Is.Not.Null);
return; // one url succeeded, that's enough
} catch (Exception e) {
var msg = $"Url '{url}' failed: {e.ToString ()}";
@@ -520,7 +520,7 @@ public void WebClient_SSL_Leak ()
public void WebProxy_Leak ()
{
// note: needs to be executed under Instrument to verify it does not leak
- Assert.NotNull (global::CoreFoundation.CFNetwork.GetSystemProxySettings (), "should not leak");
+ Assert.That (global::CoreFoundation.CFNetwork.GetSystemProxySettings (), Is.Not.Null, "should not leak");
}
#endif // !__TVOS__ && !__MACOS__
@@ -552,7 +552,7 @@ public void ForeignKey_650402 ()
public void Pointer_5200 ()
{
// ensure the linker did not remove the type, which is used by the runtime
- Assert.NotNull (GetTypeHelper ("System.Reflection.Pointer, " + typeof (int).Assembly.GetName ().Name));
+ Assert.That (GetTypeHelper ("System.Reflection.Pointer, " + typeof (int).Assembly.GetName ().Name), Is.Not.Null);
}
[Test]
@@ -599,13 +599,13 @@ public void ObjectHandleCtor ()
var typeName = o.FullName;
if (string.IsNullOrEmpty (assemblyName) || string.IsNullOrEmpty (typeName))
throw new InvalidOperationException ("Unable to create an ObjectHandle.");
- Assert.NotNull (Activator.CreateInstance (assemblyName, typeName), "ObjectHandle");
+ Assert.That (Activator.CreateInstance (assemblyName, typeName), Is.Not.Null, "ObjectHandle");
}
[Test]
public void AttributeUsageAttribute_Persistance ()
{
- Assert.IsFalse (Attribute.IsDefined (GetType (), typeof (SerializableAttribute)));
+ Assert.That (Attribute.IsDefined (GetType (), typeof (SerializableAttribute)), Is.False);
}
[Test]
@@ -644,7 +644,7 @@ public void AotGcMemmove_Crash_17284 ()
{
var arr = new AnEnum [16];
var c = new ReadOnlyCollection (arr);
- Assert.False (c.Contains (AnEnum.First));
+ Assert.That (c.Contains (AnEnum.First), Is.False);
}
enum MyEnum {
@@ -657,7 +657,7 @@ public void Aot_Gsharedvt_21893 ()
{
IList _myValues = new List { MyEnum.AValue };
bool pleaseDontCrash = _myValues.Contains (MyEnum.AnotherValue);
- Assert.False (pleaseDontCrash);
+ Assert.That (pleaseDontCrash, Is.False);
}
[Test]
@@ -689,9 +689,9 @@ string TestFolder (Environment.SpecialFolder folder, bool supported = true, bool
string file = Path.Combine (path, "temp.txt");
try {
File.WriteAllText (file, "mine");
- Assert.False (readOnly, "!readOnly " + folder);
+ Assert.That (readOnly, Is.False, "!readOnly " + folder);
} catch {
- Assert.True (readOnly, "readOnly " + folder);
+ Assert.That (readOnly, Is.True, "readOnly " + folder);
} finally {
File.Delete (file);
}
@@ -895,7 +895,7 @@ void SpecialFolderImpl ()
path = TestFolder (Environment.SpecialFolder.Resources, supported: false);
#else
path = TestFolder (Environment.SpecialFolder.Resources, readOnly: tvos && device);
- Assert.True (path.EndsWith ("/Library", StringComparison.Ordinal), "Resources");
+ Assert.That (path.EndsWith ("/Library", StringComparison.Ordinal), Is.True, "Resources");
#endif
}
@@ -904,29 +904,29 @@ void SpecialFolderImpl ()
public void Events ()
{
using (var tv = new UITextView ()) {
- Assert.Null (tv.WeakDelegate, "none");
+ Assert.That (tv.WeakDelegate, Is.Null, "none");
// event on UITextView itself
tv.Ended += (object? sender, EventArgs e) => { };
var weakDelegate = tv.WeakDelegate;
- Assert.NotNull (weakDelegate, "textview delegate");
+ Assert.That (weakDelegate, Is.Not.Null, "textview delegate");
if (weakDelegate is null)
throw new InvalidOperationException ("The text view delegate was not created.");
var t = weakDelegate.GetType ();
Assert.That (t.Name, Is.EqualTo ("_UITextViewDelegate"), "textview");
var fi = t.GetField ("editingEnded", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.NotNull (fi, "editingEnded");
+ Assert.That (fi, Is.Not.Null, "editingEnded");
if (fi is null)
throw new InvalidOperationException ("The editingEnded field was not found.");
var value = fi.GetValue (weakDelegate);
- Assert.NotNull (value, "value");
+ Assert.That (value, Is.Not.Null, "value");
// and on the UIScrollView defined one
tv.Scrolled += (object? sender, EventArgs e) => { };
// and the existing (initial field) is still set
fi = t.GetField ("editingEnded", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.NotNull (fi, "editingEnded/scrollview");
+ Assert.That (fi, Is.Not.Null, "editingEnded/scrollview");
if (fi is null)
throw new InvalidOperationException ("The editingEnded field was not found after scroll hookup.");
}
@@ -998,14 +998,14 @@ public void EnsureDelegateAssignIsNotOverwritingInternalDelegate ()
[Test]
public void MonoRuntime34671 ()
{
- Assert.Null (GetTypeHelper ("Mono.Runtime"), "Mono.Runtime");
+ Assert.That (GetTypeHelper ("Mono.Runtime"), Is.Null, "Mono.Runtime");
}
[Test]
public void TraceListeners36255 ()
{
Trace.Close (); // here too
- Assert.NotNull (Trace.Listeners, "C6 had a SecurityPermission call");
+ Assert.That (Trace.Listeners, Is.Not.Null, "C6 had a SecurityPermission call");
}
#if !__MACOS__
@@ -1022,10 +1022,10 @@ public void Github5024 ()
throw new InvalidOperationException ("No assembly qualified name for UISearchController.");
var n = a.Replace ("UIKit.UISearchController", "UIKit.UISearchController+__Xamarin_UISearchResultsUpdating");
var t = Type.GetType (n);
- Assert.NotNull (t, "private inner type");
+ Assert.That (t, Is.Not.Null, "private inner type");
if (t is null)
throw new InvalidOperationException ("The private inner type was not found.");
- Assert.IsNotNull (t.GetMethod ("UpdateSearchResultsForSearchController"), "preserved");
+ Assert.That (t.GetMethod ("UpdateSearchResultsForSearchController"), Is.Not.Null, "preserved");
}
}
#endif // !__MACOS__
@@ -1035,7 +1035,7 @@ public void OldTlsProvider_LinkedOut ()
{
// make test work for classic (monotouch) and unified (iOS, tvOS)
var fqn = GetReplacedNSObjectAssemblyQualifiedName ("Security.Tls.OldTlsProvider");
- Assert.Null (GetTypeHelper (fqn), "Should not be included");
+ Assert.That (GetTypeHelper (fqn), Is.Null, "Should not be included");
}
[Test]
@@ -1043,7 +1043,7 @@ public void AppleTls_Default ()
{
// make test work for classic (monotouch) and unified (iOS, tvOS)
var fqn = GetReplacedNSObjectAssemblyQualifiedName ("Security.Tls.AppleTlsProvider");
- Assert.Null (GetTypeHelper (fqn), "Should be included");
+ Assert.That (GetTypeHelper (fqn), Is.Null, "Should be included");
}
#if !__TVOS__ // WebKit isn't available in tvOS
@@ -1053,9 +1053,9 @@ public void WebKit_NSProxy ()
{
// a reference to WKWebView will bring the internal NSProxy type
var t = typeof (WKWebView);
- Assert.NotNull (t, "avoid compiler optimization of unused variable");
+ Assert.That (t, Is.Not.Null, "avoid compiler optimization of unused variable");
var fqn = GetReplacedNSObjectAssemblyQualifiedName ("Foundation.NSProxy");
- Assert.NotNull (GetTypeHelper (fqn), fqn);
+ Assert.That (GetTypeHelper (fqn), Is.Not.Null, fqn);
}
#endif // !__TVOS__
@@ -1085,7 +1085,7 @@ public void PreserveINativeObject ()
// linker will keep the MTAudioProcessingTap type
var mta = typeof (MediaToolbox.MTAudioProcessingTap);
// and we check that it still implement INativeObject
- Assert.IsNotNull (mta.GetInterface ("ObjCRuntime.INativeObject"), "INativeObject");
+ Assert.That (mta.GetInterface ("ObjCRuntime.INativeObject"), Is.Not.Null, "INativeObject");
}
[Test]
@@ -1093,7 +1093,7 @@ public void PreserveINativeObject ()
public void AsQueryable_Enumerable ()
{
var list = new List { "hello hello" };
- Assert.NotNull (list.AsQueryable ().GroupBy (x => x).FirstOrDefault ()?.FirstOrDefault (), "Enumerable");
+ Assert.That (list.AsQueryable ().GroupBy (x => x).FirstOrDefault ()?.FirstOrDefault (), Is.Not.Null, "Enumerable");
}
public class CustomIdentity : IIdentity {
@@ -1113,7 +1113,7 @@ public void Principal ()
{
Thread.CurrentPrincipal = new CustomPrincipal ();
var identity = Thread.CurrentPrincipal?.Identity;
- Assert.NotNull (identity, "Identity");
+ Assert.That (identity, Is.Not.Null, "Identity");
if (identity is null)
throw new InvalidOperationException ("No current principal identity.");
Assert.That (identity.Name, Is.EqualTo ("abc"), "Name");
diff --git a/tests/linker/link sdk/LinkSdkTest.cs b/tests/linker/link sdk/LinkSdkTest.cs
index 2e8b677c6020..ccbc184106bd 100644
--- a/tests/linker/link sdk/LinkSdkTest.cs
+++ b/tests/linker/link sdk/LinkSdkTest.cs
@@ -7,7 +7,7 @@ static void Check (string calendarName, bool present)
{
var type = Type.GetType ("System.Globalization." + calendarName);
bool success = present == (type is not null);
- Assert.AreEqual (present, type is not null, calendarName);
+ Assert.That (type is not null, Is.EqualTo (present), calendarName);
}
[Test]
diff --git a/tests/linker/link sdk/LocaleTest.cs b/tests/linker/link sdk/LocaleTest.cs
index 12da2a4731ab..1e7f965a9923 100644
--- a/tests/linker/link sdk/LocaleTest.cs
+++ b/tests/linker/link sdk/LocaleTest.cs
@@ -33,13 +33,13 @@ void DictComparer ()
var n1 = "SEARCHFIELDS";
var n2 = "Searchfields";
- Assert.True (string.Equals (n1, n2, StringComparison.OrdinalIgnoreCase), "string equality");
+ Assert.That (string.Equals (n1, n2, StringComparison.OrdinalIgnoreCase), Is.True, "string equality");
var dict = new Dictionary (StringComparer.OrdinalIgnoreCase);
dict [n1] = "test";
string? result;
- Assert.True (dict.TryGetValue (n2, out result), "dictionary value");
+ Assert.That (dict.TryGetValue (n2, out result), Is.True, "dictionary value");
}
}
}
diff --git a/tests/linker/link sdk/OptimizeGeneratedCodeTest.cs b/tests/linker/link sdk/OptimizeGeneratedCodeTest.cs
index 26b0b49ae8fa..37516ce8638f 100644
--- a/tests/linker/link sdk/OptimizeGeneratedCodeTest.cs
+++ b/tests/linker/link sdk/OptimizeGeneratedCodeTest.cs
@@ -66,7 +66,7 @@ public class OptimizeGeneratedCodeTest : BaseOptimizeGeneratedCodeTest {
public void IsNewRefcountEnabled ()
{
using (UIWebView wv = new UIWebView ()) {
- Assert.Null (wv.Request, "IsNewRefcountEnabled");
+ Assert.That (wv.Request, Is.Null, "IsNewRefcountEnabled");
}
}
@@ -92,7 +92,7 @@ public void SingleRuntimeArchDevice ()
using (UIView v = new UIView ())
using (UIFont font = UIFont.SystemFontOfSize (12f)!) {
var size = "MonoTouch".StringSize (font);
- Assert.False (size.IsEmpty, "!Empty");
+ Assert.That (size.IsEmpty, Is.False, "!Empty");
}
}
#endif // !__TVOS__
@@ -107,7 +107,7 @@ public void DoubleRuntimeArchDevice ()
{
var empty = CGSize.Empty;
using (UIView v = new UIView ()) {
- Assert.True (v.SizeThatFits (empty).IsEmpty, "Empty");
+ Assert.That (v.SizeThatFits (empty).IsEmpty, Is.True, "Empty");
}
}
#endif // !__MACOS__
@@ -152,7 +152,7 @@ public void FinallyTest ()
// bug #26415
FinallyTestMethod ();
- Assert.IsTrue (finally_invoked);
+ Assert.That (finally_invoked, Is.True);
}
bool finally_invoked;
diff --git a/tests/linker/link sdk/PclTest.cs b/tests/linker/link sdk/PclTest.cs
index 9737f1ecaadb..9224bf9a6b90 100644
--- a/tests/linker/link sdk/PclTest.cs
+++ b/tests/linker/link sdk/PclTest.cs
@@ -23,32 +23,32 @@ public void System ()
const string url = "http://www.google.com";
Uri uri = new Uri (url);
- Assert.False (this is ICommand, "ICommand");
+ Assert.That (this is ICommand, Is.False, "ICommand");
try {
HttpWebRequest hwr = WebRequest.CreateHttp (uri);
try {
- Assert.True (hwr.SupportsCookieContainer, "SupportsCookieContainer");
+ Assert.That (hwr.SupportsCookieContainer, Is.True, "SupportsCookieContainer");
} catch (NotImplementedException) {
// feature is not available, but the symbol itself is needed
}
WebResponse wr = hwr.GetResponse ();
try {
- Assert.True (wr.SupportsHeaders, "SupportsHeaders");
+ Assert.That (wr.SupportsHeaders, Is.True, "SupportsHeaders");
} catch (NotImplementedException) {
// feature is not available, but the symbol itself is needed
}
wr.Dispose ();
try {
- Assert.NotNull (WebRequest.CreateHttp (url));
+ Assert.That (WebRequest.CreateHttp (url), Is.Not.Null);
} catch (NotImplementedException) {
// feature is not available, but the symbol itself is needed
}
try {
- Assert.NotNull (WebRequest.CreateHttp (uri));
+ Assert.That (WebRequest.CreateHttp (uri), Is.Not.Null);
} catch (NotImplementedException) {
// feature is not available, but the symbol itself is needed
}
diff --git a/tests/linker/link sdk/ReflectionTest.cs b/tests/linker/link sdk/ReflectionTest.cs
index 53c7987018cf..96886bb2449e 100644
--- a/tests/linker/link sdk/ReflectionTest.cs
+++ b/tests/linker/link sdk/ReflectionTest.cs
@@ -13,7 +13,7 @@ public void ParameterInfoName ()
{
// linker will disable the metadata removal optimization if that property is used by user code
// however it's used inside mscorlib.dll (and SDK) so it cannot be checked while testing
- //Assert.Null (typeof (ParameterInfo).GetProperty ("Name"), "Name");
+ //Assert.That (typeof (ParameterInfo).GetProperty ("Name"), Is.Null, "Name");
// Call the method we want to test, so that the linker doesn't remove it.
// The method needs to be in a different class, because this class has the Preserve attribute,
diff --git a/tests/linker/link sdk/TaskTest.cs b/tests/linker/link sdk/TaskTest.cs
index b614bc21e4be..2a264122aa0a 100644
--- a/tests/linker/link sdk/TaskTest.cs
+++ b/tests/linker/link sdk/TaskTest.cs
@@ -21,12 +21,12 @@ public void ContinueWithDifferentOptionsAreCanceledTest ()
mre.Set ();
contSuccess.Wait (100);
- Assert.True (contSuccess.IsCompleted, "contSuccess.IsCompleted");
- Assert.True (contFailed.IsCompleted, "contFailed.IsCompleted");
- Assert.True (contCanceled.IsCompleted, "contCanceled.IsCompleted");
- Assert.False (contSuccess.IsCanceled, "contSuccess.IsCanceled");
- Assert.True (contFailed.IsCanceled, "contFailed.IsCanceled");
- Assert.True (contCanceled.IsCanceled, "contCanceled.IsCanceled");
+ Assert.That (contSuccess.IsCompleted, Is.True, "contSuccess.IsCompleted");
+ Assert.That (contFailed.IsCompleted, Is.True, "contFailed.IsCompleted");
+ Assert.That (contCanceled.IsCompleted, Is.True, "contCanceled.IsCompleted");
+ Assert.That (contSuccess.IsCanceled, Is.False, "contSuccess.IsCanceled");
+ Assert.That (contFailed.IsCanceled, Is.True, "contFailed.IsCanceled");
+ Assert.That (contCanceled.IsCanceled, Is.True, "contCanceled.IsCanceled");
}
[Test]
@@ -45,7 +45,7 @@ public void ContinueWhenAll_WithMixedCompletionState ()
mre.Set ();
cont.Wait (200);
- Assert.True (ran, "ran");
+ Assert.That (ran, Is.True, "ran");
Assert.That (cont.Status, Is.EqualTo (TaskStatus.RanToCompletion), "Status");
}
}
diff --git a/tests/mmptest/mmptest.csproj b/tests/mmptest/mmptest.csproj
index a28ba735e604..5efe478000c5 100644
--- a/tests/mmptest/mmptest.csproj
+++ b/tests/mmptest/mmptest.csproj
@@ -1,6 +1,5 @@
-
Debug
x86
@@ -32,9 +31,9 @@
-
-
-
+
+
+
global,mmp
..\..\_mac-build\Library\Frameworks\Xamarin.Mac.framework\Versions\git\lib\mmp\mmp.exe
diff --git a/tests/mmptest/src/AOTTests.cs b/tests/mmptest/src/AOTTests.cs
index 9cff6bf8c99d..9f0993a553e7 100644
--- a/tests/mmptest/src/AOTTests.cs
+++ b/tests/mmptest/src/AOTTests.cs
@@ -16,7 +16,7 @@ void ValidateAOTStatus (string tmpDir, Func shouldAOT)
{
foreach (var file in GetOutputDirInfo (tmpDir).EnumerateFiles ()) {
bool shouldBeAOT = shouldAOT (file);
- Assert.AreEqual (shouldBeAOT, File.Exists (file.FullName + ".dylib"), "{0} should {1}be AOT.", file.FullName, shouldBeAOT ? "" : "not ");
+ Assert.That (File.Exists (file.FullName + ".dylib"), Is.EqualTo (shouldBeAOT), $"{file.FullName} should {shouldBeAOT ? "" : "not "}be AOT.");
}
}
diff --git a/tests/mmptest/src/BindingProjectNoEmbeddingTests.cs b/tests/mmptest/src/BindingProjectNoEmbeddingTests.cs
index 17556b2ee491..7d7fc5319215 100644
--- a/tests/mmptest/src/BindingProjectNoEmbeddingTests.cs
+++ b/tests/mmptest/src/BindingProjectNoEmbeddingTests.cs
@@ -17,15 +17,15 @@ static void AssertNoResourceWithName (string tmpDir, string projectName, string
string bindingName = BindingProjectTests.RemoveCSProj (projectName);
string bindingLibraryPath = Path.Combine (tmpDir, $"bin/Debug/{bindingName}.dll");
string resourceOutput = TI.RunAndAssert ("/Library/Frameworks/Mono.framework/Commands/monodis", new [] { "--presources", bindingLibraryPath }, "monodis");
- Assert.False (resourceOutput.Contains (resourceName), "Binding project output contained embedded library");
+ Assert.That (resourceOutput.Contains (resourceName), Is.False, "Binding project output contained embedded library");
}
static void AssertFileInBundle (string tmpDir, BindingProjectType type, string path, bool assertIsSymLink = false)
{
string bundlePath = Path.Combine (tmpDir, $"bin/Debug/{(type == BindingProjectType.Modern ? "UnifiedExample" : "XM45Example")}.app/Contents/{path}");
- Assert.True (File.Exists (bundlePath), $"{path} not in bundle as expected.");
+ Assert.That (File.Exists (bundlePath), Is.True, $"{path} not in bundle as expected.");
if (assertIsSymLink)
- Assert.True (File.GetAttributes (bundlePath).HasFlag (FileAttributes.ReparsePoint));
+ Assert.That (File.GetAttributes (bundlePath).HasFlag (FileAttributes.ReparsePoint), Is.True);
}
[TestCase (BindingProjectType.Modern, false)]
@@ -92,10 +92,10 @@ public void MultipleNativeReferences (bool useProjectReference)
BindingProjectTests.SetupAndBuildLinkedTestProjects (projects.Item1, projects.Item2, tmpDir, useProjectReference, setupDefaultNativeReference: true);
// manifest and 2 dylibs
- Assert.AreEqual (3, Directory.GetFiles (Path.Combine (tmpDir, "bin/Debug/MobileBinding.resources")).Length);
+ Assert.That (Directory.GetFiles (Path.Combine (tmpDir, "bin/Debug/MobileBinding.resources")).Length, Is.EqualTo (3));
// 2 dylibs + libMonoPosixHelper.dylib + libmono-native.dylib
- Assert.AreEqual (4, Directory.GetFiles (Path.Combine (tmpDir, "bin/Debug/UnifiedExample.app/Contents/MonoBundle")).Where (x => x.EndsWith (".dylib")).Count ());
+ Assert.That (Directory.GetFiles (Path.Combine (tmpDir, "bin/Debug/UnifiedExample.app/Contents/MonoBundle")).Where (x => x.EndsWith (".dylib")).Count (), Is.EqualTo (4));
});
}
@@ -152,7 +152,7 @@ public void CleanShouldRemoveBundle ()
BindingProjectTests.SetupAndBuildBindingProject (projects.Item1, true);
TI.CleanUnifiedProject (Path.Combine (tmpDir, projects.Item1.ProjectName));
- Assert.False (Directory.Exists (Path.Combine (tmpDir, "bin/Debug/MobileBinding.resources")), "Resource bundle was not cleaned up");
+ Assert.That (Directory.Exists (Path.Combine (tmpDir, "bin/Debug/MobileBinding.resources")), Is.False, "Resource bundle was not cleaned up");
});
}
}
diff --git a/tests/mmptest/src/BindingProjectTests.cs b/tests/mmptest/src/BindingProjectTests.cs
index 7440846eb961..48aacbaabe63 100644
--- a/tests/mmptest/src/BindingProjectTests.cs
+++ b/tests/mmptest/src/BindingProjectTests.cs
@@ -106,9 +106,9 @@ public void ShouldRemovePackagedLibrary_OnceInBundle (BindingProjectType type)
string appName = RemoveCSProj (projects.Item2.ProjectName);
string libPath = Path.Combine (tmpDir, $"bin/Debug/{appName}.app/Contents/MonoBundle/{bindingName}.dll");
- Assert.True (File.Exists (libPath), $"Did not find expected library: {libPath}");
+ Assert.That (File.Exists (libPath), Is.True, $"Did not find expected library: {libPath}");
string monoDisResults = TI.RunAndAssert ("/Library/Frameworks/Mono.framework/Commands/monodis", new [] { "--presources", libPath }, "monodis");
- Assert.IsFalse (monoDisResults.Contains ("SimpleClassDylib.dylib"));
+ Assert.That (monoDisResults.Contains ("SimpleClassDylib.dylib"), Is.False);
});
}
@@ -128,16 +128,16 @@ public void ShouldBuildWithoutErrors_AndLinkCorrectFramework (BindingProjectType
var logs = SetupAndBuildLinkedTestProjects (projects.Item1, projects.Item2, tmpDir, useProjectReference: false, setupDefaultNativeReference: noEmbedding);
- Assert.True (logs.BindingBuildResult.BuildOutput.Contains ("csc"), "Bindings project must use csc:\n" + logs.Item1);
+ Assert.That (logs.BindingBuildResult.BuildOutput.Contains ("csc"), Is.True, "Bindings project must use csc:\n" + logs.Item1);
var bgenInvocation = logs.BindingBuildResult.BuildOutputLines.First (x => x.Contains ("bin/bgen"));
- Assert.IsTrue (StringUtils.TryParseArguments (bgenInvocation, out var bgenArguments, out var _), "Parse bgen arguments");
+ Assert.That (StringUtils.TryParseArguments (bgenInvocation, out var bgenArguments, out var _), Is.True, "Parse bgen arguments");
// unfurl any response files
var bgenParts = bgenArguments.ToList ();
var responseFiles = bgenParts.Where (v => v [0] == '@').ToArray ();
bgenParts.RemoveAll (v => v [0] == '@');
foreach (var rsp in responseFiles) {
- Assert.IsTrue (StringUtils.TryParseArguments (File.ReadAllText (rsp.Substring (1)).Replace ('\n', ' '), out var args, out var _), "Parse response file");
+ Assert.That (StringUtils.TryParseArguments (File.ReadAllText (rsp.Substring (1)).Replace ('\n', ' '), out var args, out var _), Is.True, "Parse response file");
bgenParts.AddRange (args);
}
var mscorlib = bgenParts.First (x => x.Contains ("mscorlib.dll"));
@@ -159,20 +159,20 @@ public void ShouldBuildWithoutErrors_AndLinkCorrectFramework (BindingProjectType
throw new NotImplementedException ();
}
- Assert.False (logs.BindingBuildResult.BuildOutput.Contains ("CS1685"), "Binding should not contains CS1685 multiple definition warning.");
+ Assert.That (logs.BindingBuildResult.BuildOutput.Contains ("CS1685"), Is.False, "Binding should not contains CS1685 multiple definition warning.");
- Assert.False (logs.BindingBuildResult.BuildOutput.Contains ("MSB9004"), "Binding should not contains MSB9004 warning");
+ Assert.That (logs.BindingBuildResult.BuildOutput.Contains ("MSB9004"), Is.False, "Binding should not contains MSB9004 warning");
string bindingName = RemoveCSProj (projects.Item1.ProjectName);
string appName = RemoveCSProj (projects.Item2.ProjectName);
string libPath = Path.Combine (tmpDir, $"bin/Debug/{appName}.app/Contents/MonoBundle/{bindingName}.dll");
- Assert.True (File.Exists (libPath));
+ Assert.That (File.Exists (libPath), Is.True);
string results = TI.RunAndAssert ("/Library/Frameworks/Mono.framework/Commands/monop", new [] { "--refs", "-r:" + libPath }, "monop");
string mscorlibLine = results.Split (new char [] { '\n' }).First (x => x.Contains ("mscorlib"));
string expectedVersion = GetExpectedBCLVersion (type);
- Assert.True (mscorlibLine.Contains (expectedVersion), $"{mscorlibLine} did not contain expected version {expectedVersion}");
+ Assert.That (mscorlibLine.Contains (expectedVersion), Is.True, $"{mscorlibLine} did not contain expected version {expectedVersion}");
});
}
diff --git a/tests/mmptest/src/CodeStrippingTests.cs b/tests/mmptest/src/CodeStrippingTests.cs
index 45ec14d41849..8d75c644ced1 100644
--- a/tests/mmptest/src/CodeStrippingTests.cs
+++ b/tests/mmptest/src/CodeStrippingTests.cs
@@ -37,27 +37,27 @@ void AssertStrip (string libPath, bool shouldStrip)
{
var archsFound = MachO.GetArchitectures (libPath);
if (shouldStrip) {
- Assert.AreEqual (1, archsFound.Count, "Did not contain one archs");
- Assert.True (archsFound.Contains (Abi.x86_64), "Did not contain x86_64");
+ Assert.That (archsFound.Count, Is.EqualTo (1), "Did not contain one archs");
+ Assert.That (archsFound.Contains (Abi.x86_64), Is.True, "Did not contain x86_64");
} else {
Assert.That (archsFound.Count, Is.GreaterThanOrEqualTo (2), "Did not contain two or more archs");
- Assert.True (archsFound.Contains (Abi.i386) || archsFound.Contains (Abi.ARM64), "Did not contain i386 nor arm64");
- Assert.True (archsFound.Contains (Abi.x86_64), "Did not contain x86_64");
+ Assert.That (archsFound.Contains (Abi.i386) || archsFound.Contains (Abi.ARM64), Is.True, "Did not contain i386 nor arm64");
+ Assert.That (archsFound.Contains (Abi.x86_64), Is.True, "Did not contain x86_64");
}
}
void StripTestCore (TI.UnifiedTestConfig test, bool debugStrips, bool releaseStrips, string libPath, bool shouldWarn)
{
var testResult = TI.TestUnifiedExecutable (test);
- Assert.AreEqual (debugStrips, DidAnyLipoStrip (testResult.BuildResult), "Debug lipo usage did not match expectations");
+ Assert.That (DidAnyLipoStrip (testResult.BuildResult), Is.EqualTo (debugStrips), "Debug lipo usage did not match expectations");
AssertStrip (Path.Combine (test.TmpDir, "bin/Debug/UnifiedExample.app/", libPath), shouldStrip: debugStrips);
- Assert.AreEqual (shouldWarn && debugStrips, testResult.BuildResult.HasMessage (2108), "Debug warning did not match expectations");
+ Assert.That (testResult.BuildResult.HasMessage (2108), Is.EqualTo (shouldWarn && debugStrips), "Debug warning did not match expectations");
test.Release = true;
testResult = TI.TestUnifiedExecutable (test);
- Assert.AreEqual (releaseStrips, DidAnyLipoStrip (testResult.BuildResult), "Release lipo usage did not match expectations");
+ Assert.That (DidAnyLipoStrip (testResult.BuildResult), Is.EqualTo (releaseStrips), "Release lipo usage did not match expectations");
AssertStrip (Path.Combine (test.TmpDir, "bin/Release/UnifiedExample.app/", libPath), shouldStrip: releaseStrips);
- Assert.AreEqual (shouldWarn && releaseStrips, testResult.BuildResult.HasMessage (2108), "Release warning did not match expectations");
+ Assert.That (testResult.BuildResult.HasMessage (2108), Is.EqualTo (shouldWarn && releaseStrips), "Release warning did not match expectations");
}
[TestCase (null, false, true)]
@@ -112,11 +112,11 @@ public void ExplictStripOption_ThirdPartyLibrary_AndWarnsIfSo (bool? strip, bool
var architectures = MachO.GetArchitectures (bundleDylib);
if (shouldStrip) {
- Assert.AreEqual (1, architectures.Count, "libTest.dylib should only contain 1 architecture");
- Assert.AreEqual (Abi.x86_64, architectures [0], "libTest.dylib should be x86_64");
+ Assert.That (architectures.Count, Is.EqualTo (1), "libTest.dylib should only contain 1 architecture");
+ Assert.That (architectures [0], Is.EqualTo (Abi.x86_64), "libTest.dylib should be x86_64");
testResult.Messages.AssertWarning (2108, "libTest.dylib was stripped of architectures except x86_64 to comply with App Store restrictions. This could break existing codesigning signatures. Consider stripping the library with lipo or disabling with --optimize=-trim-architectures");
} else {
- Assert.AreEqual (2, architectures.Count, "libTest.dylib should contain 2+ architectures");
+ Assert.That (architectures.Count, Is.EqualTo (2), "libTest.dylib should contain 2+ architectures");
Assert.That (architectures, Is.EquivalentTo (new Abi [] { Abi.i386, Abi.x86_64 }), "libTest.dylib should be x86_64 + i386");
testResult.Messages.AssertWarningCount (0);
}
@@ -125,14 +125,14 @@ public void ExplictStripOption_ThirdPartyLibrary_AndWarnsIfSo (bool? strip, bool
void AssertNoLipoOrWarning (BuildResult buildOutput, string context)
{
- Assert.False (DidAnyLipoStrip (buildOutput), "lipo incorrectly run in context: " + context);
- Assert.False (buildOutput.HasMessage (2108), "MM2108 incorrectly given in in context: " + context);
+ Assert.That (DidAnyLipoStrip (buildOutput), Is.False, "lipo incorrectly run in context: " + context);
+ Assert.That (buildOutput.HasMessage (2108), Is.False, "MM2108 incorrectly given in in context: " + context);
}
void AssertLipoOnlyMonoPosix (BuildResult buildOutput, string context)
{
- Assert.False (DidAnyLipoStripSkipPosix (buildOutput), "lipo incorrectly run in context outside of libMonoPosixHelper/libmono-native: " + context);
- Assert.False (buildOutput.HasMessage (2108), "MM2108 incorrectly given in in context: " + context);
+ Assert.That (DidAnyLipoStripSkipPosix (buildOutput), Is.False, "lipo incorrectly run in context outside of libMonoPosixHelper/libmono-native: " + context);
+ Assert.That (buildOutput.HasMessage (2108), Is.False, "MM2108 incorrectly given in in context: " + context);
}
[TestCase (false)]
@@ -152,9 +152,9 @@ public void ThirdPartyLibrary_WithIncorrectBitness_ShouldWarnOnRelease (bool six
// Should always lipo/warn in Release
test.Release = true;
testResult = TI.TestUnifiedExecutable (test);
- Assert.True (DidAnyLipoStrip (testResult.BuildResult), $"lipo did not run in release");
+ Assert.That (DidAnyLipoStrip (testResult.BuildResult), Is.True, $"lipo did not run in release");
testResult.BuildResult.Messages.AssertError (2108, $"{frameworkPath} was stripped of architectures except x86_64 to comply with App Store restrictions. This could break existing codesigning signatures. Consider stripping the library with lipo or disabling with --optimize=-trim-architectures");
- // Assert.True (testResult.Contains ("MM2108"), $"MM2108 not given in release");
+ // Assert.That (testResult.Contains ("MM2108"), Is.True, $"MM2108 not given in release");
});
}
diff --git a/tests/mmptest/src/FrameworkLinksTests.cs b/tests/mmptest/src/FrameworkLinksTests.cs
index 98d549579016..edf9785d8a40 100644
--- a/tests/mmptest/src/FrameworkLinksTests.cs
+++ b/tests/mmptest/src/FrameworkLinksTests.cs
@@ -30,8 +30,8 @@ Dictionary CalculateFrameworkLinkStatus (string [] clangPart
void AssertAppKitLinkage (Dictionary status)
{
- Assert.IsTrue (status.ContainsKey ("AppKit"), "AppKit must have framework reference in clang invocation");
- Assert.AreEqual (LinkStatus.Strong, status ["AppKit"], "AppKit must be strong linked");
+ Assert.That (status.ContainsKey ("AppKit"), Is.True, "AppKit must have framework reference in clang invocation");
+ Assert.That (status ["AppKit"], Is.EqualTo (LinkStatus.Strong), "AppKit must be strong linked");
}
void AssertFrameworkMinOSRespected (Dictionary status)
@@ -57,7 +57,7 @@ void AssertFrameworkMinOSRespected (Dictionary status)
} else {
linkStatus = currentFramework.Version > SdkVersions.MinOSXVersion ? LinkStatus.Weak : LinkStatus.Strong;
}
- Assert.AreEqual (linkStatus, entry.Value, $"Framework link status of {entry.Key} was {entry.Value} but expected to be {linkStatus}");
+ Assert.That (entry.Value, Is.EqualTo (linkStatus), $"Framework link status of {entry.Key} was {entry.Value} but expected to be {linkStatus}");
}
}
@@ -82,7 +82,7 @@ void AssertUnlinkedFrameworkStatus (string [] clangParts)
AssertAppKitLinkage (status);
// We expect a large number of entires, which will grow as we add more bindings
- Assert.Greater (status.Count, 20, "Did not found as many framework entries in clang invocation as expected - {0}\n{1}", status.Count, string.Join (" ", clangParts));
+ Assert.That (status.Count, Is.GreaterThan (20), $"Did not found as many framework entries in clang invocation as expected - {status.Count}\n{string.Join (" ", clangParts)}");
AssertFrameworkMinOSRespected (status);
}
@@ -109,7 +109,7 @@ void AssertLinkedFrameworkStatus (string [] clangParts)
// We expect a few number of entires, which should not grow much over time
// Today - Foundation, AppKit, Security, QuartzCore, CoreFoundation, CFNetwork, Carbon, CoreServices, CoreData, Quartz, CloudKit, GSS
- Assert.Less (status.Count, 12, "Found more framework entries in clang invocation then expected - {0}\n{1}", string.Join (" ", status.Select ((v) => v.Key)), string.Join (" ", clangParts));
+ Assert.That (status.Count, Is.LessThan (12), $"Found more framework entries in clang invocation then expected - {string.Join (" ", status.Select ((v) => v.Key))}\n{string.Join (" ", clangParts)}");
AssertFrameworkMinOSRespected (status);
}
diff --git a/tests/mmptest/src/LinkerTests.cs b/tests/mmptest/src/LinkerTests.cs
index 0df501a6030c..0f421dcfb861 100644
--- a/tests/mmptest/src/LinkerTests.cs
+++ b/tests/mmptest/src/LinkerTests.cs
@@ -39,7 +39,7 @@ public void ModernLinkingSDK_WithAllNonProductSkipped_BuildsWithSameNumberOfType
foreach (string dep in dependencies) {
int typesInBaseLib = GetNumberOfTypesInLibrary (GetBaseAssemblyPath (dep, true));
int typesInOutput = GetNumberOfTypesInLibrary (GetOutputBundlePath (tmpDir, dep, true));
- Assert.AreEqual (typesInBaseLib, typesInOutput, $"We linked a linkskip - {dep} with config ({typesInBaseLib} vs {typesInOutput}:\n {config}");
+ Assert.That (typesInOutput, Is.EqualTo (typesInBaseLib), $"We linked a linkskip - {dep} with config ({typesInBaseLib} vs {typesInOutput}:\n {config}");
}
});
}
@@ -54,12 +54,12 @@ public void FullLinkingSdk_BuildsWithFewerPlatformTypesOnly ()
foreach (string dep in nonPlatformDependencies) {
int typesInBaseLib = GetNumberOfTypesInLibrary (GetBaseAssemblyPath (dep, false));
int typesInOutput = GetNumberOfTypesInLibrary (GetOutputBundlePath (tmpDir, dep, false));
- Assert.AreEqual (typesInBaseLib, typesInOutput, $"We linked a linkskip - {dep} with config ({typesInBaseLib} vs {typesInOutput}):\n {PlatformProjectConfig}");
+ Assert.That (typesInOutput, Is.EqualTo (typesInBaseLib), $"We linked a linkskip - {dep} with config ({typesInBaseLib} vs {typesInOutput}):\n {PlatformProjectConfig}");
}
int typesInBasePlatform = GetNumberOfTypesInLibrary (GetBaseAssemblyPath ("Xamarin.Mac", false));
int typesInOutputPlatform = GetNumberOfTypesInLibrary (GetOutputBundlePath (tmpDir, "Xamarin.Mac", false));
- Assert.AreNotEqual (typesInBasePlatform, typesInOutputPlatform, $"We linked a linkskip - Xamarin.Mac with config ({typesInBasePlatform} vs {typesInOutputPlatform}):\n {PlatformProjectConfig}");
+ Assert.That (typesInOutputPlatform, Is.Not.EqualTo (typesInBasePlatform), $"We linked a linkskip - Xamarin.Mac with config ({typesInBasePlatform} vs {typesInOutputPlatform}):\n {PlatformProjectConfig}");
});
}
@@ -113,7 +113,7 @@ public void Linking_ShouldHandleMixedModeAssemblies (string linker, bool builds_
};
var buildOutput = TI.TestUnifiedExecutable (test, shouldFail: builds_successfully).BuildResult;
- Assert.True (buildOutput.HasMessage (2014) == builds_successfully, $"Building with {linker} did not give 2014 status {builds_successfully} as expected.");
+ Assert.That (buildOutput.HasMessage (2014) == builds_successfully, Is.True, $"Building with {linker} did not give 2014 status {builds_successfully} as expected.");
});
}
@@ -123,7 +123,7 @@ public void LinkingAdditionalArguments_ShouldBeUsed ()
MMPTests.RunMMPTest (tmpDir => {
TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) { CSProjConfig = "-v -v --linkplatform" };
var testResult = TI.TestUnifiedExecutable (test);
- Assert.IsTrue (testResult.BuildResult.BuildOutput.Contains ("Selected Linking: 'Platform'"), $"Build Output did not contain expected selected linking line: {testResult}");
+ Assert.That (testResult.BuildResult.BuildOutput.Contains ("Selected Linking: 'Platform'"), Is.True, $"Build Output did not contain expected selected linking line: {testResult}");
});
}
diff --git a/tests/mmptest/src/MMPTest.cs b/tests/mmptest/src/MMPTest.cs
index 0e1a9b27cc63..39bc972491d5 100644
--- a/tests/mmptest/src/MMPTest.cs
+++ b/tests/mmptest/src/MMPTest.cs
@@ -75,7 +75,7 @@ public void XM_45_NotAddingIncorrectDependencies_LicenseTest ()
// XM 4.5 projects were accidently pulling in every assembly in the 4.5 folder. Assert that isn't happening again.
string monoBundlePath = Path.Combine (tmpDir, "bin/Debug/XM45Example.app/Contents/MonoBundle/");
- Assert.IsFalse (Directory.GetFiles (monoBundlePath).Any (x => x.Contains ("FSharp.Core.dll")), "F# was pulled in?");
+ Assert.That (Directory.GetFiles (monoBundlePath).Any (x => x.Contains ("FSharp.Core.dll")), Is.False, "F# was pulled in?");
});
}
@@ -139,7 +139,7 @@ public void Unified_HelloWorld_ShouldHaveNoWarnings (bool release, bool full)
rv.Messages.AssertWarning (5220, "Skipping framework 'QTKit'. It is prohibited (rejected) by the Mac App Store");
// We get the MM5220 twice in the output, once from mmp and once from msbuild repeating what mmp said, so we can't assert that there's exactly 1 warning.
// Instead assert that we get no warning but MM5220.
- Assert.IsFalse (rv.Messages.Messages.Any ((v) => v.Number != 5220), "No warnings except MM5220");
+ Assert.That (rv.Messages.Messages.Any ((v) => v.Number != 5220), Is.False, "No warnings except MM5220");
} else {
rv.Messages.AssertWarningCount (0);
}
@@ -153,12 +153,12 @@ public void Unified_HelloWorld_ShouldHaveNoRegistrarWarnings ()
TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir);
// Mobile
string output = TI.TestUnifiedExecutable (test).RunOutput;
- Assert.IsTrue (!output.Contains ("Could not register the assembly"), "Unified_HelloWorld_ShouldHaveNoRegistrarWarnings - Mobile had registrar issues: \n" + output);
+ Assert.That (!output.Contains ("Could not register the assembly"), Is.True, "Unified_HelloWorld_ShouldHaveNoRegistrarWarnings - Mobile had registrar issues: \n" + output);
// XM45
test.XM45 = true;
output = TI.TestUnifiedExecutable (test).RunOutput;
- Assert.IsTrue (!output.Contains ("Could not register the assembly"), "Unified_HelloWorld_ShouldHaveNoRegistrarWarnings - XM45 had registrar issues: \n" + output);
+ Assert.That (!output.Contains ("Could not register the assembly"), Is.True, "Unified_HelloWorld_ShouldHaveNoRegistrarWarnings - XM45 had registrar issues: \n" + output);
});
}
@@ -224,7 +224,7 @@ static void MonoPosixTestCore (string tmpDir, TI.UnifiedTestConfig test)
{
TI.TestUnifiedExecutable (test, shouldFail: false);
- Assert.IsTrue (File.Exists (Path.Combine (tmpDir, "bin/Debug/XM45Example.app/Contents/MonoBundle/libMonoPosixHelper.dylib")), String.Format ("Does {0}/bin/Debug/XM45Example.app/Contents/MonoBundle/libMonoPosixHelper.dylib to exist?", tmpDir));
+ Assert.That (File.Exists (Path.Combine (tmpDir, "bin/Debug/XM45Example.app/Contents/MonoBundle/libMonoPosixHelper.dylib")), Is.True, String.Format ("Does {0}/bin/Debug/XM45Example.app/Contents/MonoBundle/libMonoPosixHelper.dylib to exist?", tmpDir));
}
@@ -239,13 +239,13 @@ public void Unified_ShouldNotGenerateMachineConfigInBundle_WithoutOption ()
// Mobile
TI.TestUnifiedExecutable (test);
- Assert.IsFalse (File.Exists (Path.Combine (tmpDir, machineConfigMobileLocation)));
+ Assert.That (File.Exists (Path.Combine (tmpDir, machineConfigMobileLocation)), Is.False);
// XM45
test.XM45 = true;
TI.TestUnifiedExecutable (test);
- Assert.IsFalse (File.Exists (Path.Combine (tmpDir, machineConfigXM45Location)));
+ Assert.That (File.Exists (Path.Combine (tmpDir, machineConfigXM45Location)), Is.False);
});
}
@@ -281,11 +281,11 @@ public void Unified_ShouldGenerateMachineConfigInBundle_WithEmptyOption ()
CSProjConfig = "--machine-config=\"\""
};
TI.TestUnifiedExecutable (test);
- Assert.IsTrue (File.Exists (Path.Combine (tmpDir, machineConfigMobileLocation)));
+ Assert.That (File.Exists (Path.Combine (tmpDir, machineConfigMobileLocation)), Is.True);
test.XM45 = true;
TI.TestUnifiedExecutable (test);
- Assert.IsTrue (File.Exists (Path.Combine (tmpDir, machineConfigXM45Location)));
+ Assert.That (File.Exists (Path.Combine (tmpDir, machineConfigXM45Location)), Is.True);
});
}
@@ -304,17 +304,17 @@ public void Unified_ShouldGenerateMachineConfigInBundle_WhenPassedIn ()
// Mobile
TI.TestUnifiedExecutable (test);
- Assert.IsTrue (File.Exists (Path.Combine (tmpDir, machineConfigMobileLocation)));
+ Assert.That (File.Exists (Path.Combine (tmpDir, machineConfigMobileLocation)), Is.True);
string [] text = File.ReadAllLines (Path.Combine (tmpDir, machineConfigMobileLocation));
- Assert.IsTrue (text.Length == 1 && text [0] == configText);
+ Assert.That (text.Length == 1 && text [0] == configText, Is.True);
// XM45
test.XM45 = true;
TI.TestUnifiedExecutable (test);
- Assert.IsTrue (File.Exists (Path.Combine (tmpDir, machineConfigXM45Location)));
+ Assert.That (File.Exists (Path.Combine (tmpDir, machineConfigXM45Location)), Is.True);
text = File.ReadAllLines (Path.Combine (tmpDir, machineConfigXM45Location));
- Assert.IsTrue (text.Length == 1 && text [0] == configText);
+ Assert.That (text.Length == 1 && text [0] == configText, Is.True);
});
}
@@ -335,8 +335,8 @@ public void Unified_FailedBuild_ShouldRequireAnotherBuildNotSkipMMP ()
// If we fail, we'll likely fail with "did not generate an exe" before returning but let's check anyway
var secondBuildResult = TI.BuildProject (Path.Combine (tmpDir, TI.GetUnifiedExecutableProjectName (test)));
var secondBuildOutput = secondBuildResult.BuildOutput;
- Assert.IsTrue (!secondBuildOutput.Contains ("Skipping target \"_CompileToNative"), "Did not skip");
- Assert.IsTrue (secondBuildOutput.Contains ("Building target \"_CompileToNative\" completely"), "Did need to build");
+ Assert.That (!secondBuildOutput.Contains ("Skipping target \"_CompileToNative"), Is.True, "Did not skip");
+ Assert.That (secondBuildOutput.Contains ("Building target \"_CompileToNative\" completely"), Is.True, "Did need to build");
}
});
}
@@ -363,9 +363,9 @@ public void UnifiedWithDepLib_ThatContainsUserResource_ShouldBeRemovedUnderFullL
TI.TestUnifiedExecutable (test);
string libPath = Path.Combine (tmpDir, "bin/Debug/UnifiedExample.app/Contents/MonoBundle/UnifiedLibrary.dll");
- Assert.True (File.Exists (libPath));
+ Assert.That (File.Exists (libPath), Is.True);
string monoDisResults = TI.RunAndAssert ("/Library/Frameworks/Mono.framework/Commands/monodis", new [] { "--presources", libPath }, "monodis");
- Assert.IsFalse (monoDisResults.Contains ("foo.xml"));
+ Assert.That (monoDisResults.Contains ("foo.xml"), Is.False);
});
}
@@ -383,7 +383,7 @@ public void Unified_SideBySideXamMac_ConsoleTest ()
TI.BuildProject (testPath);
string exePath = Path.Combine (TI.FindSourceDirectory (), @"bin/Debug/ConsoleXMApp.exe");
var output = TI.RunAndAssert ("/Library/Frameworks/Mono.framework/Commands/mono64", new [] { exePath }, "RunSideBySizeXamMac");
- Assert.IsTrue (output.Split (Environment.NewLine.ToCharArray ()).Any (x => x.Contains ("True")), "Unified_SideBySideXamMac_ConsoleTest run");
+ Assert.That (output.Split (Environment.NewLine.ToCharArray ()).Any (x => x.Contains ("True")), Is.True, "Unified_SideBySideXamMac_ConsoleTest run");
});
}
@@ -395,7 +395,7 @@ public void UnifiedDebugBuilds_ShouldLinkToPartialStatic_UnlessDisabled_Release
TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) { XM45 = xm45 };
test.Release = true;
var testResults = TI.TestUnifiedExecutable (test);
- Assert.IsFalse (testResults.BuildResult.BuildOutput.Contains ("Xamarin.Mac.registrar"), "Release build should not use partial static registrar");
+ Assert.That (testResults.BuildResult.BuildOutput.Contains ("Xamarin.Mac.registrar"), Is.False, "Release build should not use partial static registrar");
});
}
@@ -408,7 +408,7 @@ public void UnifiedDebugBuilds_ShouldLinkToPartialStatic_UnlessDisabled_Debug (b
test.Release = false;
test.CSProjConfig = "true";
var testResults = TI.TestUnifiedExecutable (test);
- Assert.IsTrue (testResults.BuildResult.BuildOutput.Contains ("Xamarin.Mac.registrar"), "Debug build should use partial static registrar");
+ Assert.That (testResults.BuildResult.BuildOutput.Contains ("Xamarin.Mac.registrar"), Is.True, "Debug build should use partial static registrar");
});
}
@@ -421,7 +421,7 @@ public void UnifiedDebugBuilds_ShouldLinkToPartialStatic_UnlessDisabled_Debug_dy
test.Release = false;
test.CSProjConfig = "true--registrar=dynamicx86_64";
var testResult = TI.TestUnifiedExecutable (test);
- Assert.IsFalse (testResult.BuildResult.BuildOutput.Contains ("Xamarin.Mac.registrar"), "registrar=dynamic build should not use partial static registrar");
+ Assert.That (testResult.BuildResult.BuildOutput.Contains ("Xamarin.Mac.registrar"), Is.False, "registrar=dynamic build should not use partial static registrar");
});
}
@@ -434,7 +434,7 @@ public void UnifiedDebugBuilds_ShouldLinkToPartialStatic_UnlessDisabled_Debug_pa
test.Release = false;
test.CSProjConfig = "true--registrar=partialx86_64";
var testResults = TI.TestUnifiedExecutable (test);
- Assert.IsTrue (testResults.BuildResult.BuildOutput.Contains ("Xamarin.Mac.registrar"), "registrar=partial build should use partial static registrar");
+ Assert.That (testResults.BuildResult.BuildOutput.Contains ("Xamarin.Mac.registrar"), Is.True, "registrar=partial build should use partial static registrar");
});
}
//https://testrail.xamarin.com/index.php?/cases/view/234141&group_by=cases:section_id&group_order=asc&group_id=51097
@@ -454,7 +454,7 @@ public void UnifiedDebug_ShouldOnlyHaveOne_ObjCArgument ()
RunMMPTest (tmpDir => {
string [] clangParts = GetUnifiedProjectClangInvocation (tmpDir);
int objcCount = clangParts.Count (x => x.Contains ("-ObjC"));
- Assert.AreEqual (1, objcCount, "Found more than one -OjbC");
+ Assert.That (objcCount, Is.EqualTo (1), "Found more than one -OjbC");
});
}
@@ -700,15 +700,15 @@ public void BuildingSameSolutionTwice_ShouldNotRunACToolTwice ()
string project = TI.GenerateUnifiedExecutableProject (test);
var buildResult = TI.BuildProject (project);
- Assert.True (buildResult.BuildOutputLines.Any (executedActool), $"Initial build should run actool");
+ Assert.That (buildResult.BuildOutputLines.Any (executedActool), Is.True, $"Initial build should run actool");
buildResult = TI.BuildProject (project);
- Assert.False (buildResult.BuildOutputLines.Any (executedActool), $"Second build should not run actool");
+ Assert.That (buildResult.BuildOutputLines.Any (executedActool), Is.False, $"Second build should not run actool");
TI.RunAndAssert ("touch", new [] { Path.Combine (tmpDir, "Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png") }, "touch icon");
buildResult = TI.BuildProject (project);
- Assert.True (buildResult.BuildOutputLines.Any (executedActool), $"Build after touching icon must run actool");
+ Assert.That (buildResult.BuildOutputLines.Any (executedActool), Is.True, $"Build after touching icon must run actool");
});
}
@@ -728,8 +728,8 @@ public void HardenedRuntimeCodesignOption ()
var baseOutput = TI.TestUnifiedExecutable (test);
string baseCodesign = findCodesign (baseOutput);
- Assert.False (baseCodesign.Contains ("-o runtime"), "Base codesign");
- Assert.True (baseCodesign.Contains ("--timestamp=none"), "Base codesign timestamp");
+ Assert.That (baseCodesign.Contains ("-o runtime"), Is.False, "Base codesign");
+ Assert.That (baseCodesign.Contains ("--timestamp=none"), Is.True, "Base codesign timestamp");
test.CSProjConfig += "trueEntitlements.plist";
@@ -746,8 +746,8 @@ public void HardenedRuntimeCodesignOption ()
var hardenedOutput = TI.TestUnifiedExecutable (test);
string hardenedCodesign = findCodesign (hardenedOutput);
- Assert.True (hardenedCodesign.Contains ("-o runtime"), "Hardened codesign");
- Assert.True (hardenedCodesign.Contains ("--timestamp"), "Hardened codesign timestamp");
+ Assert.That (hardenedCodesign.Contains ("-o runtime"), Is.True, "Hardened codesign");
+ Assert.That (hardenedCodesign.Contains ("--timestamp"), Is.True, "Hardened codesign timestamp");
});
}
diff --git a/tests/mmptest/src/NativeExtensionEmbedding.cs b/tests/mmptest/src/NativeExtensionEmbedding.cs
index 35ba61b06830..2f2f9c8f3762 100644
--- a/tests/mmptest/src/NativeExtensionEmbedding.cs
+++ b/tests/mmptest/src/NativeExtensionEmbedding.cs
@@ -17,8 +17,8 @@ public void NativeExtensionEmbedding (bool XM45)
var xcodeProjectFolder = Path.Combine (tmpDir, "NativeExtension");
string [] xcodeBuildArgs = new [] { "-configuration", "Debug", "-target", "NativeTodayExtension", "-arch", "x86_64" };
var env = new System.Collections.Generic.Dictionary { { "DEVELOPER_DIR", Configuration.XcodeLocation } };
- Assert.AreEqual (0, ExecutionHelper.Execute ("/usr/bin/xcodebuild", xcodeBuildArgs.Concat (new [] { "clean" }).ToArray (), out var _, workingDirectory: xcodeProjectFolder, environment_variables: env, stdout_callback: Console.WriteLine, stderr_callback: Console.Error.WriteLine));
- Assert.AreEqual (0, ExecutionHelper.Execute ("/usr/bin/xcodebuild", xcodeBuildArgs.Concat (new [] { "build" }).ToArray (), out var _, workingDirectory: xcodeProjectFolder, environment_variables: env, stdout_callback: Console.WriteLine, stderr_callback: Console.Error.WriteLine));
+ Assert.That (ExecutionHelper.Execute ("/usr/bin/xcodebuild", xcodeBuildArgs.Concat (new [] { "clean" }).ToArray (), out var _, workingDirectory: xcodeProjectFolder, environment_variables: env, stdout_callback: Console.WriteLine, stderr_callback: Console.Error.WriteLine), Is.EqualTo (0));
+ Assert.That (ExecutionHelper.Execute ("/usr/bin/xcodebuild", xcodeBuildArgs.Concat (new [] { "build" }).ToArray (), out var _, workingDirectory: xcodeProjectFolder, environment_variables: env, stdout_callback: Console.WriteLine, stderr_callback: Console.Error.WriteLine), Is.EqualTo (0));
var items = @"
diff --git a/tests/mmptest/src/NativeReferencesTests.cs b/tests/mmptest/src/NativeReferencesTests.cs
index 99083d6315eb..3ca71040494a 100644
--- a/tests/mmptest/src/NativeReferencesTests.cs
+++ b/tests/mmptest/src/NativeReferencesTests.cs
@@ -56,24 +56,24 @@ void NativeReferenceTestCore (string tmpDir, TI.UnifiedTestConfig test, string t
// Mobile
test.XM45 = false;
var testResult = TI.TestUnifiedExecutable (test, false);
- Assert.IsTrue (!buildShouldBeSuccessful || !testResult.BuildResult.HasMessage (2006), string.Format ("{0} - Mobile had MM2006 state {1} not match expected\n{2}", testName, buildShouldBeSuccessful, testResult));
+ Assert.That (!buildShouldBeSuccessful || !testResult.BuildResult.HasMessage (2006), Is.True, string.Format ("{0} - Mobile had MM2006 state {1} not match expected\n{2}", testName, buildShouldBeSuccessful, testResult));
if (processBuildOutput is not null)
- Assert.IsTrue (processBuildOutput (testResult.BuildResult), string.Format ("{0} - Mobile - We did not see our expected item in the build output: {1}", testName, libraryName));
+ Assert.That (processBuildOutput (testResult.BuildResult), Is.True, string.Format ("{0} - Mobile - We did not see our expected item in the build output: {1}", testName, libraryName));
string mobileBundlePath = Path.Combine (tmpDir, "bin/Debug/UnifiedExample.app/Contents/MonoBundle/");
if (libraryName is not null)
- Assert.IsTrue (Directory.GetFiles (mobileBundlePath).Any (x => x.Contains (libraryName) == !libraryShouldNotBeCopied), string.Format ("{0} - Mobile - We did not pull in native lib: {1}", testName, libraryName));
+ Assert.That (Directory.GetFiles (mobileBundlePath).Any (x => x.Contains (libraryName) == !libraryShouldNotBeCopied), Is.True, string.Format ("{0} - Mobile - We did not pull in native lib: {1}", testName, libraryName));
// XM45
test.XM45 = true;
testResult = TI.TestUnifiedExecutable (test, false);
- Assert.IsTrue (!buildShouldBeSuccessful || !testResult.BuildResult.HasMessage (2006), string.Format ("{0} - XM45 had MM2006 state {1} not match expected\n{2}", testName, buildShouldBeSuccessful, testResult));
+ Assert.That (!buildShouldBeSuccessful || !testResult.BuildResult.HasMessage (2006), Is.True, string.Format ("{0} - XM45 had MM2006 state {1} not match expected\n{2}", testName, buildShouldBeSuccessful, testResult));
if (processBuildOutput is not null)
- Assert.IsTrue (processBuildOutput (testResult.BuildResult), string.Format ("{0} - Mobile - We did not see our expected item in the build output: {1}", testName, libraryName));
+ Assert.That (processBuildOutput (testResult.BuildResult), Is.True, string.Format ("{0} - Mobile - We did not see our expected item in the build output: {1}", testName, libraryName));
string xm45BundlePath = Path.Combine (tmpDir, "bin/Debug/XM45Example.app/Contents/MonoBundle/");
if (libraryName is not null)
- Assert.IsTrue (Directory.GetFiles (xm45BundlePath).Any (x => x.Contains (libraryName) == !libraryShouldNotBeCopied), string.Format ("{0} - XM45 - We did not pull in native lib: {1}", testName, libraryName));
+ Assert.That (Directory.GetFiles (xm45BundlePath).Any (x => x.Contains (libraryName) == !libraryShouldNotBeCopied), Is.True, string.Format ("{0} - XM45 - We did not pull in native lib: {1}", testName, libraryName));
}
[Test]
@@ -94,11 +94,11 @@ public void Unified_WithNativeReferences_InMainProjectWorks ()
test.ItemGroup = CreateSingleNativeRef ("/Library/Frameworks/iTunesLibrary.framework", "Framework");
NativeReferenceTestCore (tmpDir, test, "Unified_WithNativeReferences_InMainProjectWorks - Framework", null, true);
- Assert.True (Directory.Exists (Path.Combine (tmpDir, "bin/Debug/UnifiedExample.app/Contents/Frameworks/iTunesLibrary.framework")));
+ Assert.That (Directory.Exists (Path.Combine (tmpDir, "bin/Debug/UnifiedExample.app/Contents/Frameworks/iTunesLibrary.framework")), Is.True);
string binaryPath = Path.Combine (tmpDir, "bin/Debug/UnifiedExample.app/Contents/MacOS/UnifiedExample");
string otoolText = TI.RunAndAssert ("/usr/bin/otool", new [] { "-l", binaryPath }, "Unified_WithNativeReferences_InMainProjectWorks - rpath");
- Assert.True (otoolText.Contains ("path @loader_path/../Frameworks"));
+ Assert.That (otoolText.Contains ("path @loader_path/../Frameworks"), Is.True);
});
}
@@ -110,7 +110,7 @@ public void Unified_WithStaticNativeRef_ClangIncludesOurStaticLib ()
NativeReferenceTestCore (tmpDir, test, "Unified_WithNativeReferences_InMainProjectWorks - Static", null, true, false, s => {
var clangLines = s.BuildOutputLines.Where (x => x.Contains ("usr/bin/clang"));
var staticLib = clangLines.Where (x => x.Contains ("SimpleClassStatic.a"));
- Assert.That (staticLib, Is.Not.Empty, "SimpleClassStatic.a:\n\t{0}", string.Join ("\n\t", clangLines));
+ Assert.That (staticLib, Is.Not.Empty, $"SimpleClassStatic.a:\n\t{string.Join ("\n\t", clangLines)}");
return true;
});
});
@@ -204,7 +204,7 @@ public void ReferenceNativeRefNoCodeUsage_ShouldStillCopy ()
};
var log = TI.TestUnifiedExecutable (test);
Console.WriteLine (log.BuildResult);
- Assert.True (File.Exists (Path.Combine (tmpDir, "bin/Debug/XM45Example.app/Contents/MonoBundle/libintl.dylib")));
+ Assert.That (File.Exists (Path.Combine (tmpDir, "bin/Debug/XM45Example.app/Contents/MonoBundle/libintl.dylib")), Is.True);
});
}
}
diff --git a/tests/mmptest/src/PackageReferenceTests.cs b/tests/mmptest/src/PackageReferenceTests.cs
index 3727a05c4218..08910ad2df69 100644
--- a/tests/mmptest/src/PackageReferenceTests.cs
+++ b/tests/mmptest/src/PackageReferenceTests.cs
@@ -48,7 +48,7 @@ public void SatellitesFromNuget (bool full)
TI.BuildProject (project);
var appDir = Path.Combine (tmpDir, "bin", "Debug", full ? "XM45Example.app" : "UnifiedExample.app");
- Assert.True (File.Exists (Path.Combine (appDir, "Contents", "MonoBundle", "fr", "Humanizer.resources.dll")), "fr");
+ Assert.That (File.Exists (Path.Combine (appDir, "Contents", "MonoBundle", "fr", "Humanizer.resources.dll")), Is.True, "fr");
});
}
diff --git a/tests/mmptest/src/RegistrarTests.cs b/tests/mmptest/src/RegistrarTests.cs
index 46ec1838db08..ab50aab06c48 100644
--- a/tests/mmptest/src/RegistrarTests.cs
+++ b/tests/mmptest/src/RegistrarTests.cs
@@ -19,7 +19,7 @@ public void SmokeTest (bool full, string arch)
};
var output = TI.TestUnifiedExecutable (test).RunOutput;
- Assert.IsTrue (!output.Contains ("Could not register the assembly"), "Could not register the assembly errors found:\n" + output);
+ Assert.That (!output.Contains ("Could not register the assembly"), Is.True, "Could not register the assembly errors found:\n" + output);
});
}
diff --git a/tests/mmptest/src/System.ServiceModel/Net45.cs b/tests/mmptest/src/System.ServiceModel/Net45.cs
index 7d3ac40f7733..f54e7c0e1100 100644
--- a/tests/mmptest/src/System.ServiceModel/Net45.cs
+++ b/tests/mmptest/src/System.ServiceModel/Net45.cs
@@ -50,12 +50,12 @@ public void ServiceModelShouldCreateCommunicationException ()
TI.BuildProject (testFolder + "/ServiceModel_Test.csproj");
TI.RunAndAssert (testFolder + "/bin/Debug/ServiceModel_Test.app/Contents/MacOS/ServiceModel_Test", Array.Empty (), "Run");
- Assert.True (File.Exists (testResults));
+ Assert.That (File.Exists (testResults), Is.True);
using (TextReader reader = File.OpenText (testResults)) {
var output = reader.ReadLine ();
- Assert.AreEqual ("Test Passed: System.ServiceModel.CommunicationException: System error.", output);
+ Assert.That (output, Is.EqualTo ("Test Passed: System.ServiceModel.CommunicationException: System error."));
}
File.Delete (testResults);
diff --git a/tests/mmptest/src/TargetFrameworkDetectionTests.cs b/tests/mmptest/src/TargetFrameworkDetectionTests.cs
index 0755ef29a510..9559a08ccaf5 100644
--- a/tests/mmptest/src/TargetFrameworkDetectionTests.cs
+++ b/tests/mmptest/src/TargetFrameworkDetectionTests.cs
@@ -70,7 +70,7 @@ public void LongProfileStrings_SelectCorrectProfile ()
bool mobile = targetProfile.Profile == "Mobile";
string referenceLine = mmpOutput.Split (Environment.NewLine.ToCharArray ()).First (x => x.StartsWith ("Added assembly ", StringComparison.Ordinal) && x.Contains ("Xamarin.Mac.dll"));
- Assert.True (referenceLine.Contains ("mobile") == mobile, "Selected Reference Line Unexpected: {0} with {1}", referenceLine, targetProfile);
+ Assert.That (referenceLine.Contains ("mobile") == mobile, Is.True, $"Selected Reference Line Unexpected: {referenceLine} with {targetProfile}");
}
});
}
@@ -83,7 +83,7 @@ public void LongProfileStrings_ErrorsWhenWrongXMPassedToRightProfile ()
string libPath = CreateTestExe (tmpDir);
var args = GetTestMMPInvocation (tmpDir, libPath, targetProfile, false);
string buildResults = TI.RunAndAssert (MMPPath, args, "mmp invoke with wrong XM", shouldFail: true);
- Assert.IsTrue (buildResults.Contains ("1407"), "Did not contains 1407 error expected");
+ Assert.That (buildResults.Contains ("1407"), Is.True, "Did not contains 1407 error expected");
}
});
}
diff --git a/tests/mmptest/src/TargetFrameworkMutateTests.cs b/tests/mmptest/src/TargetFrameworkMutateTests.cs
index 11bfe9ecc256..fb9acfb5a9c2 100644
--- a/tests/mmptest/src/TargetFrameworkMutateTests.cs
+++ b/tests/mmptest/src/TargetFrameworkMutateTests.cs
@@ -26,7 +26,7 @@ public void ShouldNotMutateWithoutOptInFlag (bool xm45)
};
var buildOutput = TI.TestUnifiedExecutable (test).BuildResult;
string standardTFI = xm45 ? ".NETFramework" : "Xamarin.Mac";
- Assert.True (MatchesTFI (standardTFI, buildOutput), $"Build did not have expected TFI.");
+ Assert.That (MatchesTFI (standardTFI, buildOutput), Is.True, $"Build did not have expected TFI.");
});
}
@@ -36,7 +36,7 @@ public void ShouldNotMutateModernWithOptInFlag ()
MMPTests.RunMMPTest (tmpDir => {
TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) { CSProjConfig = MigrateCSProjTag };
var buildOutput = TI.TestUnifiedExecutable (test).BuildResult;
- Assert.True (MatchesTFI ("Xamarin.Mac", buildOutput), $"Build did not have expected TFI.");
+ Assert.That (MatchesTFI ("Xamarin.Mac", buildOutput), Is.True, $"Build did not have expected TFI.");
});
}
@@ -49,7 +49,7 @@ public void ShouldMutateFullWithOptInFlag ()
CSProjConfig = MigrateCSProjTag
};
var buildOutput = TI.TestUnifiedExecutable (test).BuildResult;
- Assert.True (MatchesTFI ("Xamarin.Mac.NET", buildOutput), $"Build did not have expected TFI.");
+ Assert.That (MatchesTFI ("Xamarin.Mac.NET", buildOutput), Is.True, $"Build did not have expected TFI.");
});
}
}
diff --git a/tests/mmptest/src/Unified45.cs b/tests/mmptest/src/Unified45.cs
index f8caafcabfb8..354ba35c3b88 100644
--- a/tests/mmptest/src/Unified45.cs
+++ b/tests/mmptest/src/Unified45.cs
@@ -20,12 +20,12 @@ public void ProtobufShouldSerializeAndDeserialize ()
TI.BuildProject (testFolder + "/Protobuf_Test.csproj");
TI.RunAndAssert (testFolder + "/bin/Debug/Protobuf_Test.app/Contents/MacOS/Protobuf_Test", Array.Empty (), "Run");
- Assert.True (File.Exists (testResults));
+ Assert.That (File.Exists (testResults), Is.True);
using (TextReader reader = File.OpenText (testResults)) {
var output = reader.ReadLine ();
- Assert.AreEqual ("Test Passed", output);
+ Assert.That (output, Is.EqualTo ("Test Passed"));
}
File.Delete (testResults);
@@ -52,12 +52,12 @@ public void BasicPCLTest ()
TI.BuildProject (testFolder + "/BasicPCLTest.csproj");
TI.RunAndAssert (testFolder + "/bin/Debug/BasicPCLTest.app/Contents/MacOS/BasicPCLTest", Array.Empty (), "Run");
- Assert.True (File.Exists (testResults));
+ Assert.That (File.Exists (testResults), Is.True);
using (TextReader reader = File.OpenText (testResults)) {
var output = reader.ReadToEnd ();
- Assert.AreEqual ("{\n \"MyArray\": [\n \"Manual text\",\n \"2000-05-23T00:00:00\"\n ]\n}\n", output);
+ Assert.That (output, Is.EqualTo ("{\n \"MyArray\": [\n \"Manual text\",\n \"2000-05-23T00:00:00\"\n ]\n}\n"));
}
File.Delete (testResults);
diff --git a/tests/mmptest/src/aot.cs b/tests/mmptest/src/aot.cs
index daee51224697..19bc06b25041 100644
--- a/tests/mmptest/src/aot.cs
+++ b/tests/mmptest/src/aot.cs
@@ -63,7 +63,7 @@ int OnRunCommand (string path, IList args, Dictionary en
{
commandsRun.Add (Tuple.Create> (path, args));
if (path != AOTCompiler.StripCommand) {
- Assert.AreEqual (TestRootDir, env ["MONO_PATH"], "MONO_PATH should be set to our expected value");
+ Assert.That (env ["MONO_PATH"], Is.EqualTo (TestRootDir), "MONO_PATH should be set to our expected value");
}
return 0;
}
@@ -93,22 +93,22 @@ List GetFiledAOTed (AOTCompilerType compilerType = AOTCompilerType.Bundl
var argParts = command.Item2;
const string aotArg = "--aot=";
const string tripleArg = "mtriple=";
- Assert.IsTrue (argParts [0].StartsWith (aotArg), $"First arg should be {aotArg}");
+ Assert.That (argParts [0].StartsWith (aotArg), Is.True, $"First arg should be {aotArg}");
var aotParts = argParts [0].Substring (aotArg.Length).Split (new char [] { ',' });
- Assert.IsTrue (aotParts [0].StartsWith (tripleArg), $"Aot first argument should be {tripleArg}triple");
+ Assert.That (aotParts [0].StartsWith (tripleArg), Is.True, $"Aot first argument should be {tripleArg}triple");
var triple = aotParts [0].Substring (tripleArg.Length);
- Assert.IsTrue (Enum.TryParse (triple, true, out Abi currAbi), "Triple does not represent a valid abi");
+ Assert.That (Enum.TryParse (triple, true, out Abi currAbi), Is.True, "Triple does not represent a valid abi");
- Assert.IsTrue (command.Item1.EndsWith (GetExpectedMonoCommand (compilerType, currAbi)), "Unexpected command: " + command.Item1);
+ Assert.That (command.Item1.EndsWith (GetExpectedMonoCommand (compilerType, currAbi)), Is.True, "Unexpected command: " + command.Item1);
if (kind == AOTKind.Hybrid)
- Assert.AreEqual (aotParts [1], "hybrid", "Aot arg should contain hybrid");
+ Assert.That ("hybrid", Is.EqualTo (aotParts [1]), "Aot arg should contain hybrid");
else if (aotParts.Length > 1)
- Assert.AreNotEqual (aotParts [1], "hybrid", "Aot arg should not contain hybrid");
+ Assert.That ("hybrid", Is.Not.EqualTo (aotParts [1]), "Aot arg should not contain hybrid");
if (isModern)
- Assert.AreEqual (argParts [1], "--runtime=mobile", "Second arg should be --runtime=mobile");
+ Assert.That ("--runtime=mobile", Is.EqualTo (argParts [1]), "Second arg should be --runtime=mobile");
else
- Assert.AreNotEqual (argParts [1], "--runtime=mobile", "Second arg should not be --runtime=mobile");
+ Assert.That ("--runtime=mobile", Is.Not.EqualTo (argParts [1]), "Second arg should not be --runtime=mobile");
var fileName = command.Item2 [1];
@@ -131,8 +131,8 @@ void AssertFilesStripped (IEnumerable expectedFiles)
Func getErrorDetails = () => $"\n {FormatDebugList (filesStripped)} \nvs\n {FormatDebugList (expectedFiles)}\n{AllCommandsRun}";
- Assert.AreEqual (filesStripped.Count (), expectedFiles.Count (), "Different number of files stripped than expected: " + getErrorDetails ());
- Assert.IsTrue (filesStripped.All (x => expectedFiles.Contains (x)), "Different files stripped than expected: " + getErrorDetails ());
+ Assert.That (expectedFiles.Count (), Is.EqualTo (filesStripped.Count ()), "Different number of files stripped than expected: " + getErrorDetails ());
+ Assert.That (filesStripped.All (x => expectedFiles.Contains (x)), Is.True, "Different files stripped than expected: " + getErrorDetails ());
}
string AllCommandsRun => "\nCommands Run:\n\t" + String.Join ("\n\t", commandsRun.Select (x => $"{x.Item1} {x.Item2}"));
@@ -144,8 +144,8 @@ void AssertFilesAOTed (IEnumerable expectedFiles, AOTCompilerType compil
Func getErrorDetails = () => $"\n {FormatDebugList (filesAOTed)} \nvs\n {FormatDebugList (expectedFiles)}\n{AllCommandsRun}";
- Assert.AreEqual (filesAOTed.Count, expectedFiles.Count () * GetValidAbis (compilerType).Count (), "Different number of files AOT than expected: " + getErrorDetails ());
- Assert.IsTrue (filesAOTed.All (x => expectedFiles.Contains (x)), "Different files AOT than expected: " + getErrorDetails ());
+ Assert.That (expectedFiles.Count () * GetValidAbis (compilerType).Count (), Is.EqualTo (filesAOTed.Count), "Different number of files AOT than expected: " + getErrorDetails ());
+ Assert.That (filesAOTed.All (x => expectedFiles.Contains (x)), Is.True, "Different files AOT than expected: " + getErrorDetails ());
}
void AssertThrowErrorWithCode (Action action, int code)
@@ -153,13 +153,13 @@ void AssertThrowErrorWithCode (Action action, int code)
try {
action ();
} catch (ProductException e) {
- Assert.AreEqual (e.Code, code, $"Got code {e.Code} but expected {code}");
+ Assert.That (code, Is.EqualTo (e.Code), $"Got code {e.Code} but expected {code}");
return;
} catch (AggregateException e) {
- Assert.AreEqual (e.InnerExceptions.Count, 1, "Got AggregateException but more than one exception");
+ Assert.That (1, Is.EqualTo (e.InnerExceptions.Count), "Got AggregateException but more than one exception");
ProductException innerException = e.InnerExceptions [0] as ProductException;
- Assert.IsNotNull (innerException, "Got AggregateException but inner not ProductException");
- Assert.AreEqual (innerException.Code, code, $"Got code {innerException.Code} but expected {code}");
+ Assert.That (innerException, Is.Not.Null, "Got AggregateException but inner not ProductException");
+ Assert.That (code, Is.EqualTo (innerException.Code), $"Got code {innerException.Code} but expected {code}");
return;
}
Assert.Fail ($"We should have thrown ProductException with code: {code}");
@@ -188,7 +188,7 @@ void AssertThrowErrorWithCode (Action action, int code)
public void ParsingNone_DoesNoAOT ()
{
var options = new AOTOptions ("none");
- Assert.IsFalse (options.IsAOT, "Parsing none should not be IsAOT");
+ Assert.That (options.IsAOT, Is.False, "Parsing none should not be IsAOT");
AssertThrowErrorWithCode (() => Compile (options, new TestFileEnumerator (FullAppFileList)), 99);
}
@@ -196,7 +196,7 @@ public void ParsingNone_DoesNoAOT ()
public void All_AOTAllFiles ()
{
var options = new AOTOptions ("all");
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
Compile (options, new TestFileEnumerator (FullAppFileList));
@@ -208,7 +208,7 @@ public void All_AOTAllFiles ()
public void Core_ParsingJustCoreFiles ()
{
var options = new AOTOptions ("core");
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
Compile (options, new TestFileEnumerator (FullAppFileList));
@@ -219,7 +219,7 @@ public void Core_ParsingJustCoreFiles ()
public void SDK_ParsingJustSDKFiles ()
{
var options = new AOTOptions ("sdk");
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
Compile (options, new TestFileEnumerator (FullAppFileList));
@@ -230,7 +230,7 @@ public void SDK_ParsingJustSDKFiles ()
public void ExplicitAssembly_JustAOTExplicitFile ()
{
var options = new AOTOptions ("+System.dll");
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
Compile (options, new TestFileEnumerator (FullAppFileList));
@@ -241,7 +241,7 @@ public void ExplicitAssembly_JustAOTExplicitFile ()
public void CoreWithInclusionAndSubtraction ()
{
var options = new AOTOptions ("core,+Foo.dll,-Xamarin.Mac.dll");
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
string [] testFiles = {
"Foo.dll", "Foo Bar.exe", "libMonoPosixHelper.dylib", "mscorlib.dll", "Xamarin.Mac.dll", "System.dll"
@@ -255,7 +255,7 @@ public void CoreWithInclusionAndSubtraction ()
public void CoreWithFullPath_GivesFullPathCommands ()
{
var options = new AOTOptions ("core,-Xamarin.Mac.dll");
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
Compile (options, new TestFileEnumerator (FullAppFileList.Select (x => TestRootDir + x)));
@@ -266,7 +266,7 @@ public void CoreWithFullPath_GivesFullPathCommands ()
public void ExplicitNegativeFileWithNonExistantFiles_ThrowError ()
{
var options = new AOTOptions ("core,-NonExistant.dll");
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
AssertThrowErrorWithCode (() => Compile (options, new TestFileEnumerator (FullAppFileList)), 3010);
}
@@ -275,7 +275,7 @@ public void ExplicitNegativeFileWithNonExistantFiles_ThrowError ()
public void ExplicitPositiveFileWithNonExistantFiles_ThrowError ()
{
var options = new AOTOptions ("core,+NonExistant.dll");
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
AssertThrowErrorWithCode (() => Compile (options, new TestFileEnumerator (FullAppFileList)), 3009);
}
@@ -284,7 +284,7 @@ public void ExplicitPositiveFileWithNonExistantFiles_ThrowError ()
public void ExplicitNegativeWithNoAssemblies_ShouldNoOp ()
{
var options = new AOTOptions ("-System.dll");
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
Compile (options, new TestFileEnumerator (FullAppFileList));
AssertFilesAOTed (new string [] { });
@@ -311,7 +311,7 @@ public void DifferentMonoTypes_ShouldInvokeCorrectMono ()
foreach (var compilerType in new List () { AOTCompilerType.Bundled64, AOTCompilerType.System64 }) {
ClearCommandsRun ();
var options = new AOTOptions ("sdk");
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
Compile (options, new TestFileEnumerator (FullAppFileList), compilerType);
@@ -325,8 +325,8 @@ public void PipeFileName_ShouldNotHybridCompiler ()
foreach (var testCase in new string [] { "+|hybrid.dll", "core,+|hybrid.dll,-Xamarin.Mac.dll" }) {
ClearCommandsRun ();
var options = new AOTOptions (testCase);
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
- Assert.IsFalse (options.IsHybridAOT, "Should not be IsHybridAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
+ Assert.That (options.IsHybridAOT, Is.False, "Should not be IsHybridAOT");
Compile (options, new TestFileEnumerator (new string [] { "|hybrid.dll", "Xamarin.Mac.dll" }));
AssertFilesAOTed (new string [] { "|hybrid.dll" });
@@ -348,8 +348,8 @@ public void InvalidHybridOptions_ShouldThrow ()
public void HybridOption_ShouldInvokeHybridCompiler ()
{
var options = new AOTOptions ("all|hybrid");
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
- Assert.IsTrue (options.IsHybridAOT, "Should be IsHybridAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
+ Assert.That (options.IsHybridAOT, Is.True, "Should be IsHybridAOT");
Compile (options, new TestFileEnumerator (FullAppFileList));
@@ -403,7 +403,7 @@ public void HybridOption_MustAlsoHaveAll_ThrowsIfNot ()
public void All_AOTAllFiles_Modern ()
{
var options = new AOTOptions ("all");
- Assert.IsTrue (options.IsAOT, "Should be IsAOT");
+ Assert.That (options.IsAOT, Is.True, "Should be IsAOT");
Compile (options, new TestFileEnumerator (FullAppFileList), isModern: true);
diff --git a/tests/monotouch-test/ARKit/ARAnchorTest.cs b/tests/monotouch-test/ARKit/ARAnchorTest.cs
index 567a7638839d..435fb2c94317 100644
--- a/tests/monotouch-test/ARKit/ARAnchorTest.cs
+++ b/tests/monotouch-test/ARKit/ARAnchorTest.cs
@@ -32,7 +32,7 @@ public void Setup ()
public void MarshallingTest ()
{
var faceAnchor = new ARAnchor ("My Anchor", MatrixFloat4x4.Identity);
- Assert.AreEqual (MatrixFloat4x4.Identity, faceAnchor.Transform, "Transform");
+ Assert.That (faceAnchor.Transform, Is.EqualTo (MatrixFloat4x4.Identity), "Transform");
}
}
}
diff --git a/tests/monotouch-test/ARKit/ARConfigurationTest.cs b/tests/monotouch-test/ARKit/ARConfigurationTest.cs
index 567cf41d6182..a2f03498a874 100644
--- a/tests/monotouch-test/ARKit/ARConfigurationTest.cs
+++ b/tests/monotouch-test/ARKit/ARConfigurationTest.cs
@@ -21,17 +21,17 @@ public void Setup ()
[Test]
public void GetSupportedVideoFormats_9_3 ()
{
- Assert.NotNull (ARWorldTrackingConfiguration.GetSupportedVideoFormats (), "ARWorldTrackingConfiguration");
- Assert.NotNull (AROrientationTrackingConfiguration.GetSupportedVideoFormats (), "AROrientationTrackingConfiguration");
- Assert.NotNull (ARFaceTrackingConfiguration.GetSupportedVideoFormats (), "ARFaceTrackingConfiguration");
+ Assert.That (ARWorldTrackingConfiguration.GetSupportedVideoFormats (), Is.Not.Null, "ARWorldTrackingConfiguration");
+ Assert.That (AROrientationTrackingConfiguration.GetSupportedVideoFormats (), Is.Not.Null, "AROrientationTrackingConfiguration");
+ Assert.That (ARFaceTrackingConfiguration.GetSupportedVideoFormats (), Is.Not.Null, "ARFaceTrackingConfiguration");
}
[Test]
public void GetSupportedVideoFormats_10_0 ()
{
TestRuntime.AssertXcodeVersion (10, 0);
- Assert.NotNull (ARImageTrackingConfiguration.GetSupportedVideoFormats (), "ARImageTrackingConfiguration");
- Assert.NotNull (ARObjectScanningConfiguration.GetSupportedVideoFormats (), "ARObjectScanningConfiguration");
+ Assert.That (ARImageTrackingConfiguration.GetSupportedVideoFormats (), Is.Not.Null, "ARImageTrackingConfiguration");
+ Assert.That (ARObjectScanningConfiguration.GetSupportedVideoFormats (), Is.Not.Null, "ARObjectScanningConfiguration");
}
}
}
diff --git a/tests/monotouch-test/ARKit/AREnvironmentProbeAnchorTest.cs b/tests/monotouch-test/ARKit/AREnvironmentProbeAnchorTest.cs
index 186da1aebbc3..9b7e0923eaee 100644
--- a/tests/monotouch-test/ARKit/AREnvironmentProbeAnchorTest.cs
+++ b/tests/monotouch-test/ARKit/AREnvironmentProbeAnchorTest.cs
@@ -33,20 +33,20 @@ public void Setup ()
public void MarshallingTest ()
{
var probeAnchor = new AREnvironmentProbeAnchor (MatrixFloat4x4.Identity, new VectorFloat3 (1, 1, 1));
- Assert.AreEqual (MatrixFloat4x4.Identity, probeAnchor.Transform, "Transform");
+ Assert.That (probeAnchor.Transform, Is.EqualTo (MatrixFloat4x4.Identity), "Transform");
// broken since Xcode 12 on simulator (only), fixed in simulator in Xcode 14
if ((Runtime.Arch == Arch.DEVICE) || !TestRuntime.CheckXcodeVersion (12, 0) || TestRuntime.CheckXcodeVersion (14, 0))
- Assert.AreEqual (new VectorFloat3 (1, 1, 1), probeAnchor.Extent, "Extent");
+ Assert.That (probeAnchor.Extent, Is.EqualTo (new VectorFloat3 (1, 1, 1)), "Extent");
}
[Test]
public void MarshallingTest2 ()
{
var probeAnchorWithName = new AREnvironmentProbeAnchor ("My Anchor", MatrixFloat4x4.Identity, new VectorFloat3 (1, 1, 1));
- Assert.AreEqual (MatrixFloat4x4.Identity, probeAnchorWithName.Transform, "Transform");
+ Assert.That (probeAnchorWithName.Transform, Is.EqualTo (MatrixFloat4x4.Identity), "Transform");
// broken since Xcode 12 on simulator (only), fixed in simulator in Xcode 14
if ((Runtime.Arch == Arch.DEVICE) || !TestRuntime.CheckXcodeVersion (12, 0) || TestRuntime.CheckXcodeVersion (14, 0))
- Assert.AreEqual (new VectorFloat3 (1, 1, 1), probeAnchorWithName.Extent, "Extent");
+ Assert.That (probeAnchorWithName.Extent, Is.EqualTo (new VectorFloat3 (1, 1, 1)), "Extent");
}
}
}
diff --git a/tests/monotouch-test/ARKit/ARFaceGeometryTest.cs b/tests/monotouch-test/ARKit/ARFaceGeometryTest.cs
index b69229252223..9f07f331ec52 100644
--- a/tests/monotouch-test/ARKit/ARFaceGeometryTest.cs
+++ b/tests/monotouch-test/ARKit/ARFaceGeometryTest.cs
@@ -93,8 +93,8 @@ public void VerticesTest ()
{
var face = new ARFaceGeometryPoker ();
var vertices = face.GetVertices ();
- Assert.AreEqual (new VectorFloat3 (1, 2, 3), vertices [0], "Vertex 1");
- Assert.AreEqual (new VectorFloat3 (4, 5, 6), vertices [1], "Vertex 2");
+ Assert.That (vertices [0], Is.EqualTo (new VectorFloat3 (1, 2, 3)), "Vertex 1");
+ Assert.That (vertices [1], Is.EqualTo (new VectorFloat3 (4, 5, 6)), "Vertex 2");
}
[Test]
@@ -102,15 +102,15 @@ public void TextureCoordinatesTest ()
{
var face = new ARFaceGeometryPoker ();
var textureCoordinates = face.GetTextureCoordinates ();
- Assert.AreEqual (new VectorFloat2 (1, 2), textureCoordinates [0], "Texture Coordinates 1");
- Assert.AreEqual (new VectorFloat2 (3, 4), textureCoordinates [1], "Texture Coordinates 2");
+ Assert.That (textureCoordinates [0], Is.EqualTo (new VectorFloat2 (1, 2)), "Texture Coordinates 1");
+ Assert.That (textureCoordinates [1], Is.EqualTo (new VectorFloat2 (3, 4)), "Texture Coordinates 2");
}
[Test]
public void TriangleIndicesTest ()
{
var face = new ARFaceGeometryPoker ();
- Assert.AreEqual (new short [] { 1, 2, 3, 4, 5, 6 }, face.GetTriangleIndices ());
+ Assert.That (face.GetTriangleIndices (), Is.EqualTo (new short [] { 1, 2, 3, 4, 5, 6 }));
}
}
}
diff --git a/tests/monotouch-test/ARKit/ARPlaneGeometryTest.cs b/tests/monotouch-test/ARKit/ARPlaneGeometryTest.cs
index 7faf0ea2ae5e..bddb5fb24577 100644
--- a/tests/monotouch-test/ARKit/ARPlaneGeometryTest.cs
+++ b/tests/monotouch-test/ARKit/ARPlaneGeometryTest.cs
@@ -107,8 +107,8 @@ public void VerticesTest ()
{
var face = new ARPlaneGeometryPoker ();
var vertices = face.GetVertices ();
- Assert.AreEqual (new VectorFloat3 (1, 2, 3), vertices [0], "Vertex 1");
- Assert.AreEqual (new VectorFloat3 (4, 5, 6), vertices [1], "Vertex 2");
+ Assert.That (vertices [0], Is.EqualTo (new VectorFloat3 (1, 2, 3)), "Vertex 1");
+ Assert.That (vertices [1], Is.EqualTo (new VectorFloat3 (4, 5, 6)), "Vertex 2");
}
[Test]
@@ -116,15 +116,15 @@ public void TextureCoordinatesTest ()
{
var face = new ARPlaneGeometryPoker ();
var textureCoordinates = face.GetTextureCoordinates ();
- Assert.AreEqual (new VectorFloat2 (1, 2), textureCoordinates [0], "Texture Coordinates 1");
- Assert.AreEqual (new VectorFloat2 (3, 4), textureCoordinates [1], "Texture Coordinates 2");
+ Assert.That (textureCoordinates [0], Is.EqualTo (new VectorFloat2 (1, 2)), "Texture Coordinates 1");
+ Assert.That (textureCoordinates [1], Is.EqualTo (new VectorFloat2 (3, 4)), "Texture Coordinates 2");
}
[Test]
public void TriangleIndicesTest ()
{
var face = new ARPlaneGeometryPoker ();
- Assert.AreEqual (new short [] { 1, 2, 3, 4, 5, 6 }, face.GetTriangleIndices ());
+ Assert.That (face.GetTriangleIndices (), Is.EqualTo (new short [] { 1, 2, 3, 4, 5, 6 }));
}
[Test]
@@ -134,8 +134,8 @@ public void BoundaryVerticesTest ()
var face = new ARPlaneGeometryPoker ();
var boundaryVertices = face.GetBoundaryVertices ();
- Assert.AreEqual (new VectorFloat3 (1, 2, 3), boundaryVertices [0], "Boundary Vertex 1");
- Assert.AreEqual (new VectorFloat3 (4, 5, 6), boundaryVertices [1], "Boundary Vertex 2");
+ Assert.That (boundaryVertices [0], Is.EqualTo (new VectorFloat3 (1, 2, 3)), "Boundary Vertex 1");
+ Assert.That (boundaryVertices [1], Is.EqualTo (new VectorFloat3 (4, 5, 6)), "Boundary Vertex 2");
}
}
}
diff --git a/tests/monotouch-test/ARKit/ARPointCloudTest.cs b/tests/monotouch-test/ARKit/ARPointCloudTest.cs
index f3a1bb31f5e4..ecdf00083b70 100644
--- a/tests/monotouch-test/ARKit/ARPointCloudTest.cs
+++ b/tests/monotouch-test/ARKit/ARPointCloudTest.cs
@@ -83,8 +83,8 @@ public void PointsTest ()
var cloud = new ARPointCloudPoker ();
var points = cloud.Points;
- Assert.AreEqual (new VectorFloat3 (1, 2, 3), cloud.Points [0]);
- Assert.AreEqual (new VectorFloat3 (4, 5, 6), cloud.Points [1]);
+ Assert.That (cloud.Points [0], Is.EqualTo (new VectorFloat3 (1, 2, 3)));
+ Assert.That (cloud.Points [1], Is.EqualTo (new VectorFloat3 (4, 5, 6)));
}
[Test]
@@ -93,8 +93,8 @@ public void IdentifiersTest ()
var cloud = new ARPointCloudPoker ();
var points = cloud.Identifiers;
- Assert.AreEqual (0, cloud.Identifiers [0]);
- Assert.AreEqual (1, cloud.Identifiers [1]);
+ Assert.That (cloud.Identifiers [0], Is.EqualTo (0));
+ Assert.That (cloud.Identifiers [1], Is.EqualTo (1));
}
}
}
diff --git a/tests/monotouch-test/ARKit/ARReferenceObjectTest.cs b/tests/monotouch-test/ARKit/ARReferenceObjectTest.cs
index b4e1e373fbbd..895efaecc744 100644
--- a/tests/monotouch-test/ARKit/ARReferenceObjectTest.cs
+++ b/tests/monotouch-test/ARKit/ARReferenceObjectTest.cs
@@ -35,12 +35,12 @@ public void MarshallingTest ()
TestRuntime.AssertNotSimulator (); // The Objective-C constructor is just stubbed out to return NULL in the simulator, so this test only works on device.
var model3 = new ARReferenceObject (NSUrl.FromFilename ("Model3.arobject"), out NSError error);
- Assert.IsNull (error, "Error");
- Assert.AreEqual ("Model3", model3.Name, "Name");
- Assert.NotNull (model3.Center, "Center");
- Assert.NotNull (model3.Extent, "Extent");
- Assert.NotNull (model3.Scale, "Scale");
- Assert.NotNull (model3.ApplyTransform (MatrixFloat4x4.Identity), "ApplyTransform");
+ Assert.That (error, Is.Null, "Error");
+ Assert.That (model3.Name, Is.EqualTo ("Model3"), "Name");
+ Assert.That (model3.Center, Is.Not.Null, "Center");
+ Assert.That (model3.Extent, Is.Not.Null, "Extent");
+ Assert.That (model3.Scale, Is.Not.Null, "Scale");
+ Assert.That (model3.ApplyTransform (MatrixFloat4x4.Identity), Is.Not.Null, "ApplyTransform");
}
}
}
diff --git a/tests/monotouch-test/ARKit/ARSkeleton2DTest.cs b/tests/monotouch-test/ARKit/ARSkeleton2DTest.cs
index 8155bf910b39..b573b1360e54 100644
--- a/tests/monotouch-test/ARKit/ARSkeleton2DTest.cs
+++ b/tests/monotouch-test/ARKit/ARSkeleton2DTest.cs
@@ -67,8 +67,8 @@ public void JointLandmarksTest ()
var skeleton = new ARSkeleton2DPoker ();
var landmarks = skeleton.JointLandmarks;
- Assert.AreEqual (new Vector2 (1, 2), landmarks [0]);
- Assert.AreEqual (new Vector2 (3, 4), landmarks [1]);
+ Assert.That (landmarks [0], Is.EqualTo (new Vector2 (1, 2)));
+ Assert.That (landmarks [1], Is.EqualTo (new Vector2 (3, 4)));
}
}
}
diff --git a/tests/monotouch-test/ARKit/ARSkeleton3DTest.cs b/tests/monotouch-test/ARKit/ARSkeleton3DTest.cs
index b0c41d273dd0..121ac5c1aee9 100644
--- a/tests/monotouch-test/ARKit/ARSkeleton3DTest.cs
+++ b/tests/monotouch-test/ARKit/ARSkeleton3DTest.cs
@@ -80,8 +80,8 @@ public void JointModelTransformsTest ()
var skeleton = new ARSkeleton3DPoker ();
var landmarks = skeleton.JointModelTransforms;
- Assert.AreEqual (Matrix4.Identity, landmarks [0]);
- Assert.AreEqual (Matrix4.Identity, landmarks [1]);
+ Assert.That (landmarks [0], Is.EqualTo (Matrix4.Identity));
+ Assert.That (landmarks [1], Is.EqualTo (Matrix4.Identity));
}
[Test]
@@ -90,8 +90,8 @@ public void JointLocalTransformsTest ()
var skeleton = new ARSkeleton3DPoker ();
var landmarks = skeleton.JointLocalTransforms;
- Assert.AreEqual (Matrix4.Identity, landmarks [0]);
- Assert.AreEqual (Matrix4.Identity, landmarks [1]);
+ Assert.That (landmarks [0], Is.EqualTo (Matrix4.Identity));
+ Assert.That (landmarks [1], Is.EqualTo (Matrix4.Identity));
}
}
}
diff --git a/tests/monotouch-test/ARKit/ARSkeletonTest.cs b/tests/monotouch-test/ARKit/ARSkeletonTest.cs
index 28d6eddd37c2..527160ead094 100644
--- a/tests/monotouch-test/ARKit/ARSkeletonTest.cs
+++ b/tests/monotouch-test/ARKit/ARSkeletonTest.cs
@@ -21,7 +21,7 @@ public void Setup ()
public void UnknownPointTest ()
{
using (var notKnownPoint = new NSString ("nariz"))
- Assert.IsNull (ARSkeleton.CreateJointName (notKnownPoint));
+ Assert.That (ARSkeleton.CreateJointName (notKnownPoint), Is.Null);
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVAssetImageGeneratorTest.cs b/tests/monotouch-test/AVFoundation/AVAssetImageGeneratorTest.cs
index 6d3b9c2c035e..38140b3ef032 100644
--- a/tests/monotouch-test/AVFoundation/AVAssetImageGeneratorTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVAssetImageGeneratorTest.cs
@@ -26,11 +26,11 @@ public void Defaults ()
using (NSUrl video_url = NSUrl.FromFilename (video_asset_path))
using (AVAsset video_asset = AVAsset.FromUrl (video_url))
using (AVAssetImageGenerator aig = new AVAssetImageGenerator (video_asset)) {
- Assert.Null (aig.ApertureMode, "ApertureMode");
- Assert.False (aig.AppliesPreferredTrackTransform, "AppliesPreferredTrackTransform");
+ Assert.That (aig.ApertureMode, Is.Null, "ApertureMode");
+ Assert.That (aig.AppliesPreferredTrackTransform, Is.False, "AppliesPreferredTrackTransform");
Assert.That (aig.MaximumSize, Is.EqualTo (CGSize.Empty), "MaximumSize");
- Assert.True (aig.RequestedTimeToleranceAfter.IsPositiveInfinity, "RequestedTimeToleranceAfter");
- Assert.True (aig.RequestedTimeToleranceBefore.IsPositiveInfinity, "RequestedTimeToleranceBefore");
+ Assert.That (aig.RequestedTimeToleranceAfter.IsPositiveInfinity, Is.True, "RequestedTimeToleranceAfter");
+ Assert.That (aig.RequestedTimeToleranceBefore.IsPositiveInfinity, Is.True, "RequestedTimeToleranceBefore");
}
}
@@ -42,7 +42,7 @@ public void AppliesPreferredTrackTransform ()
using (AVAssetImageGenerator aig = new AVAssetImageGenerator (video_asset)) {
// setter was missing see https://bugzilla.xamarin.com/show_bug.cgi?id=5216
aig.AppliesPreferredTrackTransform = true;
- Assert.True (aig.AppliesPreferredTrackTransform, "AppliesPreferredTrackTransform");
+ Assert.That (aig.AppliesPreferredTrackTransform, Is.True, "AppliesPreferredTrackTransform");
}
}
@@ -57,9 +57,9 @@ public void CopyCGImageAtTime ()
CMTime actual;
NSError error;
var img = aig.CopyCGImageAtTime (CMTime.Zero, out actual, out error);
- Assert.NotNull (img, "CopyCGImageAtTime");
- Assert.False (actual.IsInvalid, "actual");
- Assert.Null (error, "error");
+ Assert.That (img, Is.Not.Null, "CopyCGImageAtTime");
+ Assert.That (actual.IsInvalid, Is.False, "actual");
+ Assert.That (error, Is.Null, "error");
}
}
@@ -74,9 +74,9 @@ public void CopyCGImageAtTime_Invalid ()
CMTime actual;
NSError error;
var img = aig.CopyCGImageAtTime (CMTime.Zero, out actual, out error);
- Assert.Null (img, "missing");
- Assert.True (actual.IsInvalid, "actual");
- Assert.NotNull (error, "error");
+ Assert.That (img, Is.Null, "missing");
+ Assert.That (actual.IsInvalid, Is.True, "actual");
+ Assert.That (error, Is.Not.Null, "error");
}
}
@@ -107,8 +107,8 @@ public void GenerateCGImagesAsynchronously ()
IsBackground = true,
};
thread.Start ();
- Assert.True (mre.WaitOne (2000), "wait");
- Assert.True (handled, "handled");
+ Assert.That (mre.WaitOne (2000), Is.True, "wait");
+ Assert.That (handled, Is.True, "handled");
}
void handler (CMTime requestedTime, IntPtr imageRef, CMTime actualTime, AVAssetImageGeneratorResult result, NSError error)
diff --git a/tests/monotouch-test/AVFoundation/AVAudioConverterPrimeInfoTest.cs b/tests/monotouch-test/AVFoundation/AVAudioConverterPrimeInfoTest.cs
index b789af1280ed..ddf05a857591 100644
--- a/tests/monotouch-test/AVFoundation/AVAudioConverterPrimeInfoTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVAudioConverterPrimeInfoTest.cs
@@ -13,8 +13,8 @@ public void ConstructorTest ()
var info = new AVAudioConverterPrimeInfo (leading, trailing);
- Assert.AreEqual (leading, info.LeadingFrames, "Wrong LeadingFrames value.");
- Assert.AreEqual (trailing, info.TrailingFrames, "Wrong TrailingFrames value.");
+ Assert.That (info.LeadingFrames, Is.EqualTo (leading), "Wrong LeadingFrames value.");
+ Assert.That (info.TrailingFrames, Is.EqualTo (trailing), "Wrong TrailingFrames value.");
}
[Test]
@@ -25,9 +25,9 @@ public void AreEqualTrueTest ()
var info1 = new AVAudioConverterPrimeInfo (leading, trainling);
var info2 = new AVAudioConverterPrimeInfo (leading, trainling);
- Assert.True (info1 == info2, "info1 == info2");
- Assert.True (info1.Equals (info2), "info1.Equals (info2)");
- Assert.False (info1 != info2, "info1 != info2");
+ Assert.That (info1 == info2, Is.True, "info1 == info2");
+ Assert.That (info1.Equals (info2), Is.True, "info1.Equals (info2)");
+ Assert.That (info1 != info2, Is.False, "info1 != info2");
}
[Test]
@@ -35,9 +35,9 @@ public void AreEqualFalseTest ()
{
var info1 = new AVAudioConverterPrimeInfo (2, 30);
var info2 = new AVAudioConverterPrimeInfo (info1.LeadingFrames * 2, info1.TrailingFrames * 2);
- Assert.False (info1 == info2, "info1 == info2");
- Assert.False (info1.Equals (info2), "info1.Equals (info2)");
- Assert.True (info1 != info2, "info1 != info2");
+ Assert.That (info1 == info2, Is.False, "info1 == info2");
+ Assert.That (info1.Equals (info2), Is.False, "info1.Equals (info2)");
+ Assert.That (info1 != info2, Is.True, "info1 != info2");
}
[Test]
@@ -45,7 +45,7 @@ public void AreEqualDiffType ()
{
var info = new AVAudioConverterPrimeInfo (2, 20);
var str = new NSString ("Foo");
- Assert.False (info.Equals ((object) str));
+ Assert.That (info.Equals ((object) str), Is.False);
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVAudioFormatTest.cs b/tests/monotouch-test/AVFoundation/AVAudioFormatTest.cs
index f03f7a517c2a..2db586e09aed 100644
--- a/tests/monotouch-test/AVFoundation/AVAudioFormatTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVAudioFormatTest.cs
@@ -25,7 +25,7 @@ public void TestEqualOperatorSameInstace ()
{
using (var format = new AVAudioFormat ())
#pragma warning disable CS1718 // warning CS1718: Comparison made to same variable; did you mean to compare something else?
- Assert.IsTrue (format == format, "format == format");
+ Assert.That (format == format, Is.True, "format == format");
#pragma warning restore
}
@@ -33,12 +33,12 @@ public void TestEqualOperatorSameInstace ()
public void TestEqualOperatorNull ()
{
using (var format = new AVAudioFormat ()) {
- Assert.IsFalse (format == null, "format == null");
- Assert.IsFalse (null == format, "null == format");
+ Assert.That (format == null, Is.False, "format == null");
+ Assert.That (null == format, Is.False, "null == format");
}
using (AVAudioFormat nullFormat = null) {
- Assert.IsTrue (nullFormat == null, "nullFormat == null");
- Assert.IsTrue (null == nullFormat, "null == nullFormat");
+ Assert.That (nullFormat == null, Is.True, "nullFormat == null");
+ Assert.That (null == nullFormat, Is.True, "null == nullFormat");
}
}
@@ -46,12 +46,12 @@ public void TestEqualOperatorNull ()
public void TestNotEqualOperatorNull ()
{
using (var format = new AVAudioFormat ()) {
- Assert.IsTrue (format != null, "format != null");
- Assert.IsTrue (null != format, "null != format");
+ Assert.That (format != null, Is.True, "format != null");
+ Assert.That (null != format, Is.True, "null != format");
}
using (AVAudioFormat nullFormat = null) {
- Assert.IsFalse (nullFormat != null, "nullFormat != null");
- Assert.IsFalse (null != nullFormat, "null != nullFormat");
+ Assert.That (nullFormat != null, Is.False, "nullFormat != null");
+ Assert.That (null != nullFormat, Is.False, "null != nullFormat");
}
}
@@ -61,14 +61,14 @@ public void StreamDescription ()
{
var format = new AVAudioFormat (AVAudioCommonFormat.PCMFloat32, 44100.0, 2, true);
var desc = format.StreamDescription;
- Assert.AreEqual (AudioFormatType.LinearPCM, desc.Format, "Format");
- Assert.AreEqual (AudioFormatFlags.LinearPCMIsFloat | AudioFormatFlags.LinearPCMIsPacked, desc.FormatFlags, "FormatFlags");
- Assert.AreEqual (8, desc.BytesPerPacket, "BytesPerPacket");
- Assert.AreEqual (1, desc.FramesPerPacket, "FramesPerPacket");
- Assert.AreEqual (8, desc.BytesPerFrame, "BytesPerFrame");
- Assert.AreEqual (2, desc.ChannelsPerFrame, "ChannelsPerFrame");
- Assert.AreEqual (32, desc.BitsPerChannel, "BitsPerChannel");
- Assert.AreEqual (0, desc.Reserved, "Reserved");
+ Assert.That (desc.Format, Is.EqualTo (AudioFormatType.LinearPCM), "Format");
+ Assert.That (desc.FormatFlags, Is.EqualTo (AudioFormatFlags.LinearPCMIsFloat | AudioFormatFlags.LinearPCMIsPacked), "FormatFlags");
+ Assert.That (desc.BytesPerPacket, Is.EqualTo (8), "BytesPerPacket");
+ Assert.That (desc.FramesPerPacket, Is.EqualTo (1), "FramesPerPacket");
+ Assert.That (desc.BytesPerFrame, Is.EqualTo (8), "BytesPerFrame");
+ Assert.That (desc.ChannelsPerFrame, Is.EqualTo (2), "ChannelsPerFrame");
+ Assert.That (desc.BitsPerChannel, Is.EqualTo (32), "BitsPerChannel");
+ Assert.That (desc.Reserved, Is.EqualTo (0), "Reserved");
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVAudioSinkNodeTest.cs b/tests/monotouch-test/AVFoundation/AVAudioSinkNodeTest.cs
index e0b19becf97a..09cf580a7f01 100644
--- a/tests/monotouch-test/AVFoundation/AVAudioSinkNodeTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVAudioSinkNodeTest.cs
@@ -61,13 +61,13 @@ void SinkNodeCallbackTest (ManualResetEvent callbackEvent, Func
Assert.Ignore ("The current system doesn't have a microphone.");
session.SetCategory (AVAudioSessionCategory.PlayAndRecord, AVAudioSessionCategoryOptions.DefaultToSpeaker, out var categoryError);
- Assert.IsNull (categoryError, "Category Error");
+ Assert.That (categoryError, Is.Null, "Category Error");
session.SetPreferredSampleRate (48000, out var sampleRateError);
- Assert.IsNull (sampleRateError, "Sample Rate Error");
+ Assert.That (sampleRateError, Is.Null, "Sample Rate Error");
if (session.MaximumInputNumberOfChannels == 0)
Assert.Ignore ("The current system doesn't support any input channels");
session.SetPreferredInputNumberOfChannels (1, out var inputChannelCountError);
- Assert.IsNull (inputChannelCountError, "Input Channel Count Error");
+ Assert.That (inputChannelCountError, Is.Null, "Input Channel Count Error");
session.SetActive (true);
#endif // __MACOS__
@@ -83,8 +83,8 @@ void SinkNodeCallbackTest (ManualResetEvent callbackEvent, Func
engine.Connect (inputNode, sinkNode, inputFormat);
engine.StartAndReturnError (out var error);
- Assert.IsNull (error, "Start error");
- Assert.True (callbackEvent.WaitOne (TimeSpan.FromSeconds (5)), "Called back");
+ Assert.That (error, Is.Null, "Start error");
+ Assert.That (callbackEvent.WaitOne (TimeSpan.FromSeconds (5)), Is.True, "Called back");
} finally {
engine.Stop ();
}
diff --git a/tests/monotouch-test/AVFoundation/AVAudioSourceNodeTest.cs b/tests/monotouch-test/AVFoundation/AVAudioSourceNodeTest.cs
index 34a013101784..81f0ad7c6d62 100644
--- a/tests/monotouch-test/AVFoundation/AVAudioSourceNodeTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVAudioSourceNodeTest.cs
@@ -61,13 +61,13 @@ void SourceNodeCallbackTest (TaskCompletionSource callbackEvent, Func callbackEvent, Func callbackEvent, Func evt)
{
try {
- Assert.AreEqual (1, outputData.Count, "Count");
+ Assert.That (outputData.Count, Is.EqualTo (1), "Count");
Assert.That (((IntPtr) outputData.Handle).ToInt64 (), Is.GreaterThan (1024), "Valid handle");
Assert.That (outputData [0].DataByteSize, Is.GreaterThan (1023), "Valid data size");
Assert.That (outputData [0].NumberChannels, Is.GreaterThan (0), "NumberChannels");
diff --git a/tests/monotouch-test/AVFoundation/AVAudioVoiceProcessingOtherAudioDuckingConfigurationTest.cs b/tests/monotouch-test/AVFoundation/AVAudioVoiceProcessingOtherAudioDuckingConfigurationTest.cs
index d55e05afc0d9..d281ee9181b2 100644
--- a/tests/monotouch-test/AVFoundation/AVAudioVoiceProcessingOtherAudioDuckingConfigurationTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVAudioVoiceProcessingOtherAudioDuckingConfigurationTest.cs
@@ -18,28 +18,28 @@ public class AVAudioVoiceProcessingOtherAudioDuckingConfigurationTest {
public void Properties ()
{
var s = new AVAudioVoiceProcessingOtherAudioDuckingConfiguration ();
- Assert.IsFalse (s.EnableAdvancedDucking, "EnableAdvancedDucking");
- Assert.AreEqual ((AVAudioVoiceProcessingOtherAudioDuckingLevel) 0, s.DuckingLevel, "DuckingLevel");
+ Assert.That (s.EnableAdvancedDucking, Is.False, "EnableAdvancedDucking");
+ Assert.That (s.DuckingLevel, Is.EqualTo ((AVAudioVoiceProcessingOtherAudioDuckingLevel) 0), "DuckingLevel");
s.EnableAdvancedDucking = true;
- Assert.IsTrue (s.EnableAdvancedDucking, "EnableAdvancedDucking 2");
- Assert.AreEqual ((AVAudioVoiceProcessingOtherAudioDuckingLevel) 0, s.DuckingLevel, "DuckingLevel 2");
+ Assert.That (s.EnableAdvancedDucking, Is.True, "EnableAdvancedDucking 2");
+ Assert.That (s.DuckingLevel, Is.EqualTo ((AVAudioVoiceProcessingOtherAudioDuckingLevel) 0), "DuckingLevel 2");
s.EnableAdvancedDucking = false;
- Assert.IsFalse (s.EnableAdvancedDucking, "EnableAdvancedDucking 3");
- Assert.AreEqual ((AVAudioVoiceProcessingOtherAudioDuckingLevel) 0, s.DuckingLevel, "DuckingLevel 3");
+ Assert.That (s.EnableAdvancedDucking, Is.False, "EnableAdvancedDucking 3");
+ Assert.That (s.DuckingLevel, Is.EqualTo ((AVAudioVoiceProcessingOtherAudioDuckingLevel) 0), "DuckingLevel 3");
s.DuckingLevel = AVAudioVoiceProcessingOtherAudioDuckingLevel.Min;
- Assert.IsFalse (s.EnableAdvancedDucking, "EnableAdvancedDucking 4");
- Assert.AreEqual (AVAudioVoiceProcessingOtherAudioDuckingLevel.Min, s.DuckingLevel, "DuckingLevel 4");
+ Assert.That (s.EnableAdvancedDucking, Is.False, "EnableAdvancedDucking 4");
+ Assert.That (s.DuckingLevel, Is.EqualTo (AVAudioVoiceProcessingOtherAudioDuckingLevel.Min), "DuckingLevel 4");
s.DuckingLevel = (AVAudioVoiceProcessingOtherAudioDuckingLevel) 314;
- Assert.IsFalse (s.EnableAdvancedDucking, "EnableAdvancedDucking 5");
- Assert.AreEqual ((AVAudioVoiceProcessingOtherAudioDuckingLevel) 314, s.DuckingLevel, "DuckingLevel 5");
+ Assert.That (s.EnableAdvancedDucking, Is.False, "EnableAdvancedDucking 5");
+ Assert.That (s.DuckingLevel, Is.EqualTo ((AVAudioVoiceProcessingOtherAudioDuckingLevel) 314), "DuckingLevel 5");
s.DuckingLevel = AVAudioVoiceProcessingOtherAudioDuckingLevel.Default;
- Assert.IsFalse (s.EnableAdvancedDucking, "EnableAdvancedDucking 6");
- Assert.AreEqual (AVAudioVoiceProcessingOtherAudioDuckingLevel.Default, s.DuckingLevel, "DuckingLevel 6");
+ Assert.That (s.EnableAdvancedDucking, Is.False, "EnableAdvancedDucking 6");
+ Assert.That (s.DuckingLevel, Is.EqualTo (AVAudioVoiceProcessingOtherAudioDuckingLevel.Default), "DuckingLevel 6");
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVBeatRangeTest.cs b/tests/monotouch-test/AVFoundation/AVBeatRangeTest.cs
index 924989a628f2..c4fcd65791e9 100644
--- a/tests/monotouch-test/AVFoundation/AVBeatRangeTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVBeatRangeTest.cs
@@ -13,8 +13,8 @@ public void ConstructorTest ()
var range = new AVBeatRange (start, length);
- Assert.AreEqual (start, range.Start, "Wrong Start value.");
- Assert.AreEqual (length, range.Length, "Wrong Length value.");
+ Assert.That (range.Start, Is.EqualTo (start), "Wrong Start value.");
+ Assert.That (range.Length, Is.EqualTo (length), "Wrong Length value.");
}
[Test]
@@ -25,9 +25,9 @@ public void AreEqualTrueTest ()
var range1 = new AVBeatRange (start, length);
var range2 = new AVBeatRange (start, length);
- Assert.True (range1 == range2, "range1 == range2");
- Assert.True (range1.Equals (range2), "range1.Equals (range1)");
- Assert.False (range1 != range2, "range1 != range2");
+ Assert.That (range1 == range2, Is.True, "range1 == range2");
+ Assert.That (range1.Equals (range2), Is.True, "range1.Equals (range1)");
+ Assert.That (range1 != range2, Is.False, "range1 != range2");
}
[Test]
@@ -35,9 +35,9 @@ public void AreEqualFalseTest ()
{
var range1 = new AVBeatRange (90, 12);
var range2 = new AVBeatRange (range1.Start * 2, range1.Length * 2);
- Assert.False (range1 == range2, "range1 == range2");
- Assert.False (range1.Equals (range2), "range1.Equals (range2)");
- Assert.True (range1 != range2, "range1 != range2");
+ Assert.That (range1 == range2, Is.False, "range1 == range2");
+ Assert.That (range1.Equals (range2), Is.False, "range1.Equals (range2)");
+ Assert.That (range1 != range2, Is.True, "range1 != range2");
}
[Test]
@@ -45,7 +45,7 @@ public void AreEqualDiffType ()
{
var range = new AVBeatRange (90, 12);
var str = new NSString ("Foo");
- Assert.False (range.Equals ((object) str));
+ Assert.That (range.Equals ((object) str), Is.False);
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVCaptionDimensionTest.cs b/tests/monotouch-test/AVFoundation/AVCaptionDimensionTest.cs
index fec6187991ea..817ca60a2933 100644
--- a/tests/monotouch-test/AVFoundation/AVCaptionDimensionTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVCaptionDimensionTest.cs
@@ -21,8 +21,8 @@ public void CreateTest ()
nfloat val = 10;
var units = AVCaptionUnitsType.Cells;
var dimension = AVCaptionDimension.Create (val, units);
- Assert.AreEqual (val, dimension.Value, "Value");
- Assert.AreEqual (units, dimension.Units);
+ Assert.That (dimension.Value, Is.EqualTo (val), "Value");
+ Assert.That (dimension.Units, Is.EqualTo (units));
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVCaptionPointTest.cs b/tests/monotouch-test/AVFoundation/AVCaptionPointTest.cs
index c0c33c7814bf..5eb878d8e125 100644
--- a/tests/monotouch-test/AVFoundation/AVCaptionPointTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVCaptionPointTest.cs
@@ -23,8 +23,8 @@ public void CreateTest ()
var secondDimension = AVCaptionDimension.Create (val, units);
var point = AVCaptionPoint.Create (firstDimension, secondDimension);
- Assert.AreEqual (val, point.X.Value, "X");
- Assert.AreEqual (val, point.Y.Value, "Y");
+ Assert.That (point.X.Value, Is.EqualTo (val), "X");
+ Assert.That (point.Y.Value, Is.EqualTo (val), "Y");
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVCaptionSizeTest.cs b/tests/monotouch-test/AVFoundation/AVCaptionSizeTest.cs
index 7d615951c51f..d56c220a7d8c 100644
--- a/tests/monotouch-test/AVFoundation/AVCaptionSizeTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVCaptionSizeTest.cs
@@ -23,8 +23,8 @@ public void CreateTest ()
var secondDimension = AVCaptionDimension.Create (val, units);
var size = AVCaptionSize.Create (firstDimension, secondDimension);
- Assert.AreEqual (val, size.Width.Value, "Width");
- Assert.AreEqual (val, size.Height.Value, "Height");
+ Assert.That (size.Width.Value, Is.EqualTo (val), "Width");
+ Assert.That (size.Height.Value, Is.EqualTo (val), "Height");
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVCaptureReactionTypeTest.cs b/tests/monotouch-test/AVFoundation/AVCaptureReactionTypeTest.cs
index 215435084bec..1841d19a4d93 100644
--- a/tests/monotouch-test/AVFoundation/AVCaptureReactionTypeTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVCaptureReactionTypeTest.cs
@@ -14,7 +14,7 @@ public class AVCaptureReactionTypeTest {
public void GetSystemImage ()
{
TestRuntime.AssertXcodeVersion (15, 0);
- Assert.IsNotNull (AVCaptureReactionType.ThumbsUp.GetSystemImage (), "GetSystemImage");
+ Assert.That (AVCaptureReactionType.ThumbsUp.GetSystemImage (), Is.Not.Null, "GetSystemImage");
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVCaptureTimecodeTests.cs b/tests/monotouch-test/AVFoundation/AVCaptureTimecodeTests.cs
index 6ef6f383c671..7b4b5a48fe14 100644
--- a/tests/monotouch-test/AVFoundation/AVCaptureTimecodeTests.cs
+++ b/tests/monotouch-test/AVFoundation/AVCaptureTimecodeTests.cs
@@ -17,8 +17,8 @@ public void EqualityOperator_TrueForIdenticalValues ()
{
var t1 = new AVCaptureTimecode (1, 2, 3, 4, 5, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
var t2 = new AVCaptureTimecode (1, 2, 3, 4, 5, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
- Assert.True (t1 == t2);
- Assert.False (t1 != t2);
+ Assert.That (t1 == t2, Is.True);
+ Assert.That (t1 != t2, Is.False);
}
[Test]
@@ -26,8 +26,8 @@ public void EqualityOperator_FalseForDifferentValues ()
{
var t1 = new AVCaptureTimecode (1, 2, 3, 4, 5, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
var t2 = new AVCaptureTimecode (9, 2, 3, 4, 5, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
- Assert.False (t1 == t2);
- Assert.True (t1 != t2);
+ Assert.That (t1 == t2, Is.False);
+ Assert.That (t1 != t2, Is.True);
}
[Test]
@@ -35,8 +35,8 @@ public void EqualsMethod_TrueForIdenticalValues ()
{
var t1 = new AVCaptureTimecode (1, 2, 3, 4, 5, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
var t2 = new AVCaptureTimecode (1, 2, 3, 4, 5, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
- Assert.True (t1.Equals (t2));
- Assert.True (t1.Equals ((object) t2));
+ Assert.That (t1.Equals (t2), Is.True);
+ Assert.That (t1.Equals ((object) t2), Is.True);
}
[Test]
@@ -44,8 +44,8 @@ public void EqualsMethod_FalseForDifferentValues ()
{
var t1 = new AVCaptureTimecode (1, 2, 3, 4, 5, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
var t2 = new AVCaptureTimecode (1, 2, 3, 4, 6, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
- Assert.False (t1.Equals (t2));
- Assert.False (t1.Equals ((object) t2));
+ Assert.That (t1.Equals (t2), Is.False);
+ Assert.That (t1.Equals ((object) t2), Is.False);
}
[Test]
@@ -53,7 +53,7 @@ public void GetHashCode_EqualForIdenticalValues ()
{
var t1 = new AVCaptureTimecode (1, 2, 3, 4, 5, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
var t2 = new AVCaptureTimecode (1, 2, 3, 4, 5, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
- Assert.AreEqual (t1.GetHashCode (), t2.GetHashCode ());
+ Assert.That (t2.GetHashCode (), Is.EqualTo (t1.GetHashCode ()));
}
[Test]
@@ -61,7 +61,7 @@ public void GetHashCode_NotEqualForDifferentValues ()
{
var t1 = new AVCaptureTimecode (1, 2, 3, 4, 5, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
var t2 = new AVCaptureTimecode (1, 2, 3, 4, 6, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
- Assert.AreNotEqual (t1.GetHashCode (), t2.GetHashCode ());
+ Assert.That (t2.GetHashCode (), Is.Not.EqualTo (t1.GetHashCode ()));
}
[Test]
@@ -69,7 +69,7 @@ public void AddFramesTest ()
{
var t1 = new AVCaptureTimecode (1, 2, 3, 4, 5, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
var t2 = t1.AddFrames (10);
- Assert.True (t1 != t2);
+ Assert.That (t1 != t2, Is.True);
}
[Test]
@@ -77,14 +77,14 @@ public void MetadataSampleBufferTest ()
{
var t1 = new AVCaptureTimecode (1, 2, 3, 4, 5, new CMTime (60, 30), AVCaptureTimecodeSourceType.FrameCount);
using var sampleBuffer = t1.CreateMetadataSampleBufferAssociatedWithPresentationTimeStamp (new CMTime (60, 60));
- Assert.IsNotNull (sampleBuffer, "sampleBuffer");
- Assert.IsTrue (sampleBuffer.IsValid, "IsValid");
- Assert.IsTrue (1 == sampleBuffer.NumSamples, "NumSamples");
+ Assert.That (sampleBuffer, Is.Not.Null, "sampleBuffer");
+ Assert.That (sampleBuffer.IsValid, Is.True, "IsValid");
+ Assert.That (1 == sampleBuffer.NumSamples, Is.True, "NumSamples");
using var sampleBuffer2 = t1.CreateMetadataSampleBufferForDuration (new CMTime (60, 60));
- Assert.IsNotNull (sampleBuffer2, "sampleBuffer2");
- Assert.IsTrue (sampleBuffer2.IsValid, "IsValid");
- Assert.IsTrue (1 == sampleBuffer2.NumSamples, "NumSamples");
+ Assert.That (sampleBuffer2, Is.Not.Null, "sampleBuffer2");
+ Assert.That (sampleBuffer2.IsValid, Is.True, "IsValid");
+ Assert.That (1 == sampleBuffer2.NumSamples, Is.True, "NumSamples");
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVCaptureWhiteBalanceGainsTest.cs b/tests/monotouch-test/AVFoundation/AVCaptureWhiteBalanceGainsTest.cs
index 474de9bfacf5..f2b8b47bd6be 100644
--- a/tests/monotouch-test/AVFoundation/AVCaptureWhiteBalanceGainsTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVCaptureWhiteBalanceGainsTest.cs
@@ -14,9 +14,9 @@ public void ConstructorTest ()
var gains = new AVCaptureWhiteBalanceGains (red, green, blue);
- Assert.AreEqual (red, gains.RedGain, "Wrong RedGain value.");
- Assert.AreEqual (green, gains.GreenGain, "Wrong GreenGain value.");
- Assert.AreEqual (blue, gains.BlueGain, "Wrong BlueGain value.");
+ Assert.That (gains.RedGain, Is.EqualTo (red), "Wrong RedGain value.");
+ Assert.That (gains.GreenGain, Is.EqualTo (green), "Wrong GreenGain value.");
+ Assert.That (gains.BlueGain, Is.EqualTo (blue), "Wrong BlueGain value.");
}
[Test]
@@ -29,9 +29,9 @@ public void AreEqualTrueTest ()
var gains1 = new AVCaptureWhiteBalanceGains (red, green, blue);
var gains2 = new AVCaptureWhiteBalanceGains (red, green, blue);
- Assert.True (gains1 == gains2, "gains1 == gains2");
- Assert.True (gains1.Equals (gains2), "gains1.Equals (gains2)");
- Assert.False (gains1 != gains2, "gains1 != gains2");
+ Assert.That (gains1 == gains2, Is.True, "gains1 == gains2");
+ Assert.That (gains1.Equals (gains2), Is.True, "gains1.Equals (gains2)");
+ Assert.That (gains1 != gains2, Is.False, "gains1 != gains2");
}
[Test]
@@ -39,9 +39,9 @@ public void AreEqualFalseTest ()
{
var gains1 = new AVCaptureWhiteBalanceGains (2.3f, 3f, 90f);
var gains2 = new AVCaptureWhiteBalanceGains (gains1.RedGain * 2, gains1.GreenGain * 2, gains1.BlueGain * 2);
- Assert.False (gains1 == gains2, "gains1 == gains2");
- Assert.False (gains1.Equals (gains2), "gains1.Equals (gains2)");
- Assert.True (gains1 != gains2, "gains1 != gains2");
+ Assert.That (gains1 == gains2, Is.False, "gains1 == gains2");
+ Assert.That (gains1.Equals (gains2), Is.False, "gains1.Equals (gains2)");
+ Assert.That (gains1 != gains2, Is.True, "gains1 != gains2");
}
[Test]
@@ -49,7 +49,7 @@ public void AreEqualDiffType ()
{
var gains = new AVCaptureWhiteBalanceGains (2.3f, 3f, 90f);
var str = new NSString ("Foo");
- Assert.False (gains.Equals ((object) str));
+ Assert.That (gains.Equals ((object) str), Is.False);
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVDepthDataTests.cs b/tests/monotouch-test/AVFoundation/AVDepthDataTests.cs
index 573d561e498c..40268640ac65 100644
--- a/tests/monotouch-test/AVFoundation/AVDepthDataTests.cs
+++ b/tests/monotouch-test/AVFoundation/AVDepthDataTests.cs
@@ -27,21 +27,21 @@ public void AvailableDepthDataTypesTest ()
// xamarinmonkey.heic is the new photo format, also this one includes depth data
var imgdata = NSData.FromUrl (NSBundle.MainBundle.GetUrlForResource ("xamarinmonkey", "heic", "CoreImage"));
- Assert.NotNull (imgdata, "imgdata");
+ Assert.That (imgdata, Is.Not.Null, "imgdata");
var imageSource = CGImageSource.FromData (imgdata);
- Assert.NotNull (imageSource, "imageSource");
+ Assert.That (imageSource, Is.Not.Null, "imageSource");
// fetching the image count works around a crash in CopyAuxiliaryDataInfo on macOS 10.15 (https://github.com/xamarin/maccore/issues/1802).
- Assert.AreNotEqual (0, imageSource.ImageCount, "ImageCount");
+ Assert.That (imageSource.ImageCount, Is.Not.EqualTo (0), "ImageCount");
var info = imageSource.CopyAuxiliaryDataInfo (0, CGImageAuxiliaryDataType.Disparity);
- Assert.NotNull (info, "info");
+ Assert.That (info, Is.Not.Null, "info");
NSError err;
var depthData = AVDepthData.Create (info, out err);
- Assert.NotNull (depthData, "depthData");
- Assert.NotNull (depthData.AvailableDepthDataTypes, "AvailableDepthDataTypes");
+ Assert.That (depthData, Is.Not.Null, "depthData");
+ Assert.That (depthData.AvailableDepthDataTypes, Is.Not.Null, "AvailableDepthDataTypes");
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVPlayerLayerTest.cs b/tests/monotouch-test/AVFoundation/AVPlayerLayerTest.cs
index d8fa4085e402..b24a77b6a79c 100644
--- a/tests/monotouch-test/AVFoundation/AVPlayerLayerTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVPlayerLayerTest.cs
@@ -13,7 +13,7 @@ public class AVPlayerLayerTests {
public void AVPlayerLayer_VideoGravity ()
{
AVPlayerLayer layer = new AVPlayerLayer ();
- Assert.IsNotNull (layer.VideoGravity);
+ Assert.That (layer.VideoGravity, Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AVSpeechSynthesisMarkerTest.cs b/tests/monotouch-test/AVFoundation/AVSpeechSynthesisMarkerTest.cs
index ce63130e258b..3ac15cdeb791 100644
--- a/tests/monotouch-test/AVFoundation/AVSpeechSynthesisMarkerTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVSpeechSynthesisMarkerTest.cs
@@ -20,27 +20,27 @@ public void NSRangeCtor ()
Assert.Multiple (() => {
{
using var marker = new AVSpeechSynthesisMarker (range, byteOffset, AVSpeechSynthesisMarkerRangeOption.Word);
- Assert.AreEqual (range, marker.TextRange, "TextRange W");
- Assert.AreEqual (byteOffset, (nint) marker.ByteSampleOffset, "ByteSampleOffset W");
- Assert.AreEqual (AVSpeechSynthesisMarkerMark.Word, marker.Mark, "AVSpeechSynthesisMarkerMark W");
- Assert.IsNull (marker.BookmarkName, "BookmarkName W");
- Assert.IsNull (marker.Phoneme, "Phoneme W");
+ Assert.That (marker.TextRange, Is.EqualTo (range), "TextRange W");
+ Assert.That ((nint) marker.ByteSampleOffset, Is.EqualTo (byteOffset), "ByteSampleOffset W");
+ Assert.That (marker.Mark, Is.EqualTo (AVSpeechSynthesisMarkerMark.Word), "AVSpeechSynthesisMarkerMark W");
+ Assert.That (marker.BookmarkName, Is.Null, "BookmarkName W");
+ Assert.That (marker.Phoneme, Is.Null, "Phoneme W");
}
{
using var marker = new AVSpeechSynthesisMarker (range, byteOffset, AVSpeechSynthesisMarkerRangeOption.Sentence);
- Assert.AreEqual (range, marker.TextRange, "TextRange S");
- Assert.AreEqual (byteOffset, (nint) marker.ByteSampleOffset, "ByteSampleOffset S");
- Assert.AreEqual (AVSpeechSynthesisMarkerMark.Sentence, marker.Mark, "AVSpeechSynthesisMarkerMark S");
- Assert.IsNull (marker.BookmarkName, "BookmarkName S");
- Assert.IsNull (marker.Phoneme, "Phoneme S");
+ Assert.That (marker.TextRange, Is.EqualTo (range), "TextRange S");
+ Assert.That ((nint) marker.ByteSampleOffset, Is.EqualTo (byteOffset), "ByteSampleOffset S");
+ Assert.That (marker.Mark, Is.EqualTo (AVSpeechSynthesisMarkerMark.Sentence), "AVSpeechSynthesisMarkerMark S");
+ Assert.That (marker.BookmarkName, Is.Null, "BookmarkName S");
+ Assert.That (marker.Phoneme, Is.Null, "Phoneme S");
}
{
using var marker = new AVSpeechSynthesisMarker (range, byteOffset, AVSpeechSynthesisMarkerRangeOption.Paragraph);
- Assert.AreEqual (range, marker.TextRange, "TextRange P");
- Assert.AreEqual (byteOffset, (nint) marker.ByteSampleOffset, "ByteSampleOffset P");
- Assert.AreEqual (AVSpeechSynthesisMarkerMark.Paragraph, marker.Mark, "AVSpeechSynthesisMarkerMark P");
- Assert.IsNull (marker.BookmarkName, "BookmarkName P");
- Assert.IsNull (marker.Phoneme, "Phoneme P");
+ Assert.That (marker.TextRange, Is.EqualTo (range), "TextRange P");
+ Assert.That ((nint) marker.ByteSampleOffset, Is.EqualTo (byteOffset), "ByteSampleOffset P");
+ Assert.That (marker.Mark, Is.EqualTo (AVSpeechSynthesisMarkerMark.Paragraph), "AVSpeechSynthesisMarkerMark P");
+ Assert.That (marker.BookmarkName, Is.Null, "BookmarkName P");
+ Assert.That (marker.Phoneme, Is.Null, "Phoneme P");
}
});
}
@@ -56,18 +56,18 @@ public void StringCtor ()
Assert.Multiple (() => {
{
using var marker = new AVSpeechSynthesisMarker (value, byteOffset, AVSpeechSynthesisMarkerStringOption.Phoneme);
- Assert.AreEqual (range, marker.TextRange, "TextRange P");
- Assert.AreEqual (byteOffset, (nint) marker.ByteSampleOffset, "ByteSampleOffset P");
- Assert.AreEqual (AVSpeechSynthesisMarkerMark.Phoneme, marker.Mark, "AVSpeechSynthesisMarkerMark P");
- Assert.IsNull (marker.BookmarkName, "BookmarkName P");
- Assert.AreEqual (value, marker.Phoneme, "Phoneme P");
+ Assert.That (marker.TextRange, Is.EqualTo (range), "TextRange P");
+ Assert.That ((nint) marker.ByteSampleOffset, Is.EqualTo (byteOffset), "ByteSampleOffset P");
+ Assert.That (marker.Mark, Is.EqualTo (AVSpeechSynthesisMarkerMark.Phoneme), "AVSpeechSynthesisMarkerMark P");
+ Assert.That (marker.BookmarkName, Is.Null, "BookmarkName P");
+ Assert.That (marker.Phoneme, Is.EqualTo (value), "Phoneme P");
}
{
using var marker = new AVSpeechSynthesisMarker (value, byteOffset, AVSpeechSynthesisMarkerStringOption.Bookmark);
- Assert.AreEqual (range, marker.TextRange, "TextRange B");
- Assert.AreEqual (byteOffset, (nint) marker.ByteSampleOffset, "ByteSampleOffset B");
- Assert.AreEqual (AVSpeechSynthesisMarkerMark.Bookmark, marker.Mark, "AVSpeechSynthesisMarkerMark B");
- Assert.IsNull (marker.Phoneme, "Phoneme B");
+ Assert.That (marker.TextRange, Is.EqualTo (range), "TextRange B");
+ Assert.That ((nint) marker.ByteSampleOffset, Is.EqualTo (byteOffset), "ByteSampleOffset B");
+ Assert.That (marker.Mark, Is.EqualTo (AVSpeechSynthesisMarkerMark.Bookmark), "AVSpeechSynthesisMarkerMark B");
+ Assert.That (marker.Phoneme, Is.Null, "Phoneme B");
}
});
}
diff --git a/tests/monotouch-test/AVFoundation/AVSpeechUtteranceTest.cs b/tests/monotouch-test/AVFoundation/AVSpeechUtteranceTest.cs
index 247de454fb9a..dd18ad3205b2 100644
--- a/tests/monotouch-test/AVFoundation/AVSpeechUtteranceTest.cs
+++ b/tests/monotouch-test/AVFoundation/AVSpeechUtteranceTest.cs
@@ -14,14 +14,14 @@ public class AVSpeechUtteranceTest {
public void StringCtor ()
{
using var utterance = new AVSpeechUtterance ("hello world");
- Assert.AreEqual (utterance.SpeechString, "hello world", "SpeechString");
+ Assert.That ("hello world", Is.EqualTo (utterance.SpeechString), "SpeechString");
}
[Test]
public void StringOptionCtor_PlainText ()
{
using var utterance = new AVSpeechUtterance ("hello world", AVSpeechUtteranceInitializationOption.PlainText);
- Assert.AreEqual (utterance.SpeechString, "hello world", "SpeechString");
+ Assert.That ("hello world", Is.EqualTo (utterance.SpeechString), "SpeechString");
}
[Test]
@@ -31,7 +31,7 @@ public void StringOptionCtor_Ssml ()
var ssml = $"""Hello World""";
using var utterance = new AVSpeechUtterance (ssml, AVSpeechUtteranceInitializationOption.SsmlRepresentation);
- Assert.AreEqual (utterance.SpeechString, "Hello World", "SpeechString");
+ Assert.That ("Hello World", Is.EqualTo (utterance.SpeechString), "SpeechString");
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/AudioPlayerTest.cs b/tests/monotouch-test/AVFoundation/AudioPlayerTest.cs
index c6e342276eab..60521e0d440c 100644
--- a/tests/monotouch-test/AVFoundation/AudioPlayerTest.cs
+++ b/tests/monotouch-test/AVFoundation/AudioPlayerTest.cs
@@ -22,11 +22,11 @@ public class AudioPlayerTest {
public void FromUrl ()
{
string file = Path.Combine (NSBundle.MainBundle.ResourcePath, "Hand.wav");
- Assert.True (File.Exists (file), file);
+ Assert.That (File.Exists (file), Is.True, file);
using (NSUrl url = new (file, false))
using (AVAudioPlayer ap = AVAudioPlayer.FromUrl (url, out NSError error)) {
- Assert.NotNull (ap, "AVAudioPlayer");
- Assert.Null (error, "NSError");
+ Assert.That (ap, Is.Not.Null, "AVAudioPlayer");
+ Assert.That (error, Is.Null, "NSError");
}
}
@@ -35,8 +35,8 @@ public void FromUrlWithInvalidUrl ()
{
Assert.DoesNotThrow (() => {
using (AVAudioPlayer player = AVAudioPlayer.FromUrl (NSUrl.FromString ("sdf"), out NSError error)) {
- Assert.Null (player, "AVAudioPlayer");
- Assert.NotNull (error, "NSError");
+ Assert.That (player, Is.Null, "AVAudioPlayer");
+ Assert.That (error, Is.Not.Null, "NSError");
}
});
}
@@ -45,17 +45,17 @@ public void FromUrlWithInvalidUrl ()
public void FromUrlWithHint ()
{
var file = Path.Combine (NSBundle.MainBundle.ResourcePath, "Hand.wav");
- Assert.True (File.Exists (file), file);
+ Assert.That (File.Exists (file), Is.True, file);
using var url = new NSUrl (file, false);
{
using var ap = AVAudioPlayer.FromUrl (url, AVFileTypes.Wave, out var error);
- Assert.NotNull (ap, "AVAudioPlayer");
- Assert.Null (error, "NSError");
+ Assert.That (ap, Is.Not.Null, "AVAudioPlayer");
+ Assert.That (error, Is.Null, "NSError");
}
{
using var ap = AVAudioPlayer.FromUrl (url, AVFileTypes.Wave.GetConstant (), out var error);
- Assert.NotNull (ap, "AVAudioPlayer 2");
- Assert.Null (error, "NSError 2");
+ Assert.That (ap, Is.Not.Null, "AVAudioPlayer 2");
+ Assert.That (error, Is.Null, "NSError 2");
}
}
@@ -65,13 +65,13 @@ public void FromInvalidUrlWithHint ()
using var url = new NSUrl ("sdf", false);
{
using var ap = AVAudioPlayer.FromUrl (url, AVFileTypes.Wave, out var error);
- Assert.Null (ap, "AVAudioPlayer");
- Assert.NotNull (error, "NSError");
+ Assert.That (ap, Is.Null, "AVAudioPlayer");
+ Assert.That (error, Is.Not.Null, "NSError");
}
{
using var ap = AVAudioPlayer.FromUrl (url, AVFileTypes.Wave.GetConstant (), out var error);
- Assert.Null (ap, "AVAudioPlayer 2");
- Assert.NotNull (error, "NSError 2");
+ Assert.That (ap, Is.Null, "AVAudioPlayer 2");
+ Assert.That (error, Is.Not.Null, "NSError 2");
}
}
@@ -80,8 +80,8 @@ public void FromData ()
{
using (NSData data = NSData.FromFile (NSBundle.MainBundle.PathForResource ("Hand", "wav")))
using (AVAudioPlayer player = AVAudioPlayer.FromData (data, out NSError error)) {
- Assert.NotNull (player, "AVAudioPlayer");
- Assert.Null (error, "NSError");
+ Assert.That (player, Is.Not.Null, "AVAudioPlayer");
+ Assert.That (error, Is.Null, "NSError");
}
}
@@ -91,13 +91,13 @@ public void FromDataWithHint ()
using var data = NSData.FromFile (NSBundle.MainBundle.PathForResource ("Hand", "wav"));
{
using var player = AVAudioPlayer.FromData (data, AVFileTypes.Wave, out var error);
- Assert.NotNull (player, "AVAudioPlayer");
- Assert.Null (error, "NSError");
+ Assert.That (player, Is.Not.Null, "AVAudioPlayer");
+ Assert.That (error, Is.Null, "NSError");
}
{
using var player = AVAudioPlayer.FromData (data, AVFileTypes.Wave.GetConstant (), out var error);
- Assert.NotNull (player, "AVAudioPlayer 2");
- Assert.Null (error, "NSError 2");
+ Assert.That (player, Is.Not.Null, "AVAudioPlayer 2");
+ Assert.That (error, Is.Null, "NSError 2");
}
}
@@ -106,8 +106,8 @@ public void FromDataWithNullData ()
{
Assert.Throws (() => {
using (var player = AVAudioPlayer.FromData (null, out NSError error)) {
- Assert.Null (player, "AVAudioPlayer");
- Assert.NotNull (error, "NSError");
+ Assert.That (player, Is.Null, "AVAudioPlayer");
+ Assert.That (error, Is.Not.Null, "NSError");
}
});
}
diff --git a/tests/monotouch-test/AVFoundation/AudioRecorderTest.cs b/tests/monotouch-test/AVFoundation/AudioRecorderTest.cs
index 6f02236258e8..b448b6f46fe0 100644
--- a/tests/monotouch-test/AVFoundation/AudioRecorderTest.cs
+++ b/tests/monotouch-test/AVFoundation/AudioRecorderTest.cs
@@ -37,8 +37,8 @@ public void Create ()
var audioSettings = new AudioSettings (NSDictionary.FromObjectsAndKeys (Values, Keys));
using (var recorder = AVAudioRecorder.Create (url, audioSettings, out error)) {
- Assert.NotNull (recorder);
- Assert.Null (error);
+ Assert.That (recorder, Is.Not.Null);
+ Assert.That (error, Is.Null);
}
}
[Test]
@@ -50,8 +50,8 @@ public void CreateWithError ()
NSError error;
var audioSettings = new AudioSettings (NSDictionary.FromObjectsAndKeys (Values, Keys));
using (var recorder = AVAudioRecorder.Create (url, audioSettings, out error)) {
- Assert.Null (recorder);
- Assert.NotNull (error);
+ Assert.That (recorder, Is.Null);
+ Assert.That (error, Is.Not.Null);
}
}
diff --git a/tests/monotouch-test/AVFoundation/CMTagCollectionVideoOutputPresetTest.cs b/tests/monotouch-test/AVFoundation/CMTagCollectionVideoOutputPresetTest.cs
index 19d26abcc5f2..cead743b250b 100644
--- a/tests/monotouch-test/AVFoundation/CMTagCollectionVideoOutputPresetTest.cs
+++ b/tests/monotouch-test/AVFoundation/CMTagCollectionVideoOutputPresetTest.cs
@@ -16,8 +16,8 @@ public void Create ()
{
TestRuntime.AssertXcodeVersion (16, 0);
using var tagCollection = CMTagCollectionVideoOutputPreset.Monoscopic.Create (out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status");
- Assert.IsNotNull (tagCollection, "TagCollection");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status");
+ Assert.That (tagCollection, Is.Not.Null, "TagCollection");
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/CaptureMetadataOutputTest.cs b/tests/monotouch-test/AVFoundation/CaptureMetadataOutputTest.cs
index 5932a5c71724..89b10611d491 100644
--- a/tests/monotouch-test/AVFoundation/CaptureMetadataOutputTest.cs
+++ b/tests/monotouch-test/AVFoundation/CaptureMetadataOutputTest.cs
@@ -24,21 +24,21 @@ public class CaptureMetadataOutputTest {
public void Defaults ()
{
using (var obj = new AVCaptureMetadataOutput ()) {
- Assert.AreEqual (AVMetadataObjectType.None, obj.AvailableMetadataObjectTypes, "AvailableMetadataObjectTypes");
- Assert.AreEqual (AVMetadataObjectType.None, obj.MetadataObjectTypes, "MetadataObjectTypes");
+ Assert.That (obj.AvailableMetadataObjectTypes, Is.EqualTo (AVMetadataObjectType.None), "AvailableMetadataObjectTypes");
+ Assert.That (obj.MetadataObjectTypes, Is.EqualTo (AVMetadataObjectType.None), "MetadataObjectTypes");
- Assert.IsNotNull (obj.WeakAvailableMetadataObjectTypes, "WeakAvailableMetadataObjectTypes");
- Assert.AreEqual (0, obj.WeakAvailableMetadataObjectTypes.Length, "WeakAvailableMetadataObjectTypes#");
- Assert.IsNotNull (obj.WeakMetadataObjectTypes, "WeakMetadataObjectTypes");
- Assert.AreEqual (0, obj.WeakMetadataObjectTypes.Length, "WeakMetadataObjectTypes#");
+ Assert.That (obj.WeakAvailableMetadataObjectTypes, Is.Not.Null, "WeakAvailableMetadataObjectTypes");
+ Assert.That (obj.WeakAvailableMetadataObjectTypes.Length, Is.EqualTo (0), "WeakAvailableMetadataObjectTypes#");
+ Assert.That (obj.WeakMetadataObjectTypes, Is.Not.Null, "WeakMetadataObjectTypes");
+ Assert.That (obj.WeakMetadataObjectTypes.Length, Is.EqualTo (0), "WeakMetadataObjectTypes#");
if (TestRuntime.CheckSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false))
- Assert.AreEqual (new CGRect (0, 0, 1, 1), obj.RectOfInterest, "RectOfInterest");
+ Assert.That (obj.RectOfInterest, Is.EqualTo (new CGRect (0, 0, 1, 1)), "RectOfInterest");
if (TestRuntime.CheckXcodeVersion (13, 0)) {
obj.WeakMetadataObjectTypes = null;
- Assert.AreEqual (AVMetadataObjectType.None, obj.MetadataObjectTypes, "MetadataObjectTypes");
+ Assert.That (obj.MetadataObjectTypes, Is.EqualTo (AVMetadataObjectType.None), "MetadataObjectTypes");
obj.MetadataObjectTypes = AVMetadataObjectType.None;
- Assert.AreEqual (AVMetadataObjectType.None, obj.MetadataObjectTypes, "MetadataObjectTypes");
+ Assert.That (obj.MetadataObjectTypes, Is.EqualTo (AVMetadataObjectType.None), "MetadataObjectTypes");
obj.SetDelegate (null, null);
}
}
@@ -50,7 +50,7 @@ public void Flags ()
// single
var flags = AVMetadataObjectType.Face;
var result = AVMetadataObjectTypeExtensions.ToFlags (new NSString [] { flags.GetConstant () });
- Assert.AreEqual (flags, result, "a2e 1");
+ Assert.That (result, Is.EqualTo (flags), "a2e 1");
var back = result.ToArray ();
Assert.That (back.Length, Is.EqualTo (1), "l 1");
@@ -66,7 +66,7 @@ public void Flags ()
AVMetadataObjectType.HumanBody.GetConstant ()
};
result = AVMetadataObjectTypeExtensions.ToFlags (array);
- Assert.AreEqual (flags, result, "a2e 3");
+ Assert.That (result, Is.EqualTo (flags), "a2e 3");
back = result.ToArray ();
Assert.That (back.Length, Is.EqualTo (3), "l 3");
Assert.That (back [0], Is.EqualTo (array [0]), "e2a 3a");
@@ -127,10 +127,10 @@ public void MetadataObjectTypesTest ()
}
metadataOutput.MetadataObjectTypes = val;
all |= val;
- Assert.AreEqual (val, metadataOutput.MetadataObjectTypes, val.ToString ());
+ Assert.That (metadataOutput.MetadataObjectTypes, Is.EqualTo (val), val.ToString ());
}
metadataOutput.MetadataObjectTypes = all;
- Assert.AreEqual (all, metadataOutput.MetadataObjectTypes, all.ToString ());
+ Assert.That (metadataOutput.MetadataObjectTypes, Is.EqualTo (all), all.ToString ());
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/MetadataObjectTest.cs b/tests/monotouch-test/AVFoundation/MetadataObjectTest.cs
index 31bc87d319ee..9477f4e082a1 100644
--- a/tests/monotouch-test/AVFoundation/MetadataObjectTest.cs
+++ b/tests/monotouch-test/AVFoundation/MetadataObjectTest.cs
@@ -25,21 +25,21 @@ public void Defaults ()
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
using (var obj = new AVMetadataFaceObject ()) {
- Assert.AreEqual ((nint) 0, obj.FaceID, "FaceID");
- Assert.AreEqual (false, obj.HasRollAngle, "HasRollAngle");
- Assert.AreEqual (false, obj.HasYawAngle, "HasYawAngle");
+ Assert.That (obj.FaceID, Is.EqualTo ((nint) 0), "FaceID");
+ Assert.That (obj.HasRollAngle, Is.EqualTo (false), "HasRollAngle");
+ Assert.That (obj.HasYawAngle, Is.EqualTo (false), "HasYawAngle");
#if !MONOMAC // No Type property for Mac
- Assert.AreEqual (AVMetadataObjectType.Face, obj.Type, "Type");
+ Assert.That (obj.Type, Is.EqualTo (AVMetadataObjectType.Face), "Type");
#endif
}
#if !MONOMAC // iOS only
using (var obj = new AVMetadataMachineReadableCodeObject ()) {
- Assert.IsNotNull (obj.Corners, "Corners");
- Assert.AreEqual (0, obj.Corners.Length, "Corners");
- Assert.IsNull (obj.StringValue, "StringValue");
- Assert.AreEqual (AVMetadataObjectType.None, obj.Type, "Type");
- Assert.IsNull (obj.WeakType, "WeakType");
+ Assert.That (obj.Corners, Is.Not.Null, "Corners");
+ Assert.That (obj.Corners.Length, Is.EqualTo (0), "Corners");
+ Assert.That (obj.StringValue, Is.Null, "StringValue");
+ Assert.That (obj.Type, Is.EqualTo (AVMetadataObjectType.None), "Type");
+ Assert.That (obj.WeakType, Is.Null, "WeakType");
}
#endif
}
diff --git a/tests/monotouch-test/AVFoundation/PlayerItemTest.cs b/tests/monotouch-test/AVFoundation/PlayerItemTest.cs
index 2417f88695c0..6fc574d6cd82 100644
--- a/tests/monotouch-test/AVFoundation/PlayerItemTest.cs
+++ b/tests/monotouch-test/AVFoundation/PlayerItemTest.cs
@@ -25,10 +25,10 @@ public void FromAssert_Null ()
{
TestRuntime.AssertXcodeVersion (5, 1);
// Apple's AVCustomEdit samples calls this with `nil`
- Assert.Null (AVPlayerItem.FromAsset (null), "1");
+ Assert.That (AVPlayerItem.FromAsset (null), Is.Null, "1");
if (TestRuntime.CheckXcodeVersion (5, 0, 1))
- Assert.Null (AVPlayerItem.FromAsset (null, null), "2");
+ Assert.That (AVPlayerItem.FromAsset (null, null), Is.Null, "2");
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/SpeechSynthesisVoiceTest.cs b/tests/monotouch-test/AVFoundation/SpeechSynthesisVoiceTest.cs
index 1c84a7aaac46..dfb7fd2fd364 100644
--- a/tests/monotouch-test/AVFoundation/SpeechSynthesisVoiceTest.cs
+++ b/tests/monotouch-test/AVFoundation/SpeechSynthesisVoiceTest.cs
@@ -34,16 +34,16 @@ public void Default ()
{
// it's not clear that `init` should be called... it works (as it does not crash) but you can't set anything
using (var ssv = new AVSpeechSynthesisVoice ()) {
- Assert.Null (ssv.Language, "Language");
+ Assert.That (ssv.Language, Is.Null, "Language");
}
}
[Test]
public void Static ()
{
- Assert.NotNull (AVSpeechSynthesisVoice.CurrentLanguageCode, "CurrentLanguageCode");
+ Assert.That (AVSpeechSynthesisVoice.CurrentLanguageCode, Is.Not.Null, "CurrentLanguageCode");
foreach (var ssv in AVSpeechSynthesisVoice.GetSpeechVoices ()) {
- Assert.NotNull (ssv.Language, ssv.Language);
+ Assert.That (ssv.Language, Is.Not.Null, ssv.Language);
}
}
}
diff --git a/tests/monotouch-test/AVFoundation/UtilitiesTest.cs b/tests/monotouch-test/AVFoundation/UtilitiesTest.cs
index 63b8597f919d..be5d5608d502 100644
--- a/tests/monotouch-test/AVFoundation/UtilitiesTest.cs
+++ b/tests/monotouch-test/AVFoundation/UtilitiesTest.cs
@@ -26,7 +26,7 @@ public class UtilitiesTest {
public void AspectRatio ()
{
var r = CGRect.Empty.WithAspectRatio (CGSize.Empty);
- Assert.True (nfloat.IsNaN (r.Top), "Top");
+ Assert.That (nfloat.IsNaN (r.Top), Is.True, "Top");
Assert.That (nfloat.IsNaN (r.Left), "Left");
Assert.That (nfloat.IsNaN (r.Width), "Width");
Assert.That (nfloat.IsNaN (r.Height), "Height");
diff --git a/tests/monotouch-test/AVFoundation/VideoCompositionInstructionTest.cs b/tests/monotouch-test/AVFoundation/VideoCompositionInstructionTest.cs
index b20ac786e010..72495f389817 100644
--- a/tests/monotouch-test/AVFoundation/VideoCompositionInstructionTest.cs
+++ b/tests/monotouch-test/AVFoundation/VideoCompositionInstructionTest.cs
@@ -25,11 +25,11 @@ public class VideoCompositionInstructionTest {
public void Defaults ()
{
using (var i = new AVVideoCompositionInstruction ()) {
- Assert.Null (i.BackgroundColor, "BackgroundColor");
- Assert.True (i.EnablePostProcessing, "EnablePostProcessing");
- Assert.Null (i.LayerInstructions, "LayerInstructions");
- Assert.True (i.TimeRange.Start.IsInvalid, "TimeRange.Start");
- Assert.True (i.TimeRange.Duration.IsInvalid, "TimeRange.Duration");
+ Assert.That (i.BackgroundColor, Is.Null, "BackgroundColor");
+ Assert.That (i.EnablePostProcessing, Is.True, "EnablePostProcessing");
+ Assert.That (i.LayerInstructions, Is.Null, "LayerInstructions");
+ Assert.That (i.TimeRange.Start.IsInvalid, Is.True, "TimeRange.Start");
+ Assert.That (i.TimeRange.Duration.IsInvalid, Is.True, "TimeRange.Duration");
}
}
@@ -39,7 +39,7 @@ public void Seven ()
TestRuntime.AssertXcodeVersion (5, 0, 1);
using (var i = new AVVideoCompositionInstruction ()) {
- Assert.False (i.ContainsTweening, "ContainsTweening");
+ Assert.That (i.ContainsTweening, Is.False, "ContainsTweening");
Assert.That (i.PassthroughTrackID, Is.EqualTo (0), "PassthroughTrackID");
Assert.That (i.RequiredSourceTrackIDs.Length, Is.EqualTo (0), "RequiredSourceTrackIDs");
}
diff --git a/tests/monotouch-test/Accessibility/AXSettings.cs b/tests/monotouch-test/Accessibility/AXSettings.cs
index ba7b854d1c50..8a77df4c6663 100644
--- a/tests/monotouch-test/Accessibility/AXSettings.cs
+++ b/tests/monotouch-test/Accessibility/AXSettings.cs
@@ -35,8 +35,8 @@ public void OpenSettingsFeature ()
e = error;
didComplete.TrySetResult (true);
});
- Assert.IsTrue (TestRuntime.RunAsync (TimeSpan.FromSeconds (30), didComplete.Task), "Timed out");
- Assert.IsNull (error);
+ Assert.That (TestRuntime.RunAsync (TimeSpan.FromSeconds (30), didComplete.Task), Is.True, "Timed out");
+ Assert.That (error, Is.Null);
}
}
}
diff --git a/tests/monotouch-test/AdSupport/IdentifierManagerTest.cs b/tests/monotouch-test/AdSupport/IdentifierManagerTest.cs
index aa1055a0cf5f..5fc4bbaada56 100644
--- a/tests/monotouch-test/AdSupport/IdentifierManagerTest.cs
+++ b/tests/monotouch-test/AdSupport/IdentifierManagerTest.cs
@@ -22,7 +22,7 @@ public class IdentifierManagerTest {
public void SharedManager ()
{
// IsAdvertisingTrackingEnabled - device specific config
- Assert.NotNull (ASIdentifierManager.SharedManager.AdvertisingIdentifier, "AdvertisingIdentifier");
+ Assert.That (ASIdentifierManager.SharedManager.AdvertisingIdentifier, Is.Not.Null, "AdvertisingIdentifier");
}
}
}
diff --git a/tests/monotouch-test/AddressBook/AddressBookTest.cs b/tests/monotouch-test/AddressBook/AddressBookTest.cs
index b08aa4670c46..a25527bfbccc 100644
--- a/tests/monotouch-test/AddressBook/AddressBookTest.cs
+++ b/tests/monotouch-test/AddressBook/AddressBookTest.cs
@@ -46,7 +46,7 @@ public void GetDefaultSource ()
{
TestRuntime.CheckAddressBookPermission ();
ABAddressBook ab = new ABAddressBook ();
- Assert.NotNull (ab.GetDefaultSource (), "GetDefaultSource");
+ Assert.That (ab.GetDefaultSource (), Is.Not.Null, "GetDefaultSource");
}
[Test]
@@ -54,9 +54,9 @@ public void GetSource ()
{
TestRuntime.CheckAddressBookPermission ();
ABAddressBook ab = new ABAddressBook ();
- Assert.Null (ab.GetSource (-1), "-1");
+ Assert.That (ab.GetSource (-1), Is.Null, "-1");
// GetSource(0) is not reliable across device/simulator and iOS versions
- Assert.Null (ab.GetSource (Int32.MaxValue), "MaxValue");
+ Assert.That (ab.GetSource (Int32.MaxValue), Is.Null, "MaxValue");
}
[Test]
@@ -65,7 +65,7 @@ public void LocalizedLabel ()
TestRuntime.CheckAddressBookPermission ();
var label = ABPersonPhoneLabel.Mobile;
var result = ABAddressBook.LocalizedLabel (label);
- Assert.NotNull (result, "result");
+ Assert.That (result, Is.Not.Null, "result");
Assert.That (result.Length, Is.GreaterThan (0), "Length");
}
}
diff --git a/tests/monotouch-test/AddressBook/PersonTest.cs b/tests/monotouch-test/AddressBook/PersonTest.cs
index c34b5568bbce..d0779b5ff4fb 100644
--- a/tests/monotouch-test/AddressBook/PersonTest.cs
+++ b/tests/monotouch-test/AddressBook/PersonTest.cs
@@ -37,7 +37,7 @@ public void UpdateAddressLine ()
NSError err;
var ab = ABAddressBook.Create (out err);
- Assert.IsNotNull (ab, "#1");
+ Assert.That (ab, Is.Not.Null, "#1");
var people = ab.GetPeople ();
if (people.Length < 1) {
@@ -60,7 +60,7 @@ public void UpdateAddressLine ()
multi.Value = addr;
p.SetAddresses (mutable);
- Assert.IsTrue (ab.HasUnsavedChanges);
+ Assert.That (ab.HasUnsavedChanges, Is.True);
ab.Save ();
}
@@ -69,7 +69,7 @@ public void LocalizedPropertyName ()
{
TestRuntime.CheckAddressBookPermission ();
var name = ABPerson.LocalizedPropertyName (ABPersonProperty.FirstName);
- Assert.NotNull (name, "name");
+ Assert.That (name, Is.Not.Null, "name");
Assert.That (name.Length, Is.GreaterThan (0), "Length");
}
@@ -79,7 +79,7 @@ public void LocalizedPropertyName_Int ()
TestRuntime.CheckAddressBookPermission ();
// Use the underlying integer ID for ABPersonProperty.LastName (1)
var name = ABPerson.LocalizedPropertyName (1);
- Assert.NotNull (name, "name");
+ Assert.That (name, Is.Not.Null, "name");
Assert.That (name.Length, Is.GreaterThan (0), "Length");
}
@@ -91,7 +91,7 @@ public void PersonToString ()
person.FirstName = "Test";
person.LastName = "Person";
var str = person.ToString ();
- Assert.NotNull (str, "ToString");
+ Assert.That (str, Is.Not.Null, "ToString");
}
}
@@ -100,9 +100,9 @@ public void GetImage_NoImage ()
{
TestRuntime.CheckAddressBookPermission ();
using (var person = new ABPerson ()) {
- Assert.IsFalse (person.HasImage, "HasImage");
- Assert.IsNull (person.Image, "Image");
- Assert.IsNull (person.GetImage (ABPersonImageFormat.Thumbnail), "GetImage");
+ Assert.That (person.HasImage, Is.False, "HasImage");
+ Assert.That (person.Image, Is.Null, "Image");
+ Assert.That (person.GetImage (ABPersonImageFormat.Thumbnail), Is.Null, "GetImage");
}
}
@@ -113,7 +113,7 @@ public void GetLinkedPeople ()
using (var person = new ABPerson ()) {
var linked = person.GetLinkedPeople ();
// A new person not in the address book may return null or empty
- Assert.IsTrue (linked is null || linked.Length >= 0, "GetLinkedPeople");
+ Assert.That (linked is null || linked.Length >= 0, Is.True, "GetLinkedPeople");
}
}
@@ -124,7 +124,7 @@ public void CreateFromVCard ()
var vcard = "BEGIN:VCARD\nVERSION:3.0\nFN:Test Person\nN:Person;Test;;;\nEND:VCARD\n";
using (var data = NSData.FromString (vcard)) {
var people = ABPerson.CreateFromVCard (null, data);
- Assert.NotNull (people, "people");
+ Assert.That (people, Is.Not.Null, "people");
Assert.That (people.Length, Is.GreaterThan (0), "Length");
}
}
@@ -135,7 +135,7 @@ public void PropertyToString_FirstName ()
TestRuntime.CheckAddressBookPermission ();
using (var person = new ABPerson ()) {
person.FirstName = "TestFirst";
- Assert.AreEqual ("TestFirst", person.FirstName, "FirstName");
+ Assert.That (person.FirstName, Is.EqualTo ("TestFirst"), "FirstName");
}
}
@@ -150,7 +150,7 @@ public void MultiValueLabel ()
var allPhones = person.GetPhones ();
Assert.That (allPhones.Count, Is.GreaterThan (0), "Count");
- Assert.NotNull (allPhones [0].Label, "Label");
+ Assert.That (allPhones [0].Label, Is.Not.Null, "Label");
}
}
@@ -166,7 +166,7 @@ public void MultiValueGetValues ()
var allPhones = person.GetPhones ();
var values = allPhones.GetValues ();
- Assert.NotNull (values, "values");
+ Assert.That (values, Is.Not.Null, "values");
Assert.That (values.Length, Is.EqualTo (2), "Length");
}
}
diff --git a/tests/monotouch-test/AddressBook/SourceTest.cs b/tests/monotouch-test/AddressBook/SourceTest.cs
index 8cc76aaf1828..77bb5091a461 100644
--- a/tests/monotouch-test/AddressBook/SourceTest.cs
+++ b/tests/monotouch-test/AddressBook/SourceTest.cs
@@ -37,7 +37,7 @@ public void Default ()
// we assume the simulator defaults (e.g. after a reset)
ABSource source = new ABAddressBook ().GetDefaultSource ();
- Assert.Null (source.Name, "Name");
+ Assert.That (source.Name, Is.Null, "Name");
Assert.That (source.SourceType, Is.EqualTo (ABSourceType.Local), "SourceType");
// ABRecord
diff --git a/tests/monotouch-test/AppKit/DerivedEventTest.cs b/tests/monotouch-test/AppKit/DerivedEventTest.cs
index 8a8776cf1f2e..9af2086de9e3 100644
--- a/tests/monotouch-test/AppKit/DerivedEventTest.cs
+++ b/tests/monotouch-test/AppKit/DerivedEventTest.cs
@@ -30,9 +30,9 @@ public void DerivedEvents_DontStompEachOther ()
void TestDelegates (NSComboBox b)
{
NSTextField f = (NSTextField) b;
- Assert.IsNotNull (b.Delegate, "NSComboBox delegate null");
- Assert.IsNotNull (f.Delegate, "NSTextField delegate null");
- Assert.AreEqual (b.Delegate.GetHashCode (), f.Delegate.GetHashCode (), "Delegates are not equal");
+ Assert.That (b.Delegate, Is.Not.Null, "NSComboBox delegate null");
+ Assert.That (f.Delegate, Is.Not.Null, "NSTextField delegate null");
+ Assert.That (f.Delegate.GetHashCode (), Is.EqualTo (b.Delegate.GetHashCode ()), "Delegates are not equal");
}
[Test]
@@ -72,7 +72,7 @@ void TestOverrideThrow (bool eventFirst, bool shouldThrow)
didThrow = true;
}
if (shouldThrow != didThrow)
- Assert.Fail ("TestOverrideThrow ({0}, {1}) did not have expected thrown status", eventFirst, shouldThrow);
+ Assert.Fail ($"TestOverrideThrow ({eventFirst}, {shouldThrow}) did not have expected thrown status");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSAppearance.cs b/tests/monotouch-test/AppKit/NSAppearance.cs
index 08db5f6ed405..666e8d8c9fd3 100644
--- a/tests/monotouch-test/AppKit/NSAppearance.cs
+++ b/tests/monotouch-test/AppKit/NSAppearance.cs
@@ -10,8 +10,8 @@ public class NSAppearanceTests {
public void NSAppearanceShouldLoadAppearanceNamed ()
{
var appearance = NSAppearance.GetAppearance (NSAppearance.NameVibrantDark);
- Assert.IsNotNull (appearance, "NSAppearanceShouldLoadAppearanceNamed - Failed to initialize appearance VibrantDark");
- Assert.AreEqual (appearance.Name, NSAppearance.NameVibrantDark.ToString (), "NSAppearanceShouldLoadAppearanceNamed - Appearance initialized with incorrect name.");
+ Assert.That (appearance, Is.Not.Null, "NSAppearanceShouldLoadAppearanceNamed - Failed to initialize appearance VibrantDark");
+ Assert.That (NSAppearance.NameVibrantDark.ToString (), Is.EqualTo (appearance.Name), "NSAppearanceShouldLoadAppearanceNamed - Appearance initialized with incorrect name.");
}
#if FALSE // Test failing, exception doesn't appear to be thrown during test, throw correctly running in an app.
@@ -26,7 +26,7 @@ public void NSAppearanceConstructorShouldFailWithInvalidName ()
exceptionHit = true;
}
- Assert.IsTrue (exceptionHit, "NSAppearanceConstructorShouldFailWithInvalidName - No exception thrown while initializing appearance with invalid name.");
+ Assert.That (exceptionHit, Is.True, "NSAppearanceConstructorShouldFailWithInvalidName - No exception thrown while initializing appearance with invalid name.");
}
#endif
@@ -37,7 +37,7 @@ public void NSAppearanceShouldChangeCurrentAppearance ()
NSAppearance.CurrentAppearance = NSAppearance.GetAppearance (NSAppearance.NameVibrantDark);
- Assert.AreNotEqual (appearance, NSAppearance.CurrentAppearance, "NSAppearanceShouldChangeCurrentAppearance - Failed to change appearance.");
+ Assert.That (NSAppearance.CurrentAppearance, Is.Not.EqualTo (appearance), "NSAppearanceShouldChangeCurrentAppearance - Failed to change appearance.");
}
[Test]
diff --git a/tests/monotouch-test/AppKit/NSCellTest.cs b/tests/monotouch-test/AppKit/NSCellTest.cs
index c4a6a5b3e2ee..d61181496817 100644
--- a/tests/monotouch-test/AppKit/NSCellTest.cs
+++ b/tests/monotouch-test/AppKit/NSCellTest.cs
@@ -25,15 +25,15 @@ void Check (IntPtr cell_handle)
var clone_ptr = IntPtr_objc_msgSend (cell_handle, Selector.GetHandle ("copyWithZone:"), IntPtr.Zero);
// Console.WriteLine ("Created cell 0x{0} (GCHandle: 0x{2}) with clone 0x{1} (GCHandle: 0x{3})", cell_handle.ToString ("x"), clone_ptr.ToString ("x"), GetGCHandle (cell_handle).ToString ("x"), GetGCHandle (clone_ptr).ToString ("x"));
- Assert.AreNotEqual (GetGCHandle (cell_handle), GetGCHandle (clone_ptr), "gchandle #1");
+ Assert.That (GetGCHandle (clone_ptr), Is.Not.EqualTo (GetGCHandle (cell_handle)), "gchandle #1");
CustomCell.expectedHandle = cell_handle;
objc_msgSend (Class.GetHandle (typeof (CustomCell)), Selector.GetHandle ("foo:"), cell_handle);
- Assert.AreNotEqual (GetGCHandle (cell_handle), GetGCHandle (clone_ptr), "gchandle #2");
+ Assert.That (GetGCHandle (clone_ptr), Is.Not.EqualTo (GetGCHandle (cell_handle)), "gchandle #2");
CustomCell.expectedHandle = clone_ptr;
objc_msgSend (Class.GetHandle (typeof (CustomCell)), Selector.GetHandle ("foo:"), clone_ptr);
- Assert.AreNotEqual (GetGCHandle (cell_handle), GetGCHandle (clone_ptr), "gchandle #3");
+ Assert.That (GetGCHandle (clone_ptr), Is.Not.EqualTo (GetGCHandle (cell_handle)), "gchandle #3");
objc_msgSend (clone_ptr, Selector.GetHandle ("release"));
}
@@ -65,7 +65,7 @@ public CustomCell () { }
[Export ("foo:")]
public static void Foo (CustomCell mySelf)
{
- Assert.AreEqual (expectedHandle, mySelf.Handle, "Handle");
+ Assert.That (mySelf.Handle, Is.EqualTo (expectedHandle), "Handle");
}
}
diff --git a/tests/monotouch-test/AppKit/NSClipView.cs b/tests/monotouch-test/AppKit/NSClipView.cs
index 3679240ef32a..32d21d89c46d 100644
--- a/tests/monotouch-test/AppKit/NSClipView.cs
+++ b/tests/monotouch-test/AppKit/NSClipView.cs
@@ -13,10 +13,10 @@ public void NSClipViewConstrainBoundsRect ()
var clipView = new NSClipView (new CGRect (0, 0, 50, 50));
var rect = clipView.ConstrainBoundsRect (new CGRect (10, 10, 30, 30));
- Assert.IsTrue (rect.X == 0, "NSClipViewConstrainBoundsRect - X value was not 0");
- Assert.IsTrue (rect.Y == 0, "NSClipViewConstrainBoundsRect - Y value was not 0");
- Assert.IsTrue (rect.Width == 30, "NSClipViewConstrainBoundsRect - Width value was not 30");
- Assert.IsTrue (rect.Height == 30, "NSClipViewConstrainBoundsRect - Height value was not 30");
+ Assert.That (rect.X == 0, Is.True, "NSClipViewConstrainBoundsRect - X value was not 0");
+ Assert.That (rect.Y == 0, Is.True, "NSClipViewConstrainBoundsRect - Y value was not 0");
+ Assert.That (rect.Width == 30, Is.True, "NSClipViewConstrainBoundsRect - Width value was not 30");
+ Assert.That (rect.Height == 30, Is.True, "NSClipViewConstrainBoundsRect - Height value was not 30");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSColor.cs b/tests/monotouch-test/AppKit/NSColor.cs
index d0efb2e77952..288a4e78964f 100644
--- a/tests/monotouch-test/AppKit/NSColor.cs
+++ b/tests/monotouch-test/AppKit/NSColor.cs
@@ -13,9 +13,9 @@ public void NSColor_ComponentTests ()
NSColor c = NSColor.Blue;
nfloat [] components;
c.GetComponents (out components);
- Assert.IsTrue (0f == components [0], "Red");
- Assert.IsTrue (0f == components [1], "Green");
- Assert.IsTrue (1f == components [2], "Blue");
+ Assert.That (0f == components [0], Is.True, "Red");
+ Assert.That (0f == components [1], Is.True, "Green");
+ Assert.That (1f == components [2], Is.True, "Blue");
}
[Test]
@@ -24,9 +24,9 @@ public void SingleComponents ()
var c = NSColor.Red;
nfloat [] components;
c.GetComponents (out components);
- Assert.AreEqual (c.RedComponent, components [0], "Red");
- Assert.AreEqual (c.GreenComponent, components [1], "Green");
- Assert.AreEqual (c.BlueComponent, components [2], "Blue");
+ Assert.That (components [0], Is.EqualTo (c.RedComponent), "Red");
+ Assert.That (components [1], Is.EqualTo (c.GreenComponent), "Green");
+ Assert.That (components [2], Is.EqualTo (c.BlueComponent), "Blue");
}
[Test]
@@ -36,10 +36,10 @@ public void FromColorSpace ()
using var color = NSColor.FromColorSpace (NSColorSpace.GenericRGBColorSpace, components);
color.GetComponents (out var actualComponents);
- Assert.AreEqual (components [0], actualComponents [0], "Red");
- Assert.AreEqual (components [1], actualComponents [1], "Green");
- Assert.AreEqual (components [2], actualComponents [2], "Blue");
- Assert.AreEqual (components [3], actualComponents [3], "Alpha");
+ Assert.That (actualComponents [0], Is.EqualTo (components [0]), "Red");
+ Assert.That (actualComponents [1], Is.EqualTo (components [1]), "Green");
+ Assert.That (actualComponents [2], Is.EqualTo (components [2]), "Blue");
+ Assert.That (actualComponents [3], Is.EqualTo (components [3]), "Alpha");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSControl.cs b/tests/monotouch-test/AppKit/NSControl.cs
index 1e96c6b37ed0..9cc964ebf210 100644
--- a/tests/monotouch-test/AppKit/NSControl.cs
+++ b/tests/monotouch-test/AppKit/NSControl.cs
@@ -13,8 +13,8 @@ public void NSControlShouldChangeControlSize ()
var size = control.ControlSize;
control.ControlSize = NSControlSize.Mini;
- Assert.IsFalse (size == control.ControlSize);
- Assert.IsTrue (control.ControlSize == NSControlSize.Mini);
+ Assert.That (size == control.ControlSize, Is.False);
+ Assert.That (control.ControlSize == NSControlSize.Mini, Is.True);
}
[Test]
@@ -24,7 +24,7 @@ public void NSControlShouldChangeHighlighted ()
var highlighted = control.Highlighted;
control.Highlighted = !highlighted;
- Assert.IsFalse (highlighted == control.Highlighted);
+ Assert.That (highlighted == control.Highlighted, Is.False);
}
[Test]
@@ -34,8 +34,8 @@ public void NSControlShouldChangeLineBreakMode ()
var lineBreak = control.LineBreakMode;
control.LineBreakMode = NSLineBreakMode.Clipping;
- Assert.IsTrue (control.LineBreakMode == NSLineBreakMode.Clipping);
- Assert.IsFalse (lineBreak == control.LineBreakMode);
+ Assert.That (control.LineBreakMode == NSLineBreakMode.Clipping, Is.True);
+ Assert.That (lineBreak == control.LineBreakMode, Is.False);
}
[Test]
@@ -51,8 +51,8 @@ public void NSControlShouldAddMultipleActivatedEventHandlers ()
control.PerformClick (control);
- Assert.IsTrue (firstHitCount == 1, "NSControlShouldAddMultipleActivatedEventHandlers - Did not call first EventHandler");
- Assert.IsTrue (secondHitCount == 1, "NSControlShouldAddMultipleActivatedEventHandlers - Did not call second EventHandler");
+ Assert.That (firstHitCount == 1, Is.True, "NSControlShouldAddMultipleActivatedEventHandlers - Did not call first EventHandler");
+ Assert.That (secondHitCount == 1, Is.True, "NSControlShouldAddMultipleActivatedEventHandlers - Did not call second EventHandler");
}
[Test]
@@ -71,8 +71,8 @@ public void NSControlShouldRemoveAndAddActivatedEventHandlers ()
control.PerformClick (control);
- Assert.IsTrue (firstHitCount == 0, "NSControlShouldRemoveAndAddActivatedEventHandlers - Called first EventHandler after it was removed");
- Assert.IsTrue (secondHitCount == 1, "NSControlShouldRemoveAndAddActivatedEventHandlers - Did not call second EventHandler");
+ Assert.That (firstHitCount == 0, Is.True, "NSControlShouldRemoveAndAddActivatedEventHandlers - Called first EventHandler after it was removed");
+ Assert.That (secondHitCount == 1, Is.True, "NSControlShouldRemoveAndAddActivatedEventHandlers - Did not call second EventHandler");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSEvent.cs b/tests/monotouch-test/AppKit/NSEvent.cs
index 640c31eda996..bf0abdf689ed 100644
--- a/tests/monotouch-test/AppKit/NSEvent.cs
+++ b/tests/monotouch-test/AppKit/NSEvent.cs
@@ -12,7 +12,7 @@ public void Create ()
{
using var cgevent = new CGEvent (null, (ushort) 1, true);
using var nsevent = NSEvent.Create (cgevent);
- Assert.AreEqual ((int) cgevent.EventType, (int) nsevent.Type, "[Event]Type");
+ Assert.That ((int) nsevent.Type, Is.EqualTo ((int) cgevent.EventType), "[Event]Type");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSFont.cs b/tests/monotouch-test/AppKit/NSFont.cs
index fc69e6ae01ac..7e9ccbde14e2 100644
--- a/tests/monotouch-test/AppKit/NSFont.cs
+++ b/tests/monotouch-test/AppKit/NSFont.cs
@@ -23,8 +23,8 @@ public void GetBoundingRect_SmokeTest ()
var bounding = nsFont.GetBoundingRects (glyphs);
var advancement = nsFont.GetAdvancements (glyphs);
- Assert.AreEqual (5, bounding.Length);
- Assert.AreEqual (5, advancement.Length);
+ Assert.That (bounding.Length, Is.EqualTo (5));
+ Assert.That (advancement.Length, Is.EqualTo (5));
}
[Test]
diff --git a/tests/monotouch-test/AppKit/NSGradient.cs b/tests/monotouch-test/AppKit/NSGradient.cs
index f441ee5c3f0e..ed86b4f42d6f 100644
--- a/tests/monotouch-test/AppKit/NSGradient.cs
+++ b/tests/monotouch-test/AppKit/NSGradient.cs
@@ -11,9 +11,9 @@ public void NSGradientConstructorTests ()
{
NSColorSpace colorSpace = NSColorSpace.GenericRGBColorSpace;
NSGradient g = new NSGradient (new [] { NSColor.Black, NSColor.White, NSColor.Black }, new [] { 0f, .5f, 1.0f }, colorSpace);
- Assert.IsNotNull (g);
- Assert.AreEqual (colorSpace, g.ColorSpace);
- Assert.AreEqual ((nint) 3, g.ColorStopsCount);
+ Assert.That (g, Is.Not.Null);
+ Assert.That (g.ColorSpace, Is.EqualTo (colorSpace));
+ Assert.That (g.ColorStopsCount, Is.EqualTo ((nint) 3));
// Since we are asking for colors on a gradient, there will be some color blending, even with just black and white.
const float closeEnough = .05f;
@@ -25,24 +25,24 @@ public void NSGradientConstructorTests ()
g.GetColor (out color, out location, 0);
color = color.UsingColorSpace (NSColorSpace.CalibratedRGB);
- Assert.IsTrue (black.RedComponent - color.RedComponent < closeEnough);
- Assert.IsTrue (black.BlueComponent - color.BlueComponent < closeEnough);
- Assert.IsTrue (black.GreenComponent - color.GreenComponent < closeEnough);
- Assert.AreEqual (0.0f, (float) location);
+ Assert.That (black.RedComponent - color.RedComponent < closeEnough, Is.True);
+ Assert.That (black.BlueComponent - color.BlueComponent < closeEnough, Is.True);
+ Assert.That (black.GreenComponent - color.GreenComponent < closeEnough, Is.True);
+ Assert.That ((float) location, Is.EqualTo (0.0f));
g.GetColor (out color, out location, 1);
color = color.UsingColorSpace (NSColorSpace.CalibratedRGB);
- Assert.IsTrue (white.RedComponent - color.RedComponent < closeEnough);
- Assert.IsTrue (white.BlueComponent - color.BlueComponent < closeEnough);
- Assert.IsTrue (white.GreenComponent - color.GreenComponent < closeEnough);
- Assert.AreEqual (0.5f, (float) location);
+ Assert.That (white.RedComponent - color.RedComponent < closeEnough, Is.True);
+ Assert.That (white.BlueComponent - color.BlueComponent < closeEnough, Is.True);
+ Assert.That (white.GreenComponent - color.GreenComponent < closeEnough, Is.True);
+ Assert.That ((float) location, Is.EqualTo (0.5f));
g.GetColor (out color, out location, 2);
color = color.UsingColorSpace (NSColorSpace.CalibratedRGB);
- Assert.IsTrue (black.RedComponent - color.RedComponent < closeEnough);
- Assert.IsTrue (black.BlueComponent - color.BlueComponent < closeEnough);
- Assert.IsTrue (black.GreenComponent - color.GreenComponent < closeEnough);
- Assert.AreEqual (1.0f, (float) location);
+ Assert.That (black.RedComponent - color.RedComponent < closeEnough, Is.True);
+ Assert.That (black.BlueComponent - color.BlueComponent < closeEnough, Is.True);
+ Assert.That (black.GreenComponent - color.GreenComponent < closeEnough, Is.True);
+ Assert.That ((float) location, Is.EqualTo (1.0f));
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSGraphics.cs b/tests/monotouch-test/AppKit/NSGraphics.cs
index e2537d0c54ee..f29cd9885b25 100644
--- a/tests/monotouch-test/AppKit/NSGraphics.cs
+++ b/tests/monotouch-test/AppKit/NSGraphics.cs
@@ -13,8 +13,8 @@ public void BestDepth ()
{
bool exactMatch = false;
var rv = NSGraphics.BestDepth (NSColorSpace.DeviceRGB, 8, 8, false, ref exactMatch);
- Assert.AreEqual (NSWindowDepth.TwentyfourBitRgb, rv, "BestDepth");
- Assert.IsTrue (exactMatch, "ExactMatch");
+ Assert.That (rv, Is.EqualTo (NSWindowDepth.TwentyfourBitRgb), "BestDepth");
+ Assert.That (exactMatch, Is.True, "ExactMatch");
}
#endif
@@ -22,8 +22,8 @@ public void BestDepth ()
public void GetBestDepth ()
{
var rv = NSGraphics.GetBestDepth (NSColorSpace.DeviceRGB, 8, 8, false, out var exactMatch);
- Assert.AreEqual (NSWindowDepth.TwentyfourBitRgb, rv, "GetBestDepth");
- Assert.IsTrue (exactMatch, "ExactMatch");
+ Assert.That (rv, Is.EqualTo (NSWindowDepth.TwentyfourBitRgb), "GetBestDepth");
+ Assert.That (exactMatch, Is.True, "ExactMatch");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSGridViewTest.cs b/tests/monotouch-test/AppKit/NSGridViewTest.cs
index 9640d05af1de..e75b3e6f3a0a 100644
--- a/tests/monotouch-test/AppKit/NSGridViewTest.cs
+++ b/tests/monotouch-test/AppKit/NSGridViewTest.cs
@@ -23,11 +23,11 @@ public void CreateWithNSViewArrayOfArrayCheckNSTextView ()
NSGridView nSGridViewArrayOfArray = NSGridView.Create (nSViewsArrayOfArray);
- Assert.NotNull (nSGridViewArrayOfArray);
- Assert.AreEqual ("0", ((NSTextView) (nSGridViewArrayOfArray.GetCell (0, 0)).ContentView).Value, "0,0");
- Assert.AreEqual ("1", ((NSTextView) (nSGridViewArrayOfArray.GetCell (0, 1)).ContentView).Value, "0,1");
- Assert.AreEqual ("2", ((NSTextView) (nSGridViewArrayOfArray.GetCell (0, 2)).ContentView).Value, "0,2");
- Assert.AreEqual ("3", ((NSTextView) (nSGridViewArrayOfArray.GetCell (0, 3)).ContentView).Value, "0,3");
+ Assert.That (nSGridViewArrayOfArray, Is.Not.Null);
+ Assert.That (((NSTextView) (nSGridViewArrayOfArray.GetCell (0, 0)).ContentView).Value, Is.EqualTo ("0"), "0,0");
+ Assert.That (((NSTextView) (nSGridViewArrayOfArray.GetCell (0, 1)).ContentView).Value, Is.EqualTo ("1"), "0,1");
+ Assert.That (((NSTextView) (nSGridViewArrayOfArray.GetCell (0, 2)).ContentView).Value, Is.EqualTo ("2"), "0,2");
+ Assert.That (((NSTextView) (nSGridViewArrayOfArray.GetCell (0, 3)).ContentView).Value, Is.EqualTo ("3"), "0,3");
}
[Test]
@@ -39,10 +39,10 @@ public void CreateWithNSViewArrayOfArrayCheckDifferentArrayLength ()
NSGridView nSGridViewArrayOfArray = NSGridView.Create (nSViewsArrayOfArray);
- Assert.NotNull (nSGridViewArrayOfArray);
- Assert.AreEqual ("0", ((NSTextView) (nSGridViewArrayOfArray.GetCell (0, 0)).ContentView).Value, "0,0");
- Assert.AreEqual ("1", ((NSTextView) (nSGridViewArrayOfArray.GetCell (0, 1)).ContentView).Value, "0,1");
- Assert.AreEqual ("1bis", ((NSTextView) (nSGridViewArrayOfArray.GetCell (1, 1)).ContentView).Value, "0,2");
+ Assert.That (nSGridViewArrayOfArray, Is.Not.Null);
+ Assert.That (((NSTextView) (nSGridViewArrayOfArray.GetCell (0, 0)).ContentView).Value, Is.EqualTo ("0"), "0,0");
+ Assert.That (((NSTextView) (nSGridViewArrayOfArray.GetCell (0, 1)).ContentView).Value, Is.EqualTo ("1"), "0,1");
+ Assert.That (((NSTextView) (nSGridViewArrayOfArray.GetCell (1, 1)).ContentView).Value, Is.EqualTo ("1bis"), "0,2");
}
[Test]
@@ -56,11 +56,11 @@ public void CreateWithTwoDimensionalNSViewArrayNSTextView ()
NSGridView nSGridViewTwoDimensionalArray = NSGridView.Create (nSViewsTwoDim);
- Assert.NotNull (nSGridViewTwoDimensionalArray);
- Assert.AreEqual ("0", ((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (0, 0)).ContentView).Value, "0,0");
- Assert.AreEqual ("1", ((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (0, 1)).ContentView).Value, "0,1");
- Assert.AreEqual ("2", ((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (1, 0)).ContentView).Value, "1,0");
- Assert.AreEqual ("3", ((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (1, 1)).ContentView).Value, "1,1");
+ Assert.That (nSGridViewTwoDimensionalArray, Is.Not.Null);
+ Assert.That (((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (0, 0)).ContentView).Value, Is.EqualTo ("0"), "0,0");
+ Assert.That (((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (0, 1)).ContentView).Value, Is.EqualTo ("1"), "0,1");
+ Assert.That (((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (1, 0)).ContentView).Value, Is.EqualTo ("2"), "1,0");
+ Assert.That (((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (1, 1)).ContentView).Value, Is.EqualTo ("3"), "1,1");
}
[Test]
@@ -74,11 +74,11 @@ public void CreateWithTwoDimensionalNSViewArrayCheckDifferentDimensionSize ()
NSGridView nSGridViewTwoDimensionalArray = NSGridView.Create (nSViewsTwoDim);
- Assert.NotNull (nSGridViewTwoDimensionalArray);
- Assert.AreEqual ("0", ((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (0, 0)).ContentView).Value, "0,0");
- Assert.AreEqual ("1", ((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (0, 1)).ContentView).Value, "0,1");
- Assert.AreEqual ("2", ((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (0, 2)).ContentView).Value, "0,2");
- Assert.AreEqual ("3", ((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (0, 3)).ContentView).Value, "0,3");
+ Assert.That (nSGridViewTwoDimensionalArray, Is.Not.Null);
+ Assert.That (((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (0, 0)).ContentView).Value, Is.EqualTo ("0"), "0,0");
+ Assert.That (((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (0, 1)).ContentView).Value, Is.EqualTo ("1"), "0,1");
+ Assert.That (((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (0, 2)).ContentView).Value, Is.EqualTo ("2"), "0,2");
+ Assert.That (((NSTextView) (nSGridViewTwoDimensionalArray.GetCell (0, 3)).ContentView).Value, Is.EqualTo ("3"), "0,3");
}
[Test]
diff --git a/tests/monotouch-test/AppKit/NSImage.cs b/tests/monotouch-test/AppKit/NSImage.cs
index c48003c598f9..16ad181a2e1a 100644
--- a/tests/monotouch-test/AppKit/NSImage.cs
+++ b/tests/monotouch-test/AppKit/NSImage.cs
@@ -13,7 +13,7 @@ public void ImageWithSize ()
var image = NSImage.ImageWithSize (new CGSize (50, 50), false, rect => {
return true;
});
- Assert.IsNotNull (image);
+ Assert.That (image, Is.Not.Null);
}
[Test]
@@ -22,11 +22,11 @@ public void NSImageCapInsets ()
var image = new NSImage ();
image.CapInsets = new NSEdgeInsets (5f, 6f, 7f, 8f);
- Assert.IsNotNull (image.CapInsets);
- Assert.IsTrue (image.CapInsets.Top == 5f, "NSImageCapInsets - Top value was not 5");
- Assert.IsTrue (image.CapInsets.Left == 6f, "NSImageCapInsets - Left value was not 6");
- Assert.IsTrue (image.CapInsets.Bottom == 7f, "NSImageCapInsets - Bottom value was not 7");
- Assert.IsTrue (image.CapInsets.Right == 8f, "NSImageCapInsets - Right value was not 8");
+ Assert.That (image.CapInsets, Is.Not.Null);
+ Assert.That (image.CapInsets.Top == 5f, Is.True, "NSImageCapInsets - Top value was not 5");
+ Assert.That (image.CapInsets.Left == 6f, Is.True, "NSImageCapInsets - Left value was not 6");
+ Assert.That (image.CapInsets.Bottom == 7f, Is.True, "NSImageCapInsets - Bottom value was not 7");
+ Assert.That (image.CapInsets.Right == 8f, Is.True, "NSImageCapInsets - Right value was not 8");
}
[Test]
@@ -34,8 +34,8 @@ public void NSImageResizingModeShouldChange ()
{
var image = new NSImage ();
image.ResizingMode = NSImageResizingMode.Stretch;
- Assert.AreEqual (image.ResizingMode, NSImageResizingMode.Stretch, "NSImageResizingMode - Was not equal to Stretch");
- Assert.AreNotEqual (image.ResizingMode, NSImageResizingMode.Tile, "NSImageResizingMode - Was incorrectly equal to Tile");
+ Assert.That (NSImageResizingMode.Stretch, Is.EqualTo (image.ResizingMode), "NSImageResizingMode - Was not equal to Stretch");
+ Assert.That (NSImageResizingMode.Tile, Is.Not.EqualTo (image.ResizingMode), "NSImageResizingMode - Was incorrectly equal to Tile");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSLayoutManagerTests.cs b/tests/monotouch-test/AppKit/NSLayoutManagerTests.cs
index 6ecdf24637b4..b6f5629e9e7c 100644
--- a/tests/monotouch-test/AppKit/NSLayoutManagerTests.cs
+++ b/tests/monotouch-test/AppKit/NSLayoutManagerTests.cs
@@ -35,7 +35,7 @@ public void NSLayoutManager_CharacterRangeForGlyphRange ()
{
NSRange pnt;
NSRange range = manager.GetCharacterRange (new NSRange (0, 4), out pnt);
- Assert.IsNotNull (range);
+ Assert.That (range, Is.Not.Null);
}
[Test]
@@ -43,7 +43,7 @@ public void NSLayoutManager_GlyphRangeForCharacterRange ()
{
NSRange pnt;
NSRange range = manager.GetGlyphRange (new NSRange (0, 4), out pnt);
- Assert.IsNotNull (range);
+ Assert.That (range, Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSOpenGLPixelFormat.cs b/tests/monotouch-test/AppKit/NSOpenGLPixelFormat.cs
index 02ade0fbb44d..54a66ec87f78 100644
--- a/tests/monotouch-test/AppKit/NSOpenGLPixelFormat.cs
+++ b/tests/monotouch-test/AppKit/NSOpenGLPixelFormat.cs
@@ -18,7 +18,7 @@ public void NSOpenGLPixelFormatAttributesShouldPassWith0Terminate ()
};
NSOpenGLPixelFormat pixelFormat = new NSOpenGLPixelFormat (_attribs);
- Assert.NotNull (pixelFormat);
+ Assert.That (pixelFormat, Is.Not.Null);
}
[Test]
@@ -28,7 +28,7 @@ public void NSOpenGLPixelFormatAttributesShouldWorkWithEmptyAttributes ()
};
NSOpenGLPixelFormat pixelFormat = new NSOpenGLPixelFormat (_attribs);
- Assert.NotNull (pixelFormat);
+ Assert.That (pixelFormat, Is.Not.Null);
}
[Test]
diff --git a/tests/monotouch-test/AppKit/NSPathControl.cs b/tests/monotouch-test/AppKit/NSPathControl.cs
index a9fe3bd1095a..4de0f83ed4f7 100644
--- a/tests/monotouch-test/AppKit/NSPathControl.cs
+++ b/tests/monotouch-test/AppKit/NSPathControl.cs
@@ -13,7 +13,7 @@ public void NSPathControlShouldSetEditable ()
var editable = control.Editable;
control.Editable = !editable;
- Assert.IsTrue (control.Editable != editable, "NSPathControlShouldSetEditable - Failed to change the Editable property");
+ Assert.That (control.Editable != editable, Is.True, "NSPathControlShouldSetEditable - Failed to change the Editable property");
}
[Test]
@@ -23,7 +23,7 @@ public void NSPathControlShouldSetAllowedTypes ()
var allowedTypes = control.AllowedTypes;
control.AllowedTypes = new [] { (NSString) "exe", (NSString) "jpg" };
- Assert.IsTrue (control.AllowedTypes != allowedTypes, "NSPathControlShouldSetAllowedTypes - Failed to change AllowedTypes property");
+ Assert.That (control.AllowedTypes != allowedTypes, Is.True, "NSPathControlShouldSetAllowedTypes - Failed to change AllowedTypes property");
}
[Test]
@@ -33,7 +33,7 @@ public void NSPathControlShouldSetPlaceholderString ()
var placeholderString = control.PlaceholderString;
control.PlaceholderString = "Test Placeholder";
- Assert.IsTrue (control.PlaceholderString != placeholderString, "NSPathControlShouldSetPlaceholderString - Failed to change PlaceholderString property");
+ Assert.That (control.PlaceholderString != placeholderString, Is.True, "NSPathControlShouldSetPlaceholderString - Failed to change PlaceholderString property");
}
[Test]
@@ -43,7 +43,7 @@ public void NSPathControlShouldSetPlaceholderAttributedString ()
var placeholderAttributedString = control.PlaceholderAttributedString;
control.PlaceholderAttributedString = new NSAttributedString ("Test Placeholder");
- Assert.IsTrue (control.PlaceholderAttributedString != placeholderAttributedString, "NSPathControlShouldSetPlaceholderAttributedString - Failed to change PlaceholderAttributedString property");
+ Assert.That (control.PlaceholderAttributedString != placeholderAttributedString, Is.True, "NSPathControlShouldSetPlaceholderAttributedString - Failed to change PlaceholderAttributedString property");
}
[Test]
@@ -53,7 +53,7 @@ public void NSPathControlShouldSetPathItems ()
var pathItems = control.PathItems;
control.PathItems = new [] { new NSPathControlItem () };
- Assert.IsTrue (control.PathItems != pathItems, "NSPathControlShouldSetPathItems - Failed to set PathItems property");
+ Assert.That (control.PathItems != pathItems, Is.True, "NSPathControlShouldSetPathItems - Failed to set PathItems property");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSPathControlItem.cs b/tests/monotouch-test/AppKit/NSPathControlItem.cs
index 7ab456635a38..eb183b3702e6 100644
--- a/tests/monotouch-test/AppKit/NSPathControlItem.cs
+++ b/tests/monotouch-test/AppKit/NSPathControlItem.cs
@@ -12,7 +12,7 @@ public void NSPathControlItemShouldSetTitle ()
var title = item.Title;
item.Title = "Test";
- Assert.IsTrue (item.Title != title, "NSPathControlShouldSetTitle - Title value did not change.");
+ Assert.That (item.Title != title, Is.True, "NSPathControlShouldSetTitle - Title value did not change.");
}
[Test]
@@ -22,7 +22,7 @@ public void NSPathControlItemShouldSetAttributedTitle ()
var attributedTitle = item.AttributedTitle;
item.AttributedTitle = new NSAttributedString ("Test");
- Assert.IsTrue (item.AttributedTitle != attributedTitle, "NSPathControlShouldSetAttributedTitle - AttributedTitle value did not change.");
+ Assert.That (item.AttributedTitle != attributedTitle, Is.True, "NSPathControlShouldSetAttributedTitle - AttributedTitle value did not change.");
}
@@ -30,10 +30,10 @@ public void NSPathControlItemShouldSetAttributedTitle ()
public void NSPathControlItemShouldSetImage ()
{
var item = new NSPathControlItem ();
- Assert.IsTrue (item.Image is null, "NSPathControlItemShouldSetImage - Image did not start as null");
+ Assert.That (item.Image is null, Is.True, "NSPathControlItemShouldSetImage - Image did not start as null");
item.Image = new NSImage ();
- Assert.IsTrue (item.Image is not null, "NSPathControlItemShouldSetImage - Failed to set Image property");
+ Assert.That (item.Image is not null, Is.True, "NSPathControlItemShouldSetImage - Failed to set Image property");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSScreen.cs b/tests/monotouch-test/AppKit/NSScreen.cs
index f2faae10f34e..6106666de9f9 100644
--- a/tests/monotouch-test/AppKit/NSScreen.cs
+++ b/tests/monotouch-test/AppKit/NSScreen.cs
@@ -17,8 +17,8 @@ public void ScreensNotMainThread ()
called.Set ();
});
backgroundThread.Start ();
- Assert.IsTrue (called.WaitOne (1000), "called");
- Assert.IsTrue (screensCount > 0, "screens count");
+ Assert.That (called.WaitOne (1000), Is.True, "called");
+ Assert.That (screensCount > 0, Is.True, "screens count");
}
[Test]
@@ -31,8 +31,8 @@ public void MainScreenNotMainThread ()
called.Set ();
});
backgroundThread.Start ();
- Assert.IsTrue (called.WaitOne (1000), "called");
- Assert.IsNotNull (main, "main screen");
+ Assert.That (called.WaitOne (1000), Is.True, "called");
+ Assert.That (main, Is.Not.Null, "main screen");
}
[Test]
@@ -48,9 +48,9 @@ public void DeepScreenNotMainThread ()
called.Set ();
});
backgroundThread.Start ();
- Assert.IsTrue (called.WaitOne (1000), "called");
+ Assert.That (called.WaitOne (1000), Is.True, "called");
if (screenCount > 1) {
- Assert.IsNotNull (deepScreen, "deep screen");
+ Assert.That (deepScreen, Is.Not.Null, "deep screen");
} else {
Assert.Inconclusive ("Only one screen detected.");
}
diff --git a/tests/monotouch-test/AppKit/NSSearchField.cs b/tests/monotouch-test/AppKit/NSSearchField.cs
index 98475e0cbc19..386b8e40c016 100644
--- a/tests/monotouch-test/AppKit/NSSearchField.cs
+++ b/tests/monotouch-test/AppKit/NSSearchField.cs
@@ -15,7 +15,7 @@ public void NSSearchFieldShouldSetSearchMenuTemplate ()
var searchMenuTemplate = searchField.SearchMenuTemplate;
searchField.SearchMenuTemplate = new NSMenu ("Test");
- Assert.IsTrue (searchField.SearchMenuTemplate != searchMenuTemplate, "NSSearchFieldShouldSetSearchMenuTemplate - Failed to set the SearchMenuTemplate property.");
+ Assert.That (searchField.SearchMenuTemplate != searchMenuTemplate, Is.True, "NSSearchFieldShouldSetSearchMenuTemplate - Failed to set the SearchMenuTemplate property.");
}
[Test]
@@ -27,7 +27,7 @@ public void NSSearchFieldShouldSetSendsWholeSearchString ()
var sendsWholeSearchString = searchField.SendsWholeSearchString;
searchField.SendsWholeSearchString = !sendsWholeSearchString;
- Assert.IsTrue (searchField.SendsWholeSearchString != sendsWholeSearchString, "NSSearchFieldShouldSetSendsWholeSearchString - Failed to set the SendsWholeSearchString property.");
+ Assert.That (searchField.SendsWholeSearchString != sendsWholeSearchString, Is.True, "NSSearchFieldShouldSetSendsWholeSearchString - Failed to set the SendsWholeSearchString property.");
}
[Test]
@@ -39,7 +39,7 @@ public void NSSearchFieldShouldSetMaximumRecents ()
var maximumRecents = searchField.MaximumRecents;
searchField.MaximumRecents = maximumRecents + 3;
- Assert.IsTrue (searchField.MaximumRecents != maximumRecents, "NSSearchFieldShouldSetMaximumRecents - Failed to set the MaximumRecents property.");
+ Assert.That (searchField.MaximumRecents != maximumRecents, Is.True, "NSSearchFieldShouldSetMaximumRecents - Failed to set the MaximumRecents property.");
}
[Test]
@@ -51,7 +51,7 @@ public void NSSearchFieldShouldSetSendsSearchStringImmediately ()
var sendsSearchStringImmediately = searchField.SendsSearchStringImmediately;
searchField.SendsSearchStringImmediately = !sendsSearchStringImmediately;
- Assert.IsTrue (searchField.SendsSearchStringImmediately != sendsSearchStringImmediately, "NSSearchFieldShouldSetSendsSearchStringImmediately - Failed to set the SendsSearchStringImmediately property.");
+ Assert.That (searchField.SendsSearchStringImmediately != sendsSearchStringImmediately, Is.True, "NSSearchFieldShouldSetSendsSearchStringImmediately - Failed to set the SendsSearchStringImmediately property.");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSSlider.cs b/tests/monotouch-test/AppKit/NSSlider.cs
index e65d154d420b..83e5d3164de6 100644
--- a/tests/monotouch-test/AppKit/NSSlider.cs
+++ b/tests/monotouch-test/AppKit/NSSlider.cs
@@ -15,7 +15,7 @@ public void NSSlider_VertialTests ()
NSSlider slider = new NSSlider ();
var isVert = slider.IsVertical;
slider.IsVertical = true;
- Assert.IsTrue (slider.IsVertical);
+ Assert.That (slider.IsVertical, Is.True);
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSSplitViewController.cs b/tests/monotouch-test/AppKit/NSSplitViewController.cs
index 918679eff29e..1ff1e1fe2677 100644
--- a/tests/monotouch-test/AppKit/NSSplitViewController.cs
+++ b/tests/monotouch-test/AppKit/NSSplitViewController.cs
@@ -20,7 +20,7 @@ public void NSSplitViewControllerShouldChangeSplitView ()
var splitView = controller.SplitView;
controller.SplitView = new NSSplitView ();
- Assert.IsFalse (controller.SplitView == splitView, "NSSplitViewControllerShouldChangeSplitView - Failed to set the SplitView property");
+ Assert.That (controller.SplitView == splitView, Is.False, "NSSplitViewControllerShouldChangeSplitView - Failed to set the SplitView property");
}
[Test]
@@ -29,7 +29,7 @@ public void NSSplitViewControllerShouldChangeSplitViewItems ()
var items = controller.SplitViewItems;
controller.SplitViewItems = new NSSplitViewItem [] { new NSSplitViewItem { ViewController = new NSViewController () } };
- Assert.IsFalse (controller.SplitViewItems == items, "NSSplitViewControllerShouldChangeSplitViewItems - Failed to set the SplitViewItems property");
+ Assert.That (controller.SplitViewItems == items, Is.False, "NSSplitViewControllerShouldChangeSplitViewItems - Failed to set the SplitViewItems property");
}
[Test]
@@ -38,7 +38,7 @@ public void NSSplitViewControllerShouldAddSplitViewItem ()
var item = new NSSplitViewItem { ViewController = new NSViewController () };
controller.AddSplitViewItem (item);
- Assert.IsTrue (controller.SplitViewItems.Contains (item), "NSSplitViewControllerShouldAddSplitViewItem - Failed to add item");
+ Assert.That (controller.SplitViewItems.Contains (item), Is.True, "NSSplitViewControllerShouldAddSplitViewItem - Failed to add item");
}
[Test]
@@ -47,11 +47,11 @@ public void NSSplitViewControllerShouldRemoveSplitViewItem ()
var item = new NSSplitViewItem { ViewController = new NSViewController () };
controller.AddSplitViewItem (item);
- Assert.IsTrue (controller.SplitViewItems.Contains (item), "NSSplitViewControllerShouldRemoveSplitViewItem - Failed to add item");
+ Assert.That (controller.SplitViewItems.Contains (item), Is.True, "NSSplitViewControllerShouldRemoveSplitViewItem - Failed to add item");
controller.RemoveSplitViewItem (item);
- Assert.IsFalse (controller.SplitViewItems.Contains (item), "NSSplitViewControllerShouldRemoveSplitViewItem - Failed to remove item");
+ Assert.That (controller.SplitViewItems.Contains (item), Is.False, "NSSplitViewControllerShouldRemoveSplitViewItem - Failed to remove item");
}
[Test]
@@ -63,8 +63,8 @@ public void NSSplitViewControllerShouldInsertSplitViewItem ()
var item = new NSSplitViewItem { ViewController = new NSViewController () };
controller.InsertSplitViewItem (item, 1);
- Assert.IsTrue (controller.SplitViewItems [1] == item, "NSSplitViewControllerShouldInsertSplitViewItem - Failed to insert the item at the given position.");
- Assert.IsFalse (controller.SplitViewItems [0] == item, "NSSplitViewControllerShouldInsertSplitViewItem - Inserted the item in the wrong position.");
+ Assert.That (controller.SplitViewItems [1] == item, Is.True, "NSSplitViewControllerShouldInsertSplitViewItem - Failed to insert the item at the given position.");
+ Assert.That (controller.SplitViewItems [0] == item, Is.False, "NSSplitViewControllerShouldInsertSplitViewItem - Inserted the item in the wrong position.");
}
[Test]
@@ -79,7 +79,7 @@ public void NSSplitViewControllerShouldGetSplitViewItem ()
var retrievedItem = controller.GetSplitViewItem (viewController);
- Assert.IsTrue (retrievedItem == item, "NSSplitViewControllerShouldGetSplitViewItem - Failed to get SplitViewItem from ViewController");
+ Assert.That (retrievedItem == item, Is.True, "NSSplitViewControllerShouldGetSplitViewItem - Failed to get SplitViewItem from ViewController");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSSplitViewItem.cs b/tests/monotouch-test/AppKit/NSSplitViewItem.cs
index ec14bad13aad..7cb547d83ec9 100644
--- a/tests/monotouch-test/AppKit/NSSplitViewItem.cs
+++ b/tests/monotouch-test/AppKit/NSSplitViewItem.cs
@@ -20,8 +20,8 @@ public void NSSplitViewItemShouldCreateFromViewController ()
var viewController = new NSViewController ();
var splitViewItem = NSSplitViewItem.FromViewController (viewController);
- Assert.IsFalse (splitViewItem is null, "NSSplitViewItemShouldCreateFromViewController - Returned null");
- Assert.IsTrue (splitViewItem.ViewController == viewController, "NSSplitViewItemShouldCreateFromViewController - ViewController property not set correctly");
+ Assert.That (splitViewItem is null, Is.False, "NSSplitViewItemShouldCreateFromViewController - Returned null");
+ Assert.That (splitViewItem.ViewController == viewController, Is.True, "NSSplitViewItemShouldCreateFromViewController - ViewController property not set correctly");
}
[Test]
@@ -30,7 +30,7 @@ public void NSSplitViewItemShouldChangeViewController ()
var viewController = item.ViewController;
item.ViewController = new NSViewController ();
- Assert.IsFalse (item.ViewController == viewController, "NSSplitViewItemShouldChangeViewController - Failed to set the ViewController property");
+ Assert.That (item.ViewController == viewController, Is.False, "NSSplitViewItemShouldChangeViewController - Failed to set the ViewController property");
}
[Test]
@@ -39,7 +39,7 @@ public void NSSplitViewItemShouldChangeCollapsed ()
var collapsed = item.Collapsed;
item.Collapsed = !collapsed;
- Assert.IsFalse (item.Collapsed == collapsed, "NSSplitViewItemShouldChangeCollapsed - Failed to set the Collapsed property");
+ Assert.That (item.Collapsed == collapsed, Is.False, "NSSplitViewItemShouldChangeCollapsed - Failed to set the Collapsed property");
}
[Test]
@@ -48,7 +48,7 @@ public void NSSplitViewItemShouldChangeCanCollapse ()
var canCollapse = item.CanCollapse;
item.CanCollapse = !canCollapse;
- Assert.IsFalse (item.CanCollapse == canCollapse, "NSSplitViewItemShouldChangeCanCollapse - Failed to set the CanCollapse property");
+ Assert.That (item.CanCollapse == canCollapse, Is.False, "NSSplitViewItemShouldChangeCanCollapse - Failed to set the CanCollapse property");
}
[Test]
@@ -57,7 +57,7 @@ public void NSSplitViewItemShouldChangeHoldingPriority ()
var holdingPriority = item.HoldingPriority;
item.HoldingPriority = 0.35f;
- Assert.IsFalse (item.HoldingPriority == holdingPriority, "NSSplitViewItemShouldChangeHoldingPriority - Failed to set the HoldingPriority property");
+ Assert.That (item.HoldingPriority == holdingPriority, Is.False, "NSSplitViewItemShouldChangeHoldingPriority - Failed to set the HoldingPriority property");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSStackView.cs b/tests/monotouch-test/AppKit/NSStackView.cs
index 607258b7b3d6..4df388936b53 100644
--- a/tests/monotouch-test/AppKit/NSStackView.cs
+++ b/tests/monotouch-test/AppKit/NSStackView.cs
@@ -23,7 +23,7 @@ public void SetUp ()
[Test]
public void NSStackViewShouldCreateWithEmptyConstructor ()
{
- Assert.IsNotNull (view, "NSStackViewCreateWithEmptyConstructor - Failed to create view");
+ Assert.That (view, Is.Not.Null, "NSStackViewCreateWithEmptyConstructor - Failed to create view");
}
[Test]
@@ -31,8 +31,8 @@ public void NSStackViewShouldCreateWithViews ()
{
view = NSStackView.FromViews (new [] { first, second });
- Assert.IsNotNull (view, "NSStackViewCreateWithViews - Failed to create view");
- Assert.IsTrue (view.Views.Length == 2, "NSStackViewShouldCreateWithViews - StackView does not have 2 views");
+ Assert.That (view, Is.Not.Null, "NSStackViewCreateWithViews - Failed to create view");
+ Assert.That (view.Views.Length == 2, Is.True, "NSStackViewShouldCreateWithViews - StackView does not have 2 views");
}
[Test]
@@ -40,7 +40,7 @@ public void NSStackViewShouldAddView ()
{
view.AddView (new NSView (), NSStackViewGravity.Bottom);
- Assert.IsTrue (view.Views.Length == 1, "NSStackViewShouldAddView - Failed to add view - length was 0");
+ Assert.That (view.Views.Length == 1, Is.True, "NSStackViewShouldAddView - Failed to add view - length was 0");
}
[Test]
@@ -51,8 +51,8 @@ public void NSStackViewShouldInsertView ()
view.InsertView (third, 1, NSStackViewGravity.Trailing);
- Assert.IsTrue (view.Views.Length == 3, "NSStackViewShouldInsertView - Wrong number of views");
- Assert.IsTrue (view.Views [1] == third, "NSStackViewShouldInsertView - New view not inserted at the correct location");
+ Assert.That (view.Views.Length == 3, Is.True, "NSStackViewShouldInsertView - Wrong number of views");
+ Assert.That (view.Views [1] == third, Is.True, "NSStackViewShouldInsertView - New view not inserted at the correct location");
}
[Test]
@@ -62,7 +62,7 @@ public void NSStackViewShouldRemoveView ()
view.RemoveView (second);
- Assert.IsTrue (view.Views.Length == 1, "NSStackViewShouldRemoveView - Failed to remove view");
+ Assert.That (view.Views.Length == 1, Is.True, "NSStackViewShouldRemoveView - Failed to remove view");
}
[Test]
@@ -70,9 +70,9 @@ public void NSStackViewShouldSetViews ()
{
view.SetViews (new [] { first, second }, NSStackViewGravity.Leading);
- Assert.IsTrue (view.Views.Length == 2, "NSStackViewShouldSetViews - Views length was not 0");
- Assert.IsTrue (view.ViewsInGravity (NSStackViewGravity.Leading).Length == 2, "NSStackViewShouldSetViews - ViewsInGravity Leading was not 2");
- Assert.IsTrue (view.ViewsInGravity (NSStackViewGravity.Trailing).Length == 0, "NSStackViewShouldSetViews - ViewsInGravity Trailing was not 0");
+ Assert.That (view.Views.Length == 2, Is.True, "NSStackViewShouldSetViews - Views length was not 0");
+ Assert.That (view.ViewsInGravity (NSStackViewGravity.Leading).Length == 2, Is.True, "NSStackViewShouldSetViews - ViewsInGravity Leading was not 2");
+ Assert.That (view.ViewsInGravity (NSStackViewGravity.Trailing).Length == 0, Is.True, "NSStackViewShouldSetViews - ViewsInGravity Trailing was not 0");
}
[Test]
@@ -81,7 +81,7 @@ public void NSStackViewShouldChangeAlignment ()
var alignment = view.Alignment;
view.Alignment = NSLayoutAttribute.Right;
- Assert.IsFalse (view.Alignment == alignment, "NSStackViewShouldChangeAlignment - Failed to change Alignment property");
+ Assert.That (view.Alignment == alignment, Is.False, "NSStackViewShouldChangeAlignment - Failed to change Alignment property");
}
[Test]
@@ -90,7 +90,7 @@ public void NSStackViewShouldChangeOrientation ()
var orientation = view.Orientation;
view.Orientation = NSUserInterfaceLayoutOrientation.Vertical;
- Assert.IsFalse (view.Orientation == orientation, "NSStackViewShouldChangeOrientation - Failed to change Orientation property");
+ Assert.That (view.Orientation == orientation, Is.False, "NSStackViewShouldChangeOrientation - Failed to change Orientation property");
}
[Test]
@@ -99,7 +99,7 @@ public void NSStackViewShouldChangeSpacing ()
var spacing = view.Spacing;
view.Spacing = spacing + 3;
- Assert.IsFalse (view.Spacing == spacing, "NSStackViewShouldChangeSpacing - Failed to change Spacing property");
+ Assert.That (view.Spacing == spacing, Is.False, "NSStackViewShouldChangeSpacing - Failed to change Spacing property");
}
[Test]
@@ -108,10 +108,10 @@ public void NSStackViewShouldChangeEdgeInsets ()
var edgeInsets = view.EdgeInsets;
view.EdgeInsets = new NSEdgeInsets (20, 20, 20, 20);
- Assert.IsFalse (view.EdgeInsets.Left == edgeInsets.Left, "NSStackViewShouldChangeEdgeInsets - Failed to change EdgeInsets property");
- Assert.IsFalse (view.EdgeInsets.Right == edgeInsets.Right, "NSStackViewShouldChangeEdgeInsets - Failed to change EdgeInsets property");
- Assert.IsFalse (view.EdgeInsets.Top == edgeInsets.Top, "NSStackViewShouldChangeEdgeInsets - Failed to change EdgeInsets property");
- Assert.IsFalse (view.EdgeInsets.Bottom == edgeInsets.Bottom, "NSStackViewShouldChangeEdgeInsets - Failed to change EdgeInsets property");
+ Assert.That (view.EdgeInsets.Left == edgeInsets.Left, Is.False, "NSStackViewShouldChangeEdgeInsets - Failed to change EdgeInsets property");
+ Assert.That (view.EdgeInsets.Right == edgeInsets.Right, Is.False, "NSStackViewShouldChangeEdgeInsets - Failed to change EdgeInsets property");
+ Assert.That (view.EdgeInsets.Top == edgeInsets.Top, Is.False, "NSStackViewShouldChangeEdgeInsets - Failed to change EdgeInsets property");
+ Assert.That (view.EdgeInsets.Bottom == edgeInsets.Bottom, Is.False, "NSStackViewShouldChangeEdgeInsets - Failed to change EdgeInsets property");
}
[Test]
@@ -120,7 +120,7 @@ public void NSStackViewShouldChangeHasEqualSpacing ()
var hasEqualSpacing = view.HasEqualSpacing;
view.HasEqualSpacing = !hasEqualSpacing;
- Assert.IsFalse (view.HasEqualSpacing == hasEqualSpacing, "NSStackViewShouldChangeHasEqualSpacing - Failed to change HasEqualSpacing property");
+ Assert.That (view.HasEqualSpacing == hasEqualSpacing, Is.False, "NSStackViewShouldChangeHasEqualSpacing - Failed to change HasEqualSpacing property");
}
// [Test]
@@ -129,7 +129,7 @@ public void NSStackViewShouldChangeHasEqualSpacing ()
// var view = new NSStackView ();
// view.Delegate = new NSStackViewDelegate ();
//
- // Assert.IsNotNull (view.Delegate, "NSStackViewShouldSetDelegate - Delegate property returned null");
+ // Assert.That (view.Delegate, Is.Not.Null, "NSStackViewShouldSetDelegate - Delegate property returned null");
// }
[Test]
@@ -138,8 +138,7 @@ public void NSStackViewShouldChangeClippingResistance ()
var clippingResistance = view.ClippingResistancePriorityForOrientation (NSLayoutConstraintOrientation.Vertical);
view.SetClippingResistancePriority (clippingResistance + 3, NSLayoutConstraintOrientation.Vertical);
- Assert.IsFalse (view.ClippingResistancePriorityForOrientation (NSLayoutConstraintOrientation.Vertical) == clippingResistance,
- "NSStackViewShouldChangeClippingResistance - Failed to set ClippingResistance");
+ Assert.That (view.ClippingResistancePriorityForOrientation (NSLayoutConstraintOrientation.Vertical) == clippingResistance, Is.False, "NSStackViewShouldChangeClippingResistance - Failed to set ClippingResistance");
}
[Test]
@@ -148,8 +147,7 @@ public void NSStackViewShouldChangeHuggingPriority ()
var huggingPriority = view.HuggingPriority (NSLayoutConstraintOrientation.Horizontal);
view.SetHuggingPriority (huggingPriority + 10, NSLayoutConstraintOrientation.Horizontal);
- Assert.IsFalse (view.HuggingPriority (NSLayoutConstraintOrientation.Horizontal) == huggingPriority,
- "NSStackViewShouldChangeHuggingPriority - Failed to set HuggingPriority");
+ Assert.That (view.HuggingPriority (NSLayoutConstraintOrientation.Horizontal) == huggingPriority, Is.False, "NSStackViewShouldChangeHuggingPriority - Failed to set HuggingPriority");
}
[Test]
@@ -161,8 +159,7 @@ public void NSStackViewShouldChangeCustomSpacing ()
var customSpacing = view.CustomSpacingAfterView (first);
view.SetCustomSpacing (10, first);
- Assert.IsFalse (view.CustomSpacingAfterView (first) == customSpacing,
- "NSStackViewShouldChangeCustomSpacing - Failed to set CustomSpacing");
+ Assert.That (view.CustomSpacingAfterView (first) == customSpacing, Is.False, "NSStackViewShouldChangeCustomSpacing - Failed to set CustomSpacing");
}
[Test]
@@ -174,8 +171,7 @@ public void NSStackViewShouldChangeVisibilityPriority ()
var visibilityPriority = view.VisibilityPriority (first);
view.SetVisibilityPriority (10, first);
- Assert.IsFalse (view.VisibilityPriority (first) == visibilityPriority,
- "NSStackViewShouldChangeVisibilityPriority - Failed to set VisibilityPriority");
+ Assert.That (view.VisibilityPriority (first) == visibilityPriority, Is.False, "NSStackViewShouldChangeVisibilityPriority - Failed to set VisibilityPriority");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSStepperCell.cs b/tests/monotouch-test/AppKit/NSStepperCell.cs
index aedf7405e8c3..c6da6f90d95a 100644
--- a/tests/monotouch-test/AppKit/NSStepperCell.cs
+++ b/tests/monotouch-test/AppKit/NSStepperCell.cs
@@ -20,7 +20,7 @@ public void NSStepperCell_ShouldSetMinValue ()
var minValue = cell.MinValue;
cell.MinValue = 3.14159;
- Assert.IsTrue (cell.MinValue != minValue, "NSStepperCell_ShouldSetMinValue - Failed to set the MinValue property");
+ Assert.That (cell.MinValue != minValue, Is.True, "NSStepperCell_ShouldSetMinValue - Failed to set the MinValue property");
}
[Test]
@@ -29,7 +29,7 @@ public void NSStepperCell_ShouldSetMaxValue ()
var maxValue = cell.MaxValue;
cell.MaxValue = 3.14159;
- Assert.IsTrue (cell.MinValue != maxValue, "NSStepperCell_ShouldSetMaxValue - Failed to set the MaxValue property");
+ Assert.That (cell.MinValue != maxValue, Is.True, "NSStepperCell_ShouldSetMaxValue - Failed to set the MaxValue property");
}
[Test]
public void NSStepperCell_ShouldSetIncrement ()
@@ -37,7 +37,7 @@ public void NSStepperCell_ShouldSetIncrement ()
var increment = cell.Increment;
cell.Increment = 3.14159;
- Assert.IsTrue (cell.Increment != increment, "NSStepperCell_ShouldSetIncrement - Failed to set the Increment property");
+ Assert.That (cell.Increment != increment, Is.True, "NSStepperCell_ShouldSetIncrement - Failed to set the Increment property");
}
[Test]
public void NSStepperCell_ShouldSetValueWraps ()
@@ -45,7 +45,7 @@ public void NSStepperCell_ShouldSetValueWraps ()
var valueWraps = cell.ValueWraps;
cell.ValueWraps = !valueWraps;
- Assert.IsTrue (cell.ValueWraps != valueWraps, "NSStepperCell_ShouldSetValueWraps - Failed to set the ValueWraps property");
+ Assert.That (cell.ValueWraps != valueWraps, Is.True, "NSStepperCell_ShouldSetValueWraps - Failed to set the ValueWraps property");
}
[Test]
public void NSStepperCell_ShouldSetAutoRepeat ()
@@ -53,7 +53,7 @@ public void NSStepperCell_ShouldSetAutoRepeat ()
var autoRepeat = cell.Autorepeat;
cell.Autorepeat = !autoRepeat;
- Assert.IsTrue (cell.Autorepeat != autoRepeat, "NSStepperCell_ShouldSetAutoRepeat - Failed to set the Autorepeat property");
+ Assert.That (cell.Autorepeat != autoRepeat, Is.True, "NSStepperCell_ShouldSetAutoRepeat - Failed to set the Autorepeat property");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSStoryboardSegue.cs b/tests/monotouch-test/AppKit/NSStoryboardSegue.cs
index 8c072784c3d8..de226fc852a7 100644
--- a/tests/monotouch-test/AppKit/NSStoryboardSegue.cs
+++ b/tests/monotouch-test/AppKit/NSStoryboardSegue.cs
@@ -20,27 +20,27 @@ public void Setup ()
[Test]
public void NSStoryboardSegueShouldCreateSegueWithConstructor ()
{
- Assert.IsNotNull (segue, "NSStoryboardSegueShouldCreateSegueWithConstructor - Failed to create segue, value is null");
+ Assert.That (segue, Is.Not.Null, "NSStoryboardSegueShouldCreateSegueWithConstructor - Failed to create segue, value is null");
}
[Test]
public void NSStoryboardSegueShouldGetIdentifier ()
{
- Assert.IsFalse (string.IsNullOrEmpty (segue.Identifier), "NSStoryboardSegueShouldGetIdentifier - Identifier property was empty or null");
+ Assert.That (string.IsNullOrEmpty (segue.Identifier), Is.False, "NSStoryboardSegueShouldGetIdentifier - Identifier property was empty or null");
}
[Test]
public void NSStoryboardSegueShouldGetSourceController ()
{
- Assert.IsNotNull (segue.SourceController, "NSStoryboardSegueShouldGetSourceController - Source controller was null");
- Assert.IsTrue (segue.SourceController == source, "NSStoryboardSegueShouldGetSourceController - Source controller did not match the source controller passed into the segue.");
+ Assert.That (segue.SourceController, Is.Not.Null, "NSStoryboardSegueShouldGetSourceController - Source controller was null");
+ Assert.That (segue.SourceController == source, Is.True, "NSStoryboardSegueShouldGetSourceController - Source controller did not match the source controller passed into the segue.");
}
[Test]
public void NSStoryboardSegueShouldGetDestinationController ()
{
- Assert.IsNotNull (segue.DestinationController, "NSStoryboardSegueShouldGetDestinationController - Destination controller was null");
- Assert.IsTrue (segue.DestinationController == destination, "NSStoryboardSegueShouldGetDestinationController - Destination controller did not mass the destination controller passed into the segue.");
+ Assert.That (segue.DestinationController, Is.Not.Null, "NSStoryboardSegueShouldGetDestinationController - Destination controller was null");
+ Assert.That (segue.DestinationController == destination, Is.True, "NSStoryboardSegueShouldGetDestinationController - Destination controller did not mass the destination controller passed into the segue.");
}
#if false // Crashes when run in test from command line, works from an actual app
@@ -49,7 +49,7 @@ public void NSStoryboardSegueShouldCreateSegueWithStaticMethod ()
{
var segue = NSStoryboardSegue.FromIdentifier ("Test", new NSViewController (), new NSViewController (), () => {
});
- Assert.IsNotNull (segue);
+ Assert.That (segue, Is.Not.Null);
}
#endif
}
diff --git a/tests/monotouch-test/AppKit/NSTabViewController.cs b/tests/monotouch-test/AppKit/NSTabViewController.cs
index a5c23ba28c0a..61a36a5f2f75 100644
--- a/tests/monotouch-test/AppKit/NSTabViewController.cs
+++ b/tests/monotouch-test/AppKit/NSTabViewController.cs
@@ -21,7 +21,7 @@ public void NSTabViewControllerShouldChangeTabStyle ()
var tabStyle = controller.TabStyle;
controller.TabStyle = NSTabViewControllerTabStyle.Toolbar;
- Assert.IsFalse (controller.TabStyle == tabStyle, "NSTabViewControllerShouldChangeTabStyle - Failed to set the TabStyle property");
+ Assert.That (controller.TabStyle == tabStyle, Is.False, "NSTabViewControllerShouldChangeTabStyle - Failed to set the TabStyle property");
}
// [Test]
@@ -30,7 +30,7 @@ public void NSTabViewControllerShouldChangeTabStyle ()
// var tabView = controller.TabView;
// controller.TabView = new NSTabView ();
//
- // Assert.IsFalse (controller.TabView == tabView, "NSTabViewControllerShouldChangeTabView - Failed to set the TabView property");
+ // Assert.That (controller.TabView == tabView, Is.False, "NSTabViewControllerShouldChangeTabView - Failed to set the TabView property");
// }
[Test]
@@ -39,7 +39,7 @@ public void NSTabViewControllerShouldChangeTransitionOptions ()
var options = controller.TransitionOptions;
controller.TransitionOptions = NSViewControllerTransitionOptions.Crossfade | NSViewControllerTransitionOptions.SlideRight;
- Assert.IsFalse (controller.TransitionOptions == options, "NSTabViewControllerShouldChangeTransitionOptions - Failed to set the TransitionOptions property");
+ Assert.That (controller.TransitionOptions == options, Is.False, "NSTabViewControllerShouldChangeTransitionOptions - Failed to set the TransitionOptions property");
}
[Test]
@@ -48,7 +48,7 @@ public void NSTabViewControllerShouldChangeCanPropagateSelectedChildViewControll
var canPropogate = controller.CanPropagateSelectedChildViewControllerTitle;
controller.CanPropagateSelectedChildViewControllerTitle = !canPropogate;
- Assert.IsFalse (controller.CanPropagateSelectedChildViewControllerTitle == canPropogate, "NSTabViewControllerShouldChangeCanPropagateSelectedChildViewControllerTitle - Failed to set the CanPropagateSelectedChildViewControllerTitle property");
+ Assert.That (controller.CanPropagateSelectedChildViewControllerTitle == canPropogate, Is.False, "NSTabViewControllerShouldChangeCanPropagateSelectedChildViewControllerTitle - Failed to set the CanPropagateSelectedChildViewControllerTitle property");
}
[Test]
@@ -57,7 +57,7 @@ public void NSTabViewControllerShouldChangeTabViewItems ()
var items = controller.TabViewItems;
controller.TabViewItems = new NSTabViewItem [] { new NSTabViewItem { ViewController = new NSViewController () } };
- Assert.IsFalse (controller.TabViewItems == items, "NSTabViewControllerShouldChangeTabViewItems - Failed to set the TabViewItems property");
+ Assert.That (controller.TabViewItems == items, Is.False, "NSTabViewControllerShouldChangeTabViewItems - Failed to set the TabViewItems property");
}
[Test]
@@ -72,7 +72,7 @@ public void NSTabViewControllerShouldChangeSelectedTabViewItemIndex ()
var index = controller.SelectedTabViewItemIndex;
controller.SelectedTabViewItemIndex = (index + 1) % 3;
- Assert.IsFalse (controller.SelectedTabViewItemIndex == index, "NSTabViewControllerShouldChangeSelectedTabViewItemIndex - Failed to set the SelectedTabViewItemIndex property");
+ Assert.That (controller.SelectedTabViewItemIndex == index, Is.False, "NSTabViewControllerShouldChangeSelectedTabViewItemIndex - Failed to set the SelectedTabViewItemIndex property");
}
[Test]
@@ -81,7 +81,7 @@ public void NSTabViewControllerShouldAddTabViewItem ()
var item = new NSTabViewItem { ViewController = new NSViewController () };
controller.AddTabViewItem (item);
- Assert.IsTrue (controller.TabViewItems.Contains (item), "NSTabViewControllerShouldAddTabViewItem - Failed to add TabViewItem");
+ Assert.That (controller.TabViewItems.Contains (item), Is.True, "NSTabViewControllerShouldAddTabViewItem - Failed to add TabViewItem");
}
[Test]
@@ -90,11 +90,11 @@ public void NSTabViewControllerShouldRemoveTabViewItem ()
var item = new NSTabViewItem { ViewController = new NSViewController () };
controller.AddTabViewItem (item);
- Assert.IsTrue (controller.TabViewItems.Contains (item), "NSTabViewControllerShouldRemoveTabViewItem - Failed to add item");
+ Assert.That (controller.TabViewItems.Contains (item), Is.True, "NSTabViewControllerShouldRemoveTabViewItem - Failed to add item");
controller.RemoveTabViewItem (item);
- Assert.IsFalse (controller.TabViewItems.Contains (item), "NSTabViewControllerShouldRemoveTabViewItem - Failed to remove item");
+ Assert.That (controller.TabViewItems.Contains (item), Is.False, "NSTabViewControllerShouldRemoveTabViewItem - Failed to remove item");
}
[Test]
@@ -106,8 +106,8 @@ public void NSTabViewControllerShouldInsertTabViewItem ()
var item = new NSTabViewItem { ViewController = new NSViewController () };
controller.InsertTabViewItem (item, 1);
- Assert.IsTrue (controller.TabViewItems [1] == item, "NSTabViewControllerShouldInsertTabViewItem - Failed to insert the item at the given position.");
- Assert.IsFalse (controller.TabViewItems [0] == item, "NSTabViewControllerShouldInsertTabViewItem - Inserted the item in the wrong position.");
+ Assert.That (controller.TabViewItems [1] == item, Is.True, "NSTabViewControllerShouldInsertTabViewItem - Failed to insert the item at the given position.");
+ Assert.That (controller.TabViewItems [0] == item, Is.False, "NSTabViewControllerShouldInsertTabViewItem - Inserted the item in the wrong position.");
}
[Test]
@@ -122,7 +122,7 @@ public void NSTabViewControllerShouldGetTabViewItem ()
var retrievedItem = controller.GetTabViewItem (viewController);
- Assert.IsTrue (retrievedItem == item, "NSTabViewControllerShouldGetTabViewItem - Failed to get TabViewItem from ViewController");
+ Assert.That (retrievedItem == item, Is.True, "NSTabViewControllerShouldGetTabViewItem - Failed to get TabViewItem from ViewController");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSTabViewItem.cs b/tests/monotouch-test/AppKit/NSTabViewItem.cs
index 6a269b60302b..fd1f4ab3a89d 100644
--- a/tests/monotouch-test/AppKit/NSTabViewItem.cs
+++ b/tests/monotouch-test/AppKit/NSTabViewItem.cs
@@ -19,7 +19,7 @@ public void NSTabViewItemShouldChangeImage ()
var image = item.Image;
item.Image = new NSImage ();
- Assert.IsFalse (item.Image == image, "NSTabViewItemShouldChangeImage - Failed to set the Image property");
+ Assert.That (item.Image == image, Is.False, "NSTabViewItemShouldChangeImage - Failed to set the Image property");
}
[Test]
@@ -28,7 +28,7 @@ public void NSTabViewItemShouldChangeViewController ()
var vc = item.ViewController;
item.ViewController = new NSViewController ();
- Assert.IsFalse (item.ViewController == vc, "NSTabViewItemShouldChangeViewController - Failed to set the ViewController property");
+ Assert.That (item.ViewController == vc, Is.False, "NSTabViewItemShouldChangeViewController - Failed to set the ViewController property");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSTableColumn.cs b/tests/monotouch-test/AppKit/NSTableColumn.cs
index 801d16c625b4..6827c94d0991 100644
--- a/tests/monotouch-test/AppKit/NSTableColumn.cs
+++ b/tests/monotouch-test/AppKit/NSTableColumn.cs
@@ -19,7 +19,7 @@ public void NSTableColumnShouldChangeTitle ()
var title = column.Title;
column.Title = "Test";
- Assert.IsFalse (column.Title == title, "NSTableColumnShouldChangeTitle - Failed to set the Title property");
+ Assert.That (column.Title == title, Is.False, "NSTableColumnShouldChangeTitle - Failed to set the Title property");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSTableRowView.cs b/tests/monotouch-test/AppKit/NSTableRowView.cs
index 4436827d068d..32d45cb3d7ee 100644
--- a/tests/monotouch-test/AppKit/NSTableRowView.cs
+++ b/tests/monotouch-test/AppKit/NSTableRowView.cs
@@ -19,7 +19,7 @@ public void NSTableRowViewShouldChangePreviousRowSelected ()
var selected = view.PreviousRowSelected;
view.PreviousRowSelected = !selected;
- Assert.IsFalse (view.PreviousRowSelected == selected, "NSTableRowViewShouldChangePreviousRowSelected - Failed to set the PreviousRowSelected property");
+ Assert.That (view.PreviousRowSelected == selected, Is.False, "NSTableRowViewShouldChangePreviousRowSelected - Failed to set the PreviousRowSelected property");
}
[Test]
@@ -28,7 +28,7 @@ public void NSTableRowViewShouldChangeNextRowSelected ()
var selected = view.NextRowSelected;
view.NextRowSelected = !selected;
- Assert.IsFalse (view.NextRowSelected == selected, "NSTableRowViewShouldChangeNextRowSelected - Failed to set the NextRowSelected property");
+ Assert.That (view.NextRowSelected == selected, Is.False, "NSTableRowViewShouldChangeNextRowSelected - Failed to set the NextRowSelected property");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSTextField.cs b/tests/monotouch-test/AppKit/NSTextField.cs
index 44244c9e8f98..9af67abd0f4f 100644
--- a/tests/monotouch-test/AppKit/NSTextField.cs
+++ b/tests/monotouch-test/AppKit/NSTextField.cs
@@ -19,7 +19,7 @@ public void NSTextFieldShouldChangePlaceholderString ()
var placeholder = textField.PlaceholderString;
textField.PlaceholderString = "Test";
- Assert.IsFalse (textField.PlaceholderString == placeholder, "NSTextFieldShouldChangePlaceholderString - Failed to set the PlaceholderString property");
+ Assert.That (textField.PlaceholderString == placeholder, Is.False, "NSTextFieldShouldChangePlaceholderString - Failed to set the PlaceholderString property");
}
[Test]
@@ -28,7 +28,7 @@ public void NSTextFieldShouldChangePlaceholderAttributedString ()
var placeholder = textField.PlaceholderAttributedString;
textField.PlaceholderAttributedString = new NSAttributedString ("Test");
- Assert.IsFalse (textField.PlaceholderAttributedString == placeholder, "NSTextFieldShouldChangePlaceholderAttributedString - Failed to set the PlaceholderAttributedString property");
+ Assert.That (textField.PlaceholderAttributedString == placeholder, Is.False, "NSTextFieldShouldChangePlaceholderAttributedString - Failed to set the PlaceholderAttributedString property");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSTextFinder.cs b/tests/monotouch-test/AppKit/NSTextFinder.cs
index c922d955e69a..8a5c789fc2cb 100644
--- a/tests/monotouch-test/AppKit/NSTextFinder.cs
+++ b/tests/monotouch-test/AppKit/NSTextFinder.cs
@@ -13,7 +13,7 @@ public class NSTextFinderTests {
public void NSTextFinderConstructor ()
{
NSTextFinder f = new NSTextFinder ();
- Assert.IsNotNull (f);
+ Assert.That (f, Is.Not.Null);
FinderClient client = new FinderClient ();
f.Client = client;
diff --git a/tests/monotouch-test/AppKit/NSTextInputClient.cs b/tests/monotouch-test/AppKit/NSTextInputClient.cs
index 3554327c1a18..0a7ed3d4a19d 100644
--- a/tests/monotouch-test/AppKit/NSTextInputClient.cs
+++ b/tests/monotouch-test/AppKit/NSTextInputClient.cs
@@ -14,7 +14,7 @@ public void SetUp ()
{
textView = new NSTextView (new CGRect (0, 0, 37, 120));
textView.Value = "This is a new string";
- Assert.AreEqual (textView.Value, "This is a new string", "NSTextInputClientSetup - Failed to set value");
+ Assert.That ("This is a new string", Is.EqualTo (textView.Value), "NSTextInputClientSetup - Failed to set value");
}
[TearDown]
@@ -28,7 +28,7 @@ public void NSTextInputClient_ShouldInsertText ()
{
textView.InsertText ((NSString) "Test", new NSRange (5, 4));
- Assert.AreEqual (textView.Value, "This Test new string", "NSTextInputClient_ShouldInsertText - Failed to insert text");
+ Assert.That ("This Test new string", Is.EqualTo (textView.Value), "NSTextInputClient_ShouldInsertText - Failed to insert text");
}
[Test]
@@ -36,8 +36,8 @@ public void NSTextInputClient_ShouldMarkText ()
{
textView.SetMarkedText ((NSString) "Testing", new NSRange (0, 10), new NSRange (5, 4));
- Assert.IsTrue (textView.HasMarkedText, "NSTextInputClient_ShouldMarkText - Failed to mark text");
- Assert.AreEqual (textView.MarkedRange, new NSRange (5, 7));
+ Assert.That (textView.HasMarkedText, Is.True, "NSTextInputClient_ShouldMarkText - Failed to mark text");
+ Assert.That (new NSRange (5, 7), Is.EqualTo (textView.MarkedRange));
textView.UnmarkText ();
}
@@ -45,7 +45,7 @@ public void NSTextInputClient_ShouldMarkText ()
[Test]
public void NSTextInputClient_ShouldGetValidAttributesForMarkedText ()
{
- Assert.IsTrue (textView.ValidAttributesForMarkedText.Length > 0, "NSTextInputClient_ShouldGetValidAttributesForMarkedTExt - No valid attributes");
+ Assert.That (textView.ValidAttributesForMarkedText.Length > 0, Is.True, "NSTextInputClient_ShouldGetValidAttributesForMarkedTExt - No valid attributes");
}
[Test]
@@ -53,12 +53,12 @@ public void NSTextInputClient_ShouldUnmarkText ()
{
textView.SetMarkedText ((NSString) "Testing", new NSRange (0, 10), new NSRange (5, 4));
- Assert.IsTrue (textView.HasMarkedText, "NSTextInputClient_ShouldUnMarkText - Failed to mark text");
+ Assert.That (textView.HasMarkedText, Is.True, "NSTextInputClient_ShouldUnMarkText - Failed to mark text");
textView.UnmarkText ();
- Assert.IsFalse (textView.HasMarkedText, "NSTextInputClient_ShouldUnmarkText - Failed to Unmark text");
- Assert.IsTrue (textView.MarkedRange.Length == 0, "NSTextInputClient_ShouldUnmarkText - MarkedRange is not 0");
+ Assert.That (textView.HasMarkedText, Is.False, "NSTextInputClient_ShouldUnmarkText - Failed to Unmark text");
+ Assert.That (textView.MarkedRange.Length == 0, Is.True, "NSTextInputClient_ShouldUnmarkText - MarkedRange is not 0");
}
[Test]
@@ -67,8 +67,8 @@ public void NSTextInputClient_ShouldGetAttributedSubstring ()
NSRange range;
var attributedString = textView.GetAttributedSubstring (new NSRange (10, 15), out range);
- Assert.AreEqual (attributedString.Value, "new string", "NSTextInputClient_ShouldGetAttributedSubstring - Failed to get the correct string");
- Assert.AreEqual (range, new NSRange (10, 10), "NSTextInputClient_ShouldGetAttributedSubstring - Wrong range value returned");
+ Assert.That ("new string", Is.EqualTo (attributedString.Value), "NSTextInputClient_ShouldGetAttributedSubstring - Failed to get the correct string");
+ Assert.That (new NSRange (10, 10), Is.EqualTo (range), "NSTextInputClient_ShouldGetAttributedSubstring - Wrong range value returned");
}
[Test]
@@ -88,13 +88,13 @@ public void NSTextInputClient_ShouldGetFirstRect ()
[Test]
public void NSTextInputClient_ShouldGetAttributedString ()
{
- Assert.AreEqual (textView.AttributedString.Value, "This is a new string", "NSTextInputClient_ShouldGetAttributedString - Returned the wrong attributed string");
+ Assert.That ("This is a new string", Is.EqualTo (textView.AttributedString.Value), "NSTextInputClient_ShouldGetAttributedString - Returned the wrong attributed string");
}
[Test]
public void NSTextInputClient_ShouldGetFractionofDistanceThroughGlyph ()
{
- Assert.IsTrue (textView.GetFractionOfDistanceThroughGlyph (new CGPoint (1, 2)) == 0, "NSTextInputClient_ShouldGetFractionofDistanceThroughGlyph - Returned wrong fraaction value");
+ Assert.That (textView.GetFractionOfDistanceThroughGlyph (new CGPoint (1, 2)) == 0, Is.True, "NSTextInputClient_ShouldGetFractionofDistanceThroughGlyph - Returned wrong fraaction value");
}
[Test]
@@ -106,13 +106,13 @@ public void NSTextInputClient_ShouldGetBaselineDelta ()
[Test]
public void NSTextInputClient_ShouldGetDrawsVertically ()
{
- Assert.IsFalse (textView.DrawsVertically (4), "NSTextInputClient_ShouldGetDrawsVertically - Returned wrong value");
+ Assert.That (textView.DrawsVertically (4), Is.False, "NSTextInputClient_ShouldGetDrawsVertically - Returned wrong value");
}
[Test]
public void NSTextInputClient_ShouldGetWindowLevel ()
{
- Assert.AreEqual (textView.WindowLevel, NSWindowLevel.Normal, "NSTextInputClient_ShouldGetWindowLevel - WindowLevel returned the wrong value");
+ Assert.That (NSWindowLevel.Normal, Is.EqualTo (textView.WindowLevel), "NSTextInputClient_ShouldGetWindowLevel - WindowLevel returned the wrong value");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSTextView.cs b/tests/monotouch-test/AppKit/NSTextView.cs
index 956920381808..2e4dde9c5f90 100644
--- a/tests/monotouch-test/AppKit/NSTextView.cs
+++ b/tests/monotouch-test/AppKit/NSTextView.cs
@@ -19,7 +19,7 @@ public void NSTextViewShouldChangeUsesRolloverButtonForSelection ()
var usesRollover = view.UsesRolloverButtonForSelection;
view.UsesRolloverButtonForSelection = !usesRollover;
- Assert.IsFalse (view.UsesRolloverButtonForSelection == usesRollover, "NSTextViewShouldChangeUsesRolloverButtonForSelection - Failed to set the UsesRolloverButtonForSelection property");
+ Assert.That (view.UsesRolloverButtonForSelection == usesRollover, Is.False, "NSTextViewShouldChangeUsesRolloverButtonForSelection - Failed to set the UsesRolloverButtonForSelection property");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSToolbar.cs b/tests/monotouch-test/AppKit/NSToolbar.cs
index c144f4d9d7fa..5c736525cc4b 100644
--- a/tests/monotouch-test/AppKit/NSToolbar.cs
+++ b/tests/monotouch-test/AppKit/NSToolbar.cs
@@ -20,7 +20,7 @@ public void NSToolbarShouldChangeAllowsExtensionItems ()
var allows = toolbar.AllowsExtensionItems;
toolbar.AllowsExtensionItems = !allows;
- Assert.IsFalse (toolbar.AllowsExtensionItems == allows, "NSToolbarShouldChangeAllowsExtensionItems - Failed to set the AllowsExtensionItems property");
+ Assert.That (toolbar.AllowsExtensionItems == allows, Is.False, "NSToolbarShouldChangeAllowsExtensionItems - Failed to set the AllowsExtensionItems property");
}
[Test]
diff --git a/tests/monotouch-test/AppKit/NSToolbarItem.cs b/tests/monotouch-test/AppKit/NSToolbarItem.cs
index 21df96163c84..071f4c82e0cf 100644
--- a/tests/monotouch-test/AppKit/NSToolbarItem.cs
+++ b/tests/monotouch-test/AppKit/NSToolbarItem.cs
@@ -10,15 +10,15 @@ public void InitTests ()
{
const string TestLabel = "NSToolbarItemTests.Label";
NSToolbarItem item = new NSToolbarItem ();
- Assert.IsNotNull (item.Handle, "NSToolbarItem has handle");
+ Assert.That (item.Handle, Is.Not.Null, "NSToolbarItem has handle");
item.Label = TestLabel;
- Assert.AreEqual (item.Label, TestLabel, "NSToolbarItem has non null Label");
+ Assert.That (TestLabel, Is.EqualTo (item.Label), "NSToolbarItem has non null Label");
NSToolbarItemGroup group = new NSToolbarItemGroup ();
- Assert.IsNotNull (group.Handle, "NSToolbarItemGroup has handle");
- Assert.AreEqual (group.Subitems.Length, 0, "NSToolbarItemGroup has zero items");
+ Assert.That (group.Handle, Is.Not.Null, "NSToolbarItemGroup has handle");
+ Assert.That (0, Is.EqualTo (group.Subitems.Length), "NSToolbarItemGroup has zero items");
group.Label = TestLabel;
- Assert.AreEqual (group.Label, TestLabel, "NSToolbarItemGroup has non null Label");
+ Assert.That (TestLabel, Is.EqualTo (group.Label), "NSToolbarItemGroup has non null Label");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSUserDefaultsController.cs b/tests/monotouch-test/AppKit/NSUserDefaultsController.cs
index 85389769d65e..5209abdbb0c3 100644
--- a/tests/monotouch-test/AppKit/NSUserDefaultsController.cs
+++ b/tests/monotouch-test/AppKit/NSUserDefaultsController.cs
@@ -12,7 +12,7 @@ public void NSUserDefaultsControllerShouldGetSharedController ()
{
controller = NSUserDefaultsController.SharedUserDefaultsController;
- Assert.IsNotNull (controller, "NSUserDefaultsControllerShouldGetDefaultController - SharedUserDefaultsController returned null");
+ Assert.That (controller, Is.Not.Null, "NSUserDefaultsControllerShouldGetDefaultController - SharedUserDefaultsController returned null");
}
[Test]
@@ -20,7 +20,7 @@ public void NSUserDefaultsControllerShouldCreateNewControllerWithDefaultConstruc
{
controller = new NSUserDefaultsController ();
- Assert.IsNotNull (controller, "NSUserDefaultsControllerShouldCreateNewControllerWithDefaultConstructor - Constructor returned null");
+ Assert.That (controller, Is.Not.Null, "NSUserDefaultsControllerShouldCreateNewControllerWithDefaultConstructor - Constructor returned null");
}
[Test]
@@ -28,9 +28,9 @@ public void NSUserDefaultsControllerShouldCreateNewControllerWithNullParameters
{
controller = new NSUserDefaultsController (null, null);
- Assert.IsTrue (controller.Defaults == NSUserDefaults.StandardUserDefaults);
- Assert.IsTrue (controller.InitialValues is null);
- Assert.IsNotNull (controller, "NSUserDefaultsControllerShouldCreateNewControllerWithNullParameters - Constructor returned null");
+ Assert.That (controller.Defaults == NSUserDefaults.StandardUserDefaults, Is.True);
+ Assert.That (controller.InitialValues is null, Is.True);
+ Assert.That (controller, Is.Not.Null, "NSUserDefaultsControllerShouldCreateNewControllerWithNullParameters - Constructor returned null");
}
[Test]
@@ -39,9 +39,9 @@ public void NSUserDefaultsControllerShouldCreateNewControllerWithParameters ()
var initialValues = new NSDictionary ();
controller = new NSUserDefaultsController (NSUserDefaults.StandardUserDefaults, initialValues);
- Assert.IsTrue (controller.Defaults == NSUserDefaults.StandardUserDefaults);
- Assert.IsTrue (controller.InitialValues == initialValues);
- Assert.IsNotNull (controller, "NSUserDefaultsControllerShouldCreateNewControllerWithParameters - Constructor returned null");
+ Assert.That (controller.Defaults == NSUserDefaults.StandardUserDefaults, Is.True);
+ Assert.That (controller.InitialValues == initialValues, Is.True);
+ Assert.That (controller, Is.Not.Null, "NSUserDefaultsControllerShouldCreateNewControllerWithParameters - Constructor returned null");
}
[Test]
@@ -51,7 +51,7 @@ public void NSUserDefaultsControllerShouldChangeInitialValues ()
var initialValues = controller.InitialValues;
controller.InitialValues = new NSDictionary ();
- Assert.IsFalse (controller.InitialValues == initialValues, "NSUserDefaultsControllerShouldChangeInitialValues - Failed to set the InitialValues property");
+ Assert.That (controller.InitialValues == initialValues, Is.False, "NSUserDefaultsControllerShouldChangeInitialValues - Failed to set the InitialValues property");
}
[Test]
@@ -61,7 +61,7 @@ public void NSUserDefaultsControllerShouldChangeAppliesImmediately ()
var appliesImmediately = controller.AppliesImmediately;
controller.AppliesImmediately = !appliesImmediately;
- Assert.IsFalse (controller.AppliesImmediately == appliesImmediately, "NSUserDefaultsControllerShouldChangeAppliesImmediately - Failed to set the AppliesImmediately property");
+ Assert.That (controller.AppliesImmediately == appliesImmediately, Is.False, "NSUserDefaultsControllerShouldChangeAppliesImmediately - Failed to set the AppliesImmediately property");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSView.cs b/tests/monotouch-test/AppKit/NSView.cs
index 830c77187bb5..968f3e7489eb 100644
--- a/tests/monotouch-test/AppKit/NSView.cs
+++ b/tests/monotouch-test/AppKit/NSView.cs
@@ -23,7 +23,7 @@ public void NSViewShouldAddGestureRecognizer ()
length = view.GestureRecognizers.Length;
view.AddGestureRecognizer (new NSGestureRecognizer ());
- Assert.IsTrue (view.GestureRecognizers.Length == length + 1, "NSViewShouldAddGestureRecognizer - Failed to add recognizer, count didn't change.");
+ Assert.That (view.GestureRecognizers.Length == length + 1, Is.True, "NSViewShouldAddGestureRecognizer - Failed to add recognizer, count didn't change.");
}
[Test]
@@ -32,11 +32,11 @@ public void NSViewShouldRemoveGestureRecognizer ()
var recognizer = new NSClickGestureRecognizer ();
view.AddGestureRecognizer (recognizer);
- Assert.IsTrue (view.GestureRecognizers.Length != 0, "NSViewShouldRemoveGestureRecognizer - Failed to add gesture recognizer");
+ Assert.That (view.GestureRecognizers.Length != 0, Is.True, "NSViewShouldRemoveGestureRecognizer - Failed to add gesture recognizer");
view.RemoveGestureRecognizer (recognizer);
- Assert.IsTrue (view.GestureRecognizers.Length == 0, "NSViewShouldRemoveGestureRecognizer - Failed to remove gesture recognizer");
+ Assert.That (view.GestureRecognizers.Length == 0, Is.True, "NSViewShouldRemoveGestureRecognizer - Failed to remove gesture recognizer");
}
[Test]
@@ -45,7 +45,7 @@ public void NSViewShouldChangeGestureRecognizers ()
var recognizers = view.GestureRecognizers;
view.GestureRecognizers = new NSGestureRecognizer [] { new NSClickGestureRecognizer (), new NSPanGestureRecognizer () };
- Assert.IsFalse (view.GestureRecognizers == recognizers);
+ Assert.That (view.GestureRecognizers == recognizers, Is.False);
}
[Test]
@@ -87,10 +87,10 @@ public void SubviewSort ()
Assert.Throws (() => containerView.SortSubviews (null), "ANE");
- Assert.AreEqual (3, containerView.Subviews.Length, "Presort Length");
- Assert.AreEqual ("b", ((NSTextView) containerView.Subviews [0]).Value, "Presort Value 0");
- Assert.AreEqual ("c", ((NSTextView) containerView.Subviews [1]).Value, "Presort Value 1");
- Assert.AreEqual ("a", ((NSTextView) containerView.Subviews [2]).Value, "Presort Value 2");
+ Assert.That (containerView.Subviews.Length, Is.EqualTo (3), "Presort Length");
+ Assert.That (((NSTextView) containerView.Subviews [0]).Value, Is.EqualTo ("b"), "Presort Value 0");
+ Assert.That (((NSTextView) containerView.Subviews [1]).Value, Is.EqualTo ("c"), "Presort Value 1");
+ Assert.That (((NSTextView) containerView.Subviews [2]).Value, Is.EqualTo ("a"), "Presort Value 2");
containerView.SortSubviews ((x, y) => {
var viewX = (NSTextView) x;
@@ -104,10 +104,10 @@ public void SubviewSort ()
return NSComparisonResult.Descending;
});
- Assert.AreEqual (3, containerView.Subviews.Length, "Postsort Length");
- Assert.AreEqual ("a", ((NSTextView) containerView.Subviews [0]).Value, "Postsort Value 0");
- Assert.AreEqual ("b", ((NSTextView) containerView.Subviews [1]).Value, "Postsort Value 1");
- Assert.AreEqual ("c", ((NSTextView) containerView.Subviews [2]).Value, "Postsort Value 2");
+ Assert.That (containerView.Subviews.Length, Is.EqualTo (3), "Postsort Length");
+ Assert.That (((NSTextView) containerView.Subviews [0]).Value, Is.EqualTo ("a"), "Postsort Value 0");
+ Assert.That (((NSTextView) containerView.Subviews [1]).Value, Is.EqualTo ("b"), "Postsort Value 1");
+ Assert.That (((NSTextView) containerView.Subviews [2]).Value, Is.EqualTo ("c"), "Postsort Value 2");
try {
containerView.SortSubviews ((x, y) => {
@@ -115,8 +115,8 @@ public void SubviewSort ()
});
Assert.Fail ("No exception thrown");
} catch (Exception e) {
- Assert.AreEqual ("An exception occurred during sorting.", e.Message, "Exception Message");
- Assert.AreEqual ("Something went wrong", e.InnerException.Message, "InnerException Message");
+ Assert.That (e.Message, Is.EqualTo ("An exception occurred during sorting."), "Exception Message");
+ Assert.That (e.InnerException.Message, Is.EqualTo ("Something went wrong"), "InnerException Message");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSViewController.cs b/tests/monotouch-test/AppKit/NSViewController.cs
index 2b5c5b344352..341424bb5fbb 100644
--- a/tests/monotouch-test/AppKit/NSViewController.cs
+++ b/tests/monotouch-test/AppKit/NSViewController.cs
@@ -19,7 +19,7 @@ public void NSViewControllerShouldAddChildViewController ()
var child = new NSViewController ();
controller.AddChildViewController (child);
- Assert.IsTrue (controller.ChildViewControllers.Length == 1, "NSViewControllerShouldAddChildViewControllers - Failed to add child view controller");
+ Assert.That (controller.ChildViewControllers.Length == 1, Is.True, "NSViewControllerShouldAddChildViewControllers - Failed to add child view controller");
}
[Test]
@@ -28,11 +28,11 @@ public void NSViewControllerShouldRemoveChildViewController ()
var child = new NSViewController ();
controller.AddChildViewController (child);
- Assert.IsTrue (controller.ChildViewControllers.Length == 1, "NSViewControllerShouldRemoveChildViewControllers - Failed to add child view controller");
+ Assert.That (controller.ChildViewControllers.Length == 1, Is.True, "NSViewControllerShouldRemoveChildViewControllers - Failed to add child view controller");
controller.RemoveChildViewController (0);
- Assert.IsTrue (controller.ChildViewControllers.Length == 0, "NSViewControllerShouldRemoveChildViewController - Failed to remove child view controller");
+ Assert.That (controller.ChildViewControllers.Length == 0, Is.True, "NSViewControllerShouldRemoveChildViewController - Failed to remove child view controller");
}
[Test]
@@ -41,13 +41,13 @@ public void NSViewControllerShouldInsertChildViewController ()
controller.AddChildViewController (new NSViewController ());
controller.AddChildViewController (new NSViewController ());
- Assert.IsTrue (controller.ChildViewControllers.Length == 2, "NSViewControllerShouldInsertChildViewController - Failed to add child view controller");
+ Assert.That (controller.ChildViewControllers.Length == 2, Is.True, "NSViewControllerShouldInsertChildViewController - Failed to add child view controller");
var child = new NSViewController ();
controller.InsertChildViewController (child, 1);
- Assert.IsTrue (controller.ChildViewControllers.Length == 3, "NSViewControllerShouldInsertChildViewController - Failed to insert child view controller");
- Assert.IsTrue (controller.ChildViewControllers [1] == child, "NSViewControllerShouldInsertChildViewController - Inserted child view controller at the wrong index.");
+ Assert.That (controller.ChildViewControllers.Length == 3, Is.True, "NSViewControllerShouldInsertChildViewController - Failed to insert child view controller");
+ Assert.That (controller.ChildViewControllers [1] == child, Is.True, "NSViewControllerShouldInsertChildViewController - Inserted child view controller at the wrong index.");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSVisualEffectView.cs b/tests/monotouch-test/AppKit/NSVisualEffectView.cs
index 19a37721af4e..40a57b9a2d2c 100644
--- a/tests/monotouch-test/AppKit/NSVisualEffectView.cs
+++ b/tests/monotouch-test/AppKit/NSVisualEffectView.cs
@@ -19,7 +19,7 @@ public void NSVisualEffectViewShouldChangeMaterial ()
var material = view.Material;
view.Material = NSVisualEffectMaterial.Titlebar;
- Assert.IsFalse (view.Material == material, "NSVisualEffectViewShouldChangeMaterial - Failed to set the Material property");
+ Assert.That (view.Material == material, Is.False, "NSVisualEffectViewShouldChangeMaterial - Failed to set the Material property");
}
[Test]
@@ -28,7 +28,7 @@ public void NSVisualEffectViewShouldChangeBlendingMode ()
var blendingMode = view.BlendingMode;
view.BlendingMode = NSVisualEffectBlendingMode.WithinWindow;
- Assert.IsFalse (view.BlendingMode == blendingMode, "NSVisualEffectViewShouldChangeBlendingMode - Failed to set the BlendingMode property");
+ Assert.That (view.BlendingMode == blendingMode, Is.False, "NSVisualEffectViewShouldChangeBlendingMode - Failed to set the BlendingMode property");
}
[Test]
@@ -37,7 +37,7 @@ public void NSVisualEffectViewShouldChangeState ()
var state = view.State;
view.State = NSVisualEffectState.Inactive;
- Assert.IsFalse (view.State == state, "NSVisualEffectViewShouldChangeState - Failed to set the State property");
+ Assert.That (view.State == state, Is.False, "NSVisualEffectViewShouldChangeState - Failed to set the State property");
}
[Test]
@@ -46,7 +46,7 @@ public void NSVisualEffectViewShouldChangeMaskImage ()
var image = view.MaskImage;
view.MaskImage = new NSImage ();
- Assert.IsFalse (view.MaskImage == image, "NSVisualEffectViewShouldChangeMaskImage - Failed to set the MaskImage property");
+ Assert.That (view.MaskImage == image, Is.False, "NSVisualEffectViewShouldChangeMaskImage - Failed to set the MaskImage property");
}
}
}
diff --git a/tests/monotouch-test/AppKit/NSWorkspace.cs b/tests/monotouch-test/AppKit/NSWorkspace.cs
index 2696f1f2fce3..306ce82682f0 100644
--- a/tests/monotouch-test/AppKit/NSWorkspace.cs
+++ b/tests/monotouch-test/AppKit/NSWorkspace.cs
@@ -9,10 +9,10 @@ public class NSWorkspaceTests {
[Test]
public void NSWorkspaceConstantTests ()
{
- Assert.IsNotNull (NSWorkspace.LaunchConfigurationAppleEvent);
- Assert.IsNotNull (NSWorkspace.LaunchConfigurationArguments);
- Assert.IsNotNull (NSWorkspace.LaunchConfigurationEnvironment);
- Assert.IsNotNull (NSWorkspace.LaunchConfigurationArchitecture);
+ Assert.That (NSWorkspace.LaunchConfigurationAppleEvent, Is.Not.Null);
+ Assert.That (NSWorkspace.LaunchConfigurationArguments, Is.Not.Null);
+ Assert.That (NSWorkspace.LaunchConfigurationEnvironment, Is.Not.Null);
+ Assert.That (NSWorkspace.LaunchConfigurationArchitecture, Is.Not.Null);
}
[Test]
diff --git a/tests/monotouch-test/Asserts.cs b/tests/monotouch-test/Asserts.cs
index 897b15d77030..b24178745c9d 100644
--- a/tests/monotouch-test/Asserts.cs
+++ b/tests/monotouch-test/Asserts.cs
@@ -31,90 +31,90 @@
public static class Asserts {
public static void AreEqual (bool expected, bool actual, string message)
{
- Assert.AreEqual (expected, actual, $"{message} (M) expected: {expected} actual: {actual}");
+ Assert.That (actual, Is.EqualTo (expected), $"{message} (M) expected: {expected} actual: {actual}");
}
public static void AreEqual (float expected, float actual, string message)
{
- Assert.AreEqual (expected, actual, $"{message} (M) expected: {expected} actual: {actual}");
+ Assert.That (actual, Is.EqualTo (expected), $"{message} (M) expected: {expected} actual: {actual}");
}
public static void AreEqual (float expected, float actual, float delta, string message)
{
- Assert.AreEqual (expected, actual, delta, message);
+ Assert.That (actual, Is.EqualTo (expected).Within (delta), message);
}
public static void AreEqual (Vector2 expected, Vector2 actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y), $"{message} (Y) expected: {expected} actual: {actual}");
}
public static void AreEqual (Vector3 expected, Vector3 actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, 0.001, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, 0.001, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, 0.001, $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (0.001), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (0.001), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z).Within (0.001), $"{message} (Z) expected: {expected} actual: {actual}");
}
public static void AreEqual (Vector3 expected, Vector3 actual, float delta, string message)
{
- Assert.AreEqual (expected.X, actual.X, delta, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, delta, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, delta, $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (delta), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (delta), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z).Within (delta), $"{message} (Z) expected: {expected} actual: {actual}");
}
public static void AreEqual (Vector3 expected, VectorFloat3 actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, 0.001, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, 0.001, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, 0.001, $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (0.001), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (0.001), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z).Within (0.001), $"{message} (Z) expected: {expected} actual: {actual}");
}
public static void AreEqual (VectorFloat3 expected, Vector3 actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, 0.001, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, 0.001, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, 0.001, $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (0.001), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (0.001), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z).Within (0.001), $"{message} (Z) expected: {expected} actual: {actual}");
}
public static void AreEqual (VectorFloat3 expected, VectorFloat3 actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, 0.001, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, 0.001, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, 0.001, $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (0.001), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (0.001), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z).Within (0.001), $"{message} (Z) expected: {expected} actual: {actual}");
}
public static void AreEqual (VectorFloat3 expected, VectorFloat3 actual, float delta, string message)
{
- Assert.AreEqual (expected.X, actual.X, delta, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, delta, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, delta, $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (delta), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (delta), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z).Within (delta), $"{message} (Z) expected: {expected} actual: {actual}");
}
public static void AreEqual (Vector4 expected, Vector4 actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, $"{message} (Z) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.W, actual.W, $"{message} (W) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z), $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.W, Is.EqualTo (expected.W), $"{message} (W) expected: {expected} actual: {actual}");
}
public static void AreEqual (float expectedX, float expectedY, float expectedZ, float expectedW, Vector4 actual, string message)
{
- Assert.AreEqual (expectedX, actual.X, $"{message} (X) expected: {new Vector4 (expectedX, expectedY, expectedZ, expectedW)} actual: {actual}");
- Assert.AreEqual (expectedY, actual.Y, $"{message} (Y) expected: {new Vector4 (expectedX, expectedY, expectedZ, expectedW)} actual: {actual}");
- Assert.AreEqual (expectedZ, actual.Z, $"{message} (Z) expected: {new Vector4 (expectedX, expectedY, expectedZ, expectedW)} actual: {actual}");
- Assert.AreEqual (expectedW, actual.W, $"{message} (W) expected: {new Vector4 (expectedX, expectedY, expectedZ, expectedW)} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expectedX), $"{message} (X) expected: {new Vector4 (expectedX, expectedY, expectedZ, expectedW)} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expectedY), $"{message} (Y) expected: {new Vector4 (expectedX, expectedY, expectedZ, expectedW)} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expectedZ), $"{message} (Z) expected: {new Vector4 (expectedX, expectedY, expectedZ, expectedW)} actual: {actual}");
+ Assert.That (actual.W, Is.EqualTo (expectedW), $"{message} (W) expected: {new Vector4 (expectedX, expectedY, expectedZ, expectedW)} actual: {actual}");
}
public static void AreEqual (Vector4 expected, Vector4 actual, float delta, string message)
{
- Assert.AreEqual (expected.X, actual.X, delta, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, delta, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, delta, $"{message} (Z) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.W, actual.W, delta, $"{message} (W) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (delta), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (delta), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z).Within (delta), $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.W, Is.EqualTo (expected.W).Within (delta), $"{message} (W) expected: {expected} actual: {actual}");
}
public static void AreEqual (Matrix4 expected, Matrix4 actual, string message)
@@ -159,16 +159,16 @@ public static void AreEqual (Matrix4 expected, Matrix4 actual, float delta, stri
public static void AreEqual (Vector2i expected, Vector2i actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y), $"{message} (Y) expected: {expected} actual: {actual}");
}
public static void AreEqual (Vector4i expected, Vector4i actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, $"{message} (Z) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.W, actual.W, $"{message} (W) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z), $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.W, Is.EqualTo (expected.W), $"{message} (W) expected: {expected} actual: {actual}");
}
public static void AreEqual (MDLAxisAlignedBoundingBox expected, MDLAxisAlignedBoundingBox actual, string message)
@@ -179,10 +179,10 @@ public static void AreEqual (MDLAxisAlignedBoundingBox expected, MDLAxisAlignedB
public static void AreEqual (Quaternion expected, Quaternion actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, $"{message} (Z) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.W, actual.W, $"{message} (W) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z), $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.W, Is.EqualTo (expected.W), $"{message} (W) expected: {expected} actual: {actual}");
}
public static void AreEqual (Quaternion [] expected, Quaternion [] actual, string message)
@@ -195,7 +195,7 @@ public static void AreEqual (Quaternion [] expected, Quaternion [] actual, strin
Assert.Fail ($"Expected {expected}, got null. {message}");
}
- Assert.AreEqual (expected.Length, actual.Length, $"{message} array lengths");
+ Assert.That (actual.Length, Is.EqualTo (expected.Length), $"{message} array lengths");
for (var i = 0; i < expected.Length; i++) {
AreEqual (expected [i], actual [i], message + $" [{i}]");
}
@@ -203,23 +203,23 @@ public static void AreEqual (Quaternion [] expected, Quaternion [] actual, strin
public static void AreEqual (Quaterniond expected, Quaterniond actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, $"{message} (Z) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.W, actual.W, $"{message} (W) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z), $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.W, Is.EqualTo (expected.W), $"{message} (W) expected: {expected} actual: {actual}");
}
public static void AreEqual (Quaterniond expected, Quaterniond actual, double delta, string message)
{
- Assert.AreEqual (expected.X, actual.X, delta, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, delta, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, delta, $"{message} (Z) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.W, actual.W, delta, $"{message} (W) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (delta), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (delta), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z).Within (delta), $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.W, Is.EqualTo (expected.W).Within (delta), $"{message} (W) expected: {expected} actual: {actual}");
}
public static void AreEqual (Quaterniond [] expected, Quaterniond [] actual, string message)
{
- Assert.AreEqual (expected.Length, actual.Length, $"{message} array lengths");
+ Assert.That (actual.Length, Is.EqualTo (expected.Length), $"{message} array lengths");
for (var i = 0; i < expected.Length; i++) {
AreEqual (expected [i], actual [i], message + $" [{i}]");
}
@@ -227,10 +227,10 @@ public static void AreEqual (Quaterniond [] expected, Quaterniond [] actual, str
public static void AreEqual (MPSImageHistogramInfo expected, MPSImageHistogramInfo actual, string message)
{
- Assert.AreEqual (expected.HistogramForAlpha, actual.HistogramForAlpha, $"{message} HistogramForAlpha expected: {expected} actual: {actual}");
+ Assert.That (actual.HistogramForAlpha, Is.EqualTo (expected.HistogramForAlpha), $"{message} HistogramForAlpha expected: {expected} actual: {actual}");
Asserts.AreEqual (expected.MaxPixelValue, actual.MaxPixelValue, $"{message} MaxPixelValue expected: {expected} actual: {actual}");
Asserts.AreEqual (expected.MinPixelValue, actual.MinPixelValue, $"{message} MinPixelValue expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.NumberOfHistogramEntries, actual.NumberOfHistogramEntries, $"{message} NumberOfHistogramEntries expected: {expected} actual: {actual}");
+ Assert.That (actual.NumberOfHistogramEntries, Is.EqualTo (expected.NumberOfHistogramEntries), $"{message} NumberOfHistogramEntries expected: {expected} actual: {actual}");
}
public static void AreEqual (MatrixFloat2x2 expected, MatrixFloat2x2 actual, string message)
@@ -378,54 +378,54 @@ public static void AreEqual (MatrixFloat4x4 expected, Matrix4 actual, string mes
#region Double Based Types
public static void AreEqual (double expected, double actual, string message)
{
- Assert.AreEqual (expected, actual, $"{message} (M) expected: {expected} actual: {actual}");
+ Assert.That (actual, Is.EqualTo (expected), $"{message} (M) expected: {expected} actual: {actual}");
}
public static void AreEqual (double expected, double actual, double delta, string message)
{
- Assert.AreEqual (expected, actual, delta, message);
+ Assert.That (actual, Is.EqualTo (expected).Within (delta), message);
}
public static void AreEqual (VectorDouble2 expected, VectorDouble2 actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, 0.001, message + " (X)");
- Assert.AreEqual (expected.Y, actual.Y, 0.001, message + " (Y)");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (0.001), message + " (X)");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (0.001), message + " (Y)");
}
public static void AreEqual (VectorDouble2 expected, VectorDouble2 actual, double delta, string message)
{
- Assert.AreEqual (expected.X, actual.X, delta, message + " (X)");
- Assert.AreEqual (expected.Y, actual.Y, delta, message + " (Y)");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (delta), message + " (X)");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (delta), message + " (Y)");
}
public static void AreEqual (VectorDouble3 expected, VectorDouble3 actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, 0.001, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, 0.001, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, 0.001, $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (0.001), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (0.001), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z).Within (0.001), $"{message} (Z) expected: {expected} actual: {actual}");
}
public static void AreEqual (VectorDouble3 expected, VectorDouble3 actual, double delta, string message)
{
- Assert.AreEqual (expected.X, actual.X, delta, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, delta, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, delta, $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (delta), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (delta), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z).Within (delta), $"{message} (Z) expected: {expected} actual: {actual}");
}
public static void AreEqual (Vector4d expected, Vector4d actual, string message)
{
- Assert.AreEqual (expected.X, actual.X, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, $"{message} (Z) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.W, actual.W, $"{message} (W) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z), $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.W, Is.EqualTo (expected.W), $"{message} (W) expected: {expected} actual: {actual}");
}
public static void AreEqual (Vector4d expected, Vector4d actual, double delta, string message)
{
- Assert.AreEqual (expected.X, actual.X, delta, $"{message} (X) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Y, actual.Y, delta, $"{message} (Y) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.Z, actual.Z, delta, $"{message} (Z) expected: {expected} actual: {actual}");
- Assert.AreEqual (expected.W, actual.W, delta, $"{message} (W) expected: {expected} actual: {actual}");
+ Assert.That (actual.X, Is.EqualTo (expected.X).Within (delta), $"{message} (X) expected: {expected} actual: {actual}");
+ Assert.That (actual.Y, Is.EqualTo (expected.Y).Within (delta), $"{message} (Y) expected: {expected} actual: {actual}");
+ Assert.That (actual.Z, Is.EqualTo (expected.Z).Within (delta), $"{message} (Z) expected: {expected} actual: {actual}");
+ Assert.That (actual.W, Is.EqualTo (expected.W).Within (delta), $"{message} (W) expected: {expected} actual: {actual}");
}
public static void AreEqual (MatrixDouble4x4 expected, MatrixDouble4x4 actual, string message)
diff --git a/tests/monotouch-test/AudioToolbox/AudioBalanceFadeTest.cs b/tests/monotouch-test/AudioToolbox/AudioBalanceFadeTest.cs
index 5e0a3f55a00e..bafa39fda16a 100644
--- a/tests/monotouch-test/AudioToolbox/AudioBalanceFadeTest.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioBalanceFadeTest.cs
@@ -19,7 +19,7 @@ public void GetBalanceFade ()
{
var acl = AudioChannelLayout.FromAudioChannelLayoutTag (AudioChannelLayoutTag.AudioUnit_6_1);
var abf = new AudioBalanceFade (acl);
- Assert.IsNotNull (abf.GetBalanceFade ());
+ Assert.That (abf.GetBalanceFade (), Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/AudioToolbox/AudioBufferList.cs b/tests/monotouch-test/AudioToolbox/AudioBufferList.cs
index 15dca28c24e4..c200ffc46217 100644
--- a/tests/monotouch-test/AudioToolbox/AudioBufferList.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioBufferList.cs
@@ -12,17 +12,17 @@ public unsafe void Usage ()
var buffer = new byte [1024];
fixed (byte* ptr = buffer) {
var list = (AudioBufferList*) ptr;
- Assert.AreEqual (0, list->Count, "Count");
+ Assert.That (list->Count, Is.EqualTo (0), "Count");
Assert.Throws (() => list->GetBuffer (0), "Item 0");
Assert.Throws (() => list->GetBuffer (-1), "Item -1");
Assert.Throws (() => list->GetBuffer (1), "Item 1");
*(int*) ptr = 3;
- Assert.AreEqual (3, list->Count, "Count B");
+ Assert.That (list->Count, Is.EqualTo (3), "Count B");
for (var i = 0; i < 3; i++) {
- Assert.AreEqual (0, list->GetBuffer (i)->NumberChannels, $"NumberChannels B#{i}");
- Assert.AreEqual (0, list->GetBuffer (i)->DataByteSize, $"DataByteSize B#{i}");
- Assert.AreEqual ((nint) 0, list->GetBuffer (i)->Data, $"Data B#{i}");
+ Assert.That (list->GetBuffer (i)->NumberChannels, Is.EqualTo (0), $"NumberChannels B#{i}");
+ Assert.That (list->GetBuffer (i)->DataByteSize, Is.EqualTo (0), $"DataByteSize B#{i}");
+ Assert.That (list->GetBuffer (i)->Data, Is.EqualTo ((nint) 0), $"Data B#{i}");
list->GetBuffer (i)->NumberChannels = (i + 1) * 10;
list->GetBuffer (i)->DataByteSize = (i + 1) * 100;
@@ -32,17 +32,17 @@ public unsafe void Usage ()
Assert.Throws (() => list->GetBuffer (3), "Item 3 B");
int* iptr = (int*) ptr;
- Assert.AreEqual (10, iptr [2 + 0 * 4], "10"); // NumberChannels
- Assert.AreEqual (100, iptr [2 + 0 * 4 + 1], "20"); // DataByteSize
- Assert.AreEqual (20, iptr [2 + 1 * 4], "20"); // NumberChannels
- Assert.AreEqual (200, iptr [2 + 1 * 4 + 1], "40"); // DataByteSize
- Assert.AreEqual (30, iptr [2 + 2 * 4], "30"); // NumberChannels
- Assert.AreEqual (300, iptr [2 + 2 * 4 + 1], "60"); // DataByteSize
+ Assert.That (iptr [2 + 0 * 4], Is.EqualTo (10), "10"); // NumberChannels
+ Assert.That (iptr [2 + 0 * 4 + 1], Is.EqualTo (100), "20"); // DataByteSize
+ Assert.That (iptr [2 + 1 * 4], Is.EqualTo (20), "20"); // NumberChannels
+ Assert.That (iptr [2 + 1 * 4 + 1], Is.EqualTo (200), "40"); // DataByteSize
+ Assert.That (iptr [2 + 2 * 4], Is.EqualTo (30), "30"); // NumberChannels
+ Assert.That (iptr [2 + 2 * 4 + 1], Is.EqualTo (300), "60"); // DataByteSize
nint* nptr = (nint*) ptr;
- Assert.AreEqual ((nint) 1000, nptr [1 + 0 * 2 + 1], "1000"); // Data
- Assert.AreEqual ((nint) 2000, nptr [1 + 1 * 2 + 1], "2000"); // Data
- Assert.AreEqual ((nint) 3000, nptr [1 + 2 * 2 + 1], "3000"); // Data
+ Assert.That (nptr [1 + 0 * 2 + 1], Is.EqualTo ((nint) 1000), "1000"); // Data
+ Assert.That (nptr [1 + 1 * 2 + 1], Is.EqualTo ((nint) 2000), "2000"); // Data
+ Assert.That (nptr [1 + 2 * 2 + 1], Is.EqualTo ((nint) 3000), "3000"); // Data
}
}
}
diff --git a/tests/monotouch-test/AudioToolbox/AudioChannelLayoutTest.cs b/tests/monotouch-test/AudioToolbox/AudioChannelLayoutTest.cs
index 9cb98eb73c46..f73415abdbb8 100644
--- a/tests/monotouch-test/AudioToolbox/AudioChannelLayoutTest.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioChannelLayoutTest.cs
@@ -18,20 +18,20 @@ public class AudioChannelLayoutTest {
public void Validate ()
{
var acl = AudioChannelLayout.FromAudioChannelLayoutTag (AudioChannelLayoutTag.AudioUnit_6_1);
- Assert.AreEqual (AudioFormatError.None, AudioChannelLayout.Validate (acl));
+ Assert.That (AudioChannelLayout.Validate (acl), Is.EqualTo (AudioFormatError.None));
}
[Test]
public void FromAudioChannelBitmap ()
{
var bitmap = AudioChannelLayoutTag.AudioUnit_7_1_Front.ToAudioChannel ();
- Assert.IsNotNull (AudioChannelLayout.FromAudioChannelBitmap (bitmap.Value));
+ Assert.That (AudioChannelLayout.FromAudioChannelBitmap (bitmap.Value), Is.Not.Null);
}
[Test]
public void FromAudioChannelLayoutTag ()
{
- Assert.IsNotNull (AudioChannelLayout.FromAudioChannelLayoutTag (AudioChannelLayoutTag.AudioUnit_6_1));
+ Assert.That (AudioChannelLayout.FromAudioChannelLayoutTag (AudioChannelLayoutTag.AudioUnit_6_1), Is.Not.Null);
}
[Test]
@@ -54,13 +54,13 @@ public void GetChannelMap ()
var acl1 = AudioChannelLayout.FromAudioChannelLayoutTag (AudioChannelLayoutTag.AudioUnit_6_1);
var acl2 = AudioChannelLayout.FromAudioChannelLayoutTag (AudioChannelLayoutTag.MPEG_7_1_B);
- Assert.IsNotNull (AudioChannelLayout.GetChannelMap (acl1, acl2));
+ Assert.That (AudioChannelLayout.GetChannelMap (acl1, acl2), Is.Not.Null);
}
[Test]
public void GetTagsForNumberOfChannels ()
{
- Assert.IsNotNull (AudioChannelLayout.GetTagsForNumberOfChannels (4));
+ Assert.That (AudioChannelLayout.GetTagsForNumberOfChannels (4), Is.Not.Null);
}
[Test]
@@ -69,7 +69,7 @@ public void GetMatrixMixMap ()
var acl1 = AudioChannelLayout.FromAudioChannelLayoutTag (AudioChannelLayoutTag.AudioUnit_6_1);
var acl2 = AudioChannelLayout.FromAudioChannelLayoutTag (AudioChannelLayoutTag.MPEG_7_1_B);
- Assert.IsNotNull (AudioChannelLayout.GetMatrixMixMap (acl1, acl2));
+ Assert.That (AudioChannelLayout.GetMatrixMixMap (acl1, acl2), Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/AudioToolbox/AudioComponentTest.cs b/tests/monotouch-test/AudioToolbox/AudioComponentTest.cs
index 1653026b0562..617534f1d6ca 100644
--- a/tests/monotouch-test/AudioToolbox/AudioComponentTest.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioComponentTest.cs
@@ -40,7 +40,7 @@ public void GetSetComponentList ()
if (component is null)
continue;
var l = component.ComponentList;
- Assert.IsNull (l, "List is not null.");
+ Assert.That (l, Is.Null, "List is not null.");
l = new AudioComponentInfo [] { componentInfo };
//monotouchtests does not have permissions to deal with the hwd.
Assert.Throws (() => component.ComponentList = l);
@@ -87,14 +87,14 @@ public void TestResourceUsageInfoIOKitUserClient ()
var resources = new ResourceUsageInfo ();
resources.IOKitUserClient = new string [] { clientId };
var userClientList = resources.IOKitUserClient;
- Assert.IsNotNull (userClientList);
- Assert.AreEqual (1, userClientList.Length, "List does not have all client ids.");
- Assert.AreEqual (clientId, userClientList [0], "Client ids are not the same.");
+ Assert.That (userClientList, Is.Not.Null);
+ Assert.That (userClientList.Length, Is.EqualTo (1), "List does not have all client ids.");
+ Assert.That (userClientList [0], Is.EqualTo (clientId), "Client ids are not the same.");
// similar test but with null values.
resources.IOKitUserClient = null;
- Assert.IsNull (resources.IOKitUserClient, "Value was not set to null.");
+ Assert.That (resources.IOKitUserClient, Is.Null, "Value was not set to null.");
}
[Test]
@@ -105,14 +105,14 @@ public void TestResourceUsageInfoMachLookUpGlobalName ()
var resources = new ResourceUsageInfo ();
resources.MachLookUpGlobalName = new string [] { serviceName };
var serviceNames = resources.MachLookUpGlobalName;
- Assert.NotNull (serviceNames, "Returned list is null");
- Assert.AreEqual (1, serviceNames.Length, "List does not have all service names.");
- Assert.AreEqual (serviceName, serviceNames [0], "Service names are not equal.");
+ Assert.That (serviceNames, Is.Not.Null, "Returned list is null");
+ Assert.That (serviceNames.Length, Is.EqualTo (1), "List does not have all service names.");
+ Assert.That (serviceNames [0], Is.EqualTo (serviceName), "Service names are not equal.");
// similar test but with null values
resources.MachLookUpGlobalName = null;
- Assert.IsNull (resources.MachLookUpGlobalName, "Value was no set to null.");
+ Assert.That (resources.MachLookUpGlobalName, Is.Null, "Value was no set to null.");
}
[Test]
@@ -132,10 +132,10 @@ public void TestConfigurationInfo ()
componentInfo.Version = 1;
componentInfo.ResourceUsage = resources;
using var component = AudioComponent.FindComponent (AudioTypeOutput.Generic);
- Assert.IsNotNull (component);
+ Assert.That (component, Is.Not.Null);
// assert the property and break
var configInfo = component.GetConfigurationInfo ();
- Assert.IsNotNull (configInfo);
+ Assert.That (configInfo, Is.Not.Null);
}
[Test]
@@ -163,11 +163,10 @@ public void TestValidation ()
componentInfo.Version = 1;
componentInfo.ResourceUsage = resources;
using var component = AudioComponent.FindComponent (AudioTypeOutput.Generic);
- Assert.IsNotNull (component);
+ Assert.That (component, Is.Not.Null);
// validate and break
var validation = component.Validate (null);
- Assert.Contains (validation,
- new List () { AudioComponentValidationResult.Unknown, AudioComponentValidationResult.Passed }, "validation");
+ Assert.That (new List () { AudioComponentValidationResult.Unknown, AudioComponentValidationResult.Passed }, Does.Contain (validation), "validation");
tcs.SetResult (true);
} catch (Exception e) {
tcs.SetException (e);
@@ -175,7 +174,7 @@ public void TestValidation ()
});
thread.IsBackground = true;
thread.Start ();
- Assert.IsTrue (tcs.Task.Wait (TimeSpan.FromSeconds (20)), "Timed out");
+ Assert.That (tcs.Task.Wait (TimeSpan.FromSeconds (20)), Is.True, "Timed out");
}
[Test]
@@ -200,14 +199,14 @@ public void TestValidationAsync ()
componentInfo.Version = 1;
componentInfo.ResourceUsage = resources;
using var component = AudioComponent.FindComponent (AudioTypeOutput.Generic);
- Assert.IsNotNull (component);
+ Assert.That (component, Is.Not.Null);
var cbEvent = new AutoResetEvent (false);
Action cb = (AudioComponentValidationResult _, NSDictionary? _) => {
cbEvent.Set ();
};
component.ValidateAsync (cb);
- Assert.True (cbEvent.WaitOne (20000), "Cb was not called.");
+ Assert.That (cbEvent.WaitOne (20000), Is.True, "Cb was not called.");
}
}
}
diff --git a/tests/monotouch-test/AudioToolbox/AudioConverterTest.cs b/tests/monotouch-test/AudioToolbox/AudioConverterTest.cs
index f87d66f4c716..4604a57193f8 100644
--- a/tests/monotouch-test/AudioToolbox/AudioConverterTest.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioConverterTest.cs
@@ -46,7 +46,7 @@ public void Properties ()
// create the AudioConverter
using AudioConverter? converter = AudioConverter.Create (srcFormat, dstFormat, out var createResult);
- Assert.AreEqual (AudioConverterError.None, createResult, $"AudioConverterCreate ({srcFormat} -> {dstFormat}): {createResult}");
+ Assert.That (createResult, Is.EqualTo (AudioConverterError.None), $"AudioConverterCreate ({srcFormat} -> {dstFormat}): {createResult}");
Assert.That (converter.PerformDownmix, Is.EqualTo (false), "PerformDownmix #0");
converter.PerformDownmix = true;
@@ -81,11 +81,11 @@ public void Properties ()
public void Formats ()
{
var decodeFormats = AudioConverter.DecodeFormats;
- Assert.NotNull (decodeFormats, "Decode #1");
+ Assert.That (decodeFormats, Is.Not.Null, "Decode #1");
Assert.That (decodeFormats.Length, Is.GreaterThan (10), "Decode Length #1");
var encodeFormats = AudioConverter.EncodeFormats;
- Assert.NotNull (encodeFormats, "Encode #1");
+ Assert.That (encodeFormats, Is.Not.Null, "Encode #1");
Assert.That (encodeFormats.Length, Is.GreaterThan (10), "Encode Length #1");
}
@@ -200,14 +200,14 @@ void Convert (string sourceFilePath, string destinationFilePath, AudioFormatType
Assert.Ignore ("Couldn't figure out the right properties to make the Apac encoder work:/");
// use AudioFormat API to fill out the rest of the description
var afe = AudioStreamBasicDescription.GetFormatInfo (ref dstFormat);
- Assert.AreEqual (AudioFormatError.None, afe, $"GetFormatInfo: {name}");
+ Assert.That (afe, Is.EqualTo (AudioFormatError.None), $"GetFormatInfo: {name}");
} else if (outputFormatType == AudioFormatType.AppleLossless) {
// compressed format - need to set at least format, sample rate and channel fields for kAudioFormatProperty_FormatInfo
dstFormat.ChannelsPerFrame = srcFormat.ChannelsPerFrame; // for iLBC num channels must be 1
// use AudioFormat API to fill out the rest of the description
var afe = AudioStreamBasicDescription.GetFormatInfo (ref dstFormat);
- Assert.AreEqual (AudioFormatError.None, afe, $"GetFormatInfo: {name}");
+ Assert.That (afe, Is.EqualTo (AudioFormatError.None), $"GetFormatInfo: {name}");
} else {
throw new NotImplementedException ();
}
@@ -217,7 +217,7 @@ void Convert (string sourceFilePath, string destinationFilePath, AudioFormatType
using AudioConverter? converter = options.HasValue ?
AudioConverter.Create (srcFormat, dstFormat, options.Value, out ce) :
AudioConverter.Create (srcFormat, dstFormat, out ce);
- Assert.AreEqual (AudioConverterError.None, ce, $"AudioConverterCreate : {name}\n\tSource format: {srcFormat}\n\tDestination format: {dstFormat})");
+ Assert.That (ce, Is.EqualTo (AudioConverterError.None), $"AudioConverterCreate : {name}\n\tSource format: {srcFormat}\n\tDestination format: {dstFormat})");
// set up source buffers and data proc info struct
var afio = new AudioFileIO (32 * 1024); // 32Kb
@@ -314,7 +314,7 @@ void Convert (string sourceFilePath, string destinationFilePath, AudioFormatType
fe = converter.FillComplexBuffer (ref ioOutputDataPackets, fillBufList, outputPacketDescriptions);
}
// if interrupted in the process of the conversion call, we must handle the error appropriately
- Assert.AreEqual (AudioConverterError.None, fe, $"FillComplexBuffer: {name}");
+ Assert.That (fe, Is.EqualTo (AudioConverterError.None), $"FillComplexBuffer: {name}");
if (ioOutputDataPackets == 0) {
// this is the EOF conditon
@@ -325,7 +325,7 @@ void Convert (string sourceFilePath, string destinationFilePath, AudioFormatType
var inNumBytes = fillBufList [0].DataByteSize;
var we = destinationFile.WritePackets (false, inNumBytes, outputPacketDescriptions, outputFilePos, ref ioOutputDataPackets, outputBuffer);
- Assert.AreEqual (AudioFileError.Success, we, $"WritePackets: {name}");
+ Assert.That (we, Is.EqualTo (AudioFileError.Success), $"WritePackets: {name}");
// advance output file packet position
outputFilePos += ioOutputDataPackets;
diff --git a/tests/monotouch-test/AudioToolbox/AudioFileGlobalInfoTest.cs b/tests/monotouch-test/AudioToolbox/AudioFileGlobalInfoTest.cs
index d4af2624c2aa..2e39b5a55955 100644
--- a/tests/monotouch-test/AudioToolbox/AudioFileGlobalInfoTest.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioFileGlobalInfoTest.cs
@@ -22,10 +22,10 @@ public class AudioFileGlobalInfoTest {
public void Properties ()
{
Assert.Multiple (() => {
- Assert.NotNull (AudioFileGlobalInfo.ReadableTypes, "ReadableTypes");
+ Assert.That (AudioFileGlobalInfo.ReadableTypes, Is.Not.Null, "ReadableTypes");
Assert.That (AudioFileGlobalInfo.ReadableTypes?.Length, Is.GreaterThan (0), "ReadableTypes #");
- Assert.NotNull (AudioFileGlobalInfo.WritableTypes, "WritableTypes");
+ Assert.That (AudioFileGlobalInfo.WritableTypes, Is.Not.Null, "WritableTypes");
Assert.That (AudioFileGlobalInfo.WritableTypes?.Length, Is.GreaterThan (0), "WritableTypes #");
var validFileTypeAndAudioFormatTypeCombinations = 0;
@@ -37,18 +37,18 @@ public void Properties ()
validAudioFileTypes.Remove (AudioFileType.MP2); // doesn't work on macOS 11
foreach (var fileType in validAudioFileTypes) {
- Assert.NotNull (AudioFileGlobalInfo.GetFileTypeName (fileType), $"GetFileTypeName: {fileType}");
+ Assert.That (AudioFileGlobalInfo.GetFileTypeName (fileType), Is.Not.Null, $"GetFileTypeName: {fileType}");
- Assert.NotNull (AudioFileGlobalInfo.GetAvailableFormats (fileType), $"GetAvailableFormats: {fileType}");
+ Assert.That (AudioFileGlobalInfo.GetAvailableFormats (fileType), Is.Not.Null, $"GetAvailableFormats: {fileType}");
Assert.That (AudioFileGlobalInfo.GetAvailableFormats (fileType)?.Length ?? -1, Is.GreaterThan (0), $"GetAvailableFormats #: {fileType}");
- Assert.NotNull (AudioFileGlobalInfo.GetExtensions (fileType), $"GetExtensions: {fileType}");
+ Assert.That (AudioFileGlobalInfo.GetExtensions (fileType), Is.Not.Null, $"GetExtensions: {fileType}");
Assert.That (AudioFileGlobalInfo.GetExtensions (fileType)?.Length ?? -1, Is.GreaterThan (0), $"GetExtensions #: {fileType}");
- Assert.NotNull (AudioFileGlobalInfo.GetMIMETypes (fileType), $"GetMIMETypes: {fileType}");
+ Assert.That (AudioFileGlobalInfo.GetMIMETypes (fileType), Is.Not.Null, $"GetMIMETypes: {fileType}");
Assert.That (AudioFileGlobalInfo.GetMIMETypes (fileType)?.Length ?? -1, Is.GreaterThan (0), $"GetMIMETypes #: {fileType}");
- Assert.NotNull (AudioFileGlobalInfo.GetUTIs (fileType), $"GetUTIs: {fileType}");
+ Assert.That (AudioFileGlobalInfo.GetUTIs (fileType), Is.Not.Null, $"GetUTIs: {fileType}");
Assert.That (AudioFileGlobalInfo.GetUTIs (fileType)?.Length ?? -1, Is.GreaterThan (0), $"GetUTIs #: {fileType}");
foreach (var audioFormatType in Enum.GetValues ()) {
@@ -61,7 +61,7 @@ public void Properties ()
}
Assert.That (validFileTypeAndAudioFormatTypeCombinations, Is.GreaterThan (50), "Valid FileType And AudioFormatType Combinations");
- Assert.NotNull (AudioFileGlobalInfo.AllExtensions, "AllExtensions");
+ Assert.That (AudioFileGlobalInfo.AllExtensions, Is.Not.Null, "AllExtensions");
Assert.That (AudioFileGlobalInfo.AllExtensions.Length, Is.GreaterThan (0), $"AllExtensions #");
});
}
diff --git a/tests/monotouch-test/AudioToolbox/AudioFileTest.cs b/tests/monotouch-test/AudioToolbox/AudioFileTest.cs
index 0dac320b1bcb..a1a52cb7a94b 100644
--- a/tests/monotouch-test/AudioToolbox/AudioFileTest.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioFileTest.cs
@@ -49,72 +49,72 @@ public void ApiTest ()
try {
var chunkType = AudioFileChunkType.CAFStreamDescription;
Assert.Multiple (() => {
- Assert.AreEqual (1, af.CountUserData (chunkType), "CountUserData #1");
- Assert.AreEqual (1, af.CountUserData ((uint) chunkType), "CountUserData #2");
+ Assert.That (af.CountUserData (chunkType), Is.EqualTo (1), "CountUserData #1");
+ Assert.That (af.CountUserData ((uint) chunkType), Is.EqualTo (1), "CountUserData #2");
- Assert.AreEqual (32, af.GetUserDataSize (chunkType, 0), "GetUserDataSize #1");
- Assert.AreEqual (32, af.GetUserDataSize ((uint) chunkType, 0), "GetUserDataSize #2");
+ Assert.That (af.GetUserDataSize (chunkType, 0), Is.EqualTo (32), "GetUserDataSize #1");
+ Assert.That (af.GetUserDataSize ((uint) chunkType, 0), Is.EqualTo (32), "GetUserDataSize #2");
- Assert.AreEqual (AudioFileError.Success, af.GetUserDataSize (chunkType, 0, out var userDataSize64), "GetUserDataSize64 #1");
- Assert.AreEqual (32, userDataSize64, "GetUserDataSize64 #2");
+ Assert.That (af.GetUserDataSize (chunkType, 0, out var userDataSize64), Is.EqualTo (AudioFileError.Success), "GetUserDataSize64 #1");
+ Assert.That (userDataSize64, Is.EqualTo (32), "GetUserDataSize64 #2");
- Assert.AreEqual (AudioFileError.Success, af.GetUserDataSize ((uint) chunkType, 0, out userDataSize64), "GetUserDataSize64 #3");
- Assert.AreEqual (32, userDataSize64, "GetUserDataSize64 #4");
+ Assert.That (af.GetUserDataSize ((uint) chunkType, 0, out userDataSize64), Is.EqualTo (AudioFileError.Success), "GetUserDataSize64 #3");
+ Assert.That (userDataSize64, Is.EqualTo (32), "GetUserDataSize64 #4");
size = memorySize;
- Assert.AreEqual (AudioFileError.Success, af.GetUserData (chunkType, 0, ref size, memory), "GetUserData #1");
- Assert.AreEqual (32, size, "GetUserData #2");
- Assert.AreEqual (size, expectedData.Length, "GetUserData #3");
+ Assert.That (af.GetUserData (chunkType, 0, ref size, memory), Is.EqualTo (AudioFileError.Success), "GetUserData #1");
+ Assert.That (size, Is.EqualTo (32), "GetUserData #2");
+ Assert.That (expectedData.Length, Is.EqualTo (size), "GetUserData #3");
for (var i = 0; i < expectedData.Length; i++) {
- Assert.AreEqual (expectedData [i], Marshal.ReadByte (memory, i), $"GetUserData #4[{i}]");
+ Assert.That (Marshal.ReadByte (memory, i), Is.EqualTo (expectedData [i]), $"GetUserData #4[{i}]");
Marshal.WriteByte (memory, i, 0);
}
size = memorySize;
- Assert.AreEqual (0, af.GetUserData ((int) chunkType, 0, ref size, memory), "GetUserData/B #1");
- Assert.AreEqual (32, size, "GetUserData/B #2");
- Assert.AreEqual (size, expectedData.Length, "GetUserData/B #3");
+ Assert.That (af.GetUserData ((int) chunkType, 0, ref size, memory), Is.EqualTo (0), "GetUserData/B #1");
+ Assert.That (size, Is.EqualTo (32), "GetUserData/B #2");
+ Assert.That (expectedData.Length, Is.EqualTo (size), "GetUserData/B #3");
for (var i = 0; i < expectedData.Length; i++) {
- Assert.AreEqual (expectedData [i], Marshal.ReadByte (memory, i), $"GetUserData/B #4[{i}]");
+ Assert.That (Marshal.ReadByte (memory, i), Is.EqualTo (expectedData [i]), $"GetUserData/B #4[{i}]");
Marshal.WriteByte (memory, i, 0);
}
size = memorySize;
offset = 16;
- Assert.AreEqual (AudioFileError.Success, af.GetUserData (chunkType, 0, offset, ref size, memory), "GetUserDataAtOffset/A #1");
- Assert.AreEqual (32 - offset, size, "GetUserDataAtOffset/A #2");
- Assert.AreEqual (size, expectedData.Length - offset, "GetUserDataAtOffset/A #3");
+ Assert.That (af.GetUserData (chunkType, 0, offset, ref size, memory), Is.EqualTo (AudioFileError.Success), "GetUserDataAtOffset/A #1");
+ Assert.That (size, Is.EqualTo (32 - offset), "GetUserDataAtOffset/A #2");
+ Assert.That (expectedData.Length - offset, Is.EqualTo (size), "GetUserDataAtOffset/A #3");
for (var i = offset; i < expectedData.Length; i++) {
- Assert.AreEqual (expectedData [i], Marshal.ReadByte (memory, i - offset), $"GetUserDataAtOffset/A #4[{i}]");
+ Assert.That (Marshal.ReadByte (memory, i - offset), Is.EqualTo (expectedData [i]), $"GetUserDataAtOffset/A #4[{i}]");
Marshal.WriteByte (memory, i - offset, 0);
}
size = memorySize;
offset = 12;
- Assert.AreEqual (AudioFileError.Success, af.GetUserData ((uint) chunkType, 0, offset, ref size, memory), "GetUserDataAtOffset/B #1");
- Assert.AreEqual (32 - offset, size, "GetUserDataAtOffset/B #2");
- Assert.AreEqual (size, expectedData.Length - offset, "GetUserDataAtOffset/B #3");
+ Assert.That (af.GetUserData ((uint) chunkType, 0, offset, ref size, memory), Is.EqualTo (AudioFileError.Success), "GetUserDataAtOffset/B #1");
+ Assert.That (size, Is.EqualTo (32 - offset), "GetUserDataAtOffset/B #2");
+ Assert.That (expectedData.Length - offset, Is.EqualTo (size), "GetUserDataAtOffset/B #3");
for (var i = offset; i < expectedData.Length; i++) {
- Assert.AreEqual (expectedData [i], Marshal.ReadByte (memory, i - offset), $"GetUserDataAtOffset/B #4[{i}]");
+ Assert.That (Marshal.ReadByte (memory, i - offset), Is.EqualTo (expectedData [i]), $"GetUserDataAtOffset/B #4[{i}]");
Marshal.WriteByte (memory, i - offset, 0);
}
size = memorySize;
offset = 24;
buffer = new byte [memorySize];
- Assert.AreEqual (AudioFileError.Success, af.GetUserData (chunkType, 0, offset, buffer, out size), "GetUserDataAtOffset/C #1");
- Assert.AreEqual (32 - offset, size, "GetUserDataAtOffset/C #2");
- Assert.AreEqual (size, expectedData.Length - offset, "GetUserDataAtOffset/C #3");
+ Assert.That (af.GetUserData (chunkType, 0, offset, buffer, out size), Is.EqualTo (AudioFileError.Success), "GetUserDataAtOffset/C #1");
+ Assert.That (size, Is.EqualTo (32 - offset), "GetUserDataAtOffset/C #2");
+ Assert.That (expectedData.Length - offset, Is.EqualTo (size), "GetUserDataAtOffset/C #3");
for (var i = offset; i < expectedData.Length; i++)
- Assert.AreEqual (expectedData [i], buffer [i - offset], $"GetUserDataAtOffset/C #4[{i}]");
+ Assert.That (buffer [i - offset], Is.EqualTo (expectedData [i]), $"GetUserDataAtOffset/C #4[{i}]");
size = memorySize;
offset = 8;
- Assert.AreEqual (AudioFileError.Success, af.GetUserData ((uint) chunkType, 0, offset, buffer, out size), "GetUserDataAtOffset/D #1");
- Assert.AreEqual (32 - offset, size, "GetUserDataAtOffset/D #2");
- Assert.AreEqual (size, expectedData.Length - offset, "GetUserDataAtOffset/D #3");
+ Assert.That (af.GetUserData ((uint) chunkType, 0, offset, buffer, out size), Is.EqualTo (AudioFileError.Success), "GetUserDataAtOffset/D #1");
+ Assert.That (size, Is.EqualTo (32 - offset), "GetUserDataAtOffset/D #2");
+ Assert.That (expectedData.Length - offset, Is.EqualTo (size), "GetUserDataAtOffset/D #3");
for (var i = offset; i < expectedData.Length; i++)
- Assert.AreEqual (expectedData [i], buffer [i - offset], $"GetUserDataAtOffset/D #4[{i}]");
+ Assert.That (buffer [i - offset], Is.EqualTo (expectedData [i]), $"GetUserDataAtOffset/D #4[{i}]");
});
} finally {
Marshal.FreeHGlobal (memory);
diff --git a/tests/monotouch-test/AudioToolbox/AudioFormatAvailabilityTest.cs b/tests/monotouch-test/AudioToolbox/AudioFormatAvailabilityTest.cs
index 0bcc7d79bfa9..f5e195dc1a1d 100644
--- a/tests/monotouch-test/AudioToolbox/AudioFormatAvailabilityTest.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioFormatAvailabilityTest.cs
@@ -17,13 +17,13 @@ public class AudioFormatAvailabilityTest {
[Test]
public void GetDecoders ()
{
- Assert.IsNotNull (AudioFormatAvailability.GetDecoders (AudioFormatType.LinearPCM));
+ Assert.That (AudioFormatAvailability.GetDecoders (AudioFormatType.LinearPCM), Is.Not.Null);
}
[Test]
public void GetEncoders ()
{
- Assert.IsNotNull (AudioFormatAvailability.GetEncoders (AudioFormatType.AC3));
+ Assert.That (AudioFormatAvailability.GetEncoders (AudioFormatType.AC3), Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/AudioToolbox/AudioFormatTest.cs b/tests/monotouch-test/AudioToolbox/AudioFormatTest.cs
index 76a617005ff1..90981ace72ac 100644
--- a/tests/monotouch-test/AudioToolbox/AudioFormatTest.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioFormatTest.cs
@@ -22,7 +22,7 @@ public void GetFirstPlayableFormat ()
var ofl = asbd.GetOutputFormatList ();
- Assert.IsNotNull (AudioFormat.GetFirstPlayableFormat (ofl));
+ Assert.That (AudioFormat.GetFirstPlayableFormat (ofl), Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/AudioToolbox/AudioQueueBufferTest.cs b/tests/monotouch-test/AudioToolbox/AudioQueueBufferTest.cs
index c6b001238ef0..ceb892c00fba 100644
--- a/tests/monotouch-test/AudioToolbox/AudioQueueBufferTest.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioQueueBufferTest.cs
@@ -30,18 +30,18 @@ public unsafe void Properties ()
};
using var aq = new OutputAudioQueue (asbd);
AudioQueueBuffer* buffer = null;
- Assert.AreEqual (AudioQueueStatus.Ok, aq.AllocateBuffer (5000, 1, out buffer), "AllocateBuffer");
+ Assert.That (aq.AllocateBuffer (5000, 1, out buffer), Is.EqualTo (AudioQueueStatus.Ok), "AllocateBuffer");
Assert.Multiple (() => {
- Assert.AreEqual (5000, buffer->AudioDataBytesCapacity, "AudioDataBytesCapacity");
- Assert.AreNotEqual (IntPtr.Zero, buffer->AudioData, "AudioData");
- Assert.AreEqual (0, buffer->AudioDataByteSize, "AudioDataByteSize");
- Assert.AreEqual (IntPtr.Zero, buffer->UserData, "UserData");
- Assert.AreEqual (1, buffer->PacketDescriptionCapacity, "PacketDescriptionCapacity");
- Assert.AreNotEqual (IntPtr.Zero, buffer->IntPtrPacketDescriptions, "IntPtrPacketDescriptions");
- Assert.AreEqual (0, buffer->PacketDescriptionCount, "PacketDescriptionCount");
- Assert.AreEqual (0, buffer->PacketDescriptions.Length, "PacketDescriptions");
- Assert.AreEqual (5000, buffer->AsSpan ().Length, "AsSpan ().Length");
- Assert.AreEqual (0, buffer->AsSpanOfValidData ().Length, "AsSpanOfValidData ().Length");
+ Assert.That (buffer->AudioDataBytesCapacity, Is.EqualTo (5000), "AudioDataBytesCapacity");
+ Assert.That (buffer->AudioData, Is.Not.EqualTo (IntPtr.Zero), "AudioData");
+ Assert.That (buffer->AudioDataByteSize, Is.EqualTo (0), "AudioDataByteSize");
+ Assert.That (buffer->UserData, Is.EqualTo (IntPtr.Zero), "UserData");
+ Assert.That (buffer->PacketDescriptionCapacity, Is.EqualTo (1), "PacketDescriptionCapacity");
+ Assert.That (buffer->IntPtrPacketDescriptions, Is.Not.EqualTo (IntPtr.Zero), "IntPtrPacketDescriptions");
+ Assert.That (buffer->PacketDescriptionCount, Is.EqualTo (0), "PacketDescriptionCount");
+ Assert.That (buffer->PacketDescriptions.Length, Is.EqualTo (0), "PacketDescriptions");
+ Assert.That (buffer->AsSpan ().Length, Is.EqualTo (5000), "AsSpan ().Length");
+ Assert.That (buffer->AsSpanOfValidData ().Length, Is.EqualTo (0), "AsSpanOfValidData ().Length");
buffer->PacketDescriptions = new AudioStreamPacketDescription [] {
new AudioStreamPacketDescription () {
@@ -50,15 +50,15 @@ public unsafe void Properties ()
DataByteSize = 4,
},
};
- Assert.AreEqual (1, buffer->PacketDescriptionCapacity, "PacketDescriptionCapacity#2");
- Assert.AreEqual (1, buffer->PacketDescriptionCount, "PacketDescriptionCount#2");
- Assert.AreEqual (2, buffer->PacketDescriptions [0].StartOffset, "PacketDescriptions[0].StartOffset");
- Assert.AreEqual (3, buffer->PacketDescriptions [0].VariableFramesInPacket, "PacketDescriptions[0].VariableFramesInPacket");
- Assert.AreEqual (4, buffer->PacketDescriptions [0].DataByteSize, "PacketDescriptions[0].DataByteSize");
+ Assert.That (buffer->PacketDescriptionCapacity, Is.EqualTo (1), "PacketDescriptionCapacity#2");
+ Assert.That (buffer->PacketDescriptionCount, Is.EqualTo (1), "PacketDescriptionCount#2");
+ Assert.That (buffer->PacketDescriptions [0].StartOffset, Is.EqualTo (2), "PacketDescriptions[0].StartOffset");
+ Assert.That (buffer->PacketDescriptions [0].VariableFramesInPacket, Is.EqualTo (3), "PacketDescriptions[0].VariableFramesInPacket");
+ Assert.That (buffer->PacketDescriptions [0].DataByteSize, Is.EqualTo (4), "PacketDescriptions[0].DataByteSize");
buffer->PacketDescriptions = new AudioStreamPacketDescription [0];
- Assert.AreEqual (1, buffer->PacketDescriptionCapacity, "PacketDescriptionCapacity#3");
- Assert.AreEqual (0, buffer->PacketDescriptionCount, "PacketDescriptionCount#3");
+ Assert.That (buffer->PacketDescriptionCapacity, Is.EqualTo (1), "PacketDescriptionCapacity#3");
+ Assert.That (buffer->PacketDescriptionCount, Is.EqualTo (0), "PacketDescriptionCount#3");
Assert.Throws (() => buffer->PacketDescriptions = new AudioStreamPacketDescription [2], "too many packet descriptions");
@@ -66,21 +66,21 @@ public unsafe void Properties ()
fixed (byte* dataPtr = data)
buffer->CopyToAudioData ((IntPtr) dataPtr, data.Length);
Assert.That (buffer->AsSpanOfValidData ().ToArray (), Is.EqualTo (data), "CopyToAudioData 1");
- Assert.AreEqual (data.Length, buffer->AudioDataByteSize, "CopyToAudioData 1 - AudioDataByteSize");
+ Assert.That (buffer->AudioDataByteSize, Is.EqualTo (data.Length), "CopyToAudioData 1 - AudioDataByteSize");
Assert.That (buffer->AsSpan ().Length, Is.EqualTo (5000), "CopyToAudioData 1 - AsSpan");
Assert.That (buffer->AsSpan ().Slice (0, data.Length).ToArray (), Is.EqualTo (buffer->AsSpanOfValidData ().ToArray ()), "CopyToAudioData 1 - Sliced AsSpan");
data = new byte [] { 2, 3, 4, 5, 6 };
buffer->CopyToAudioData (data);
Assert.That (buffer->AsSpanOfValidData ().ToArray (), Is.EqualTo (data), "CopyToAudioData 2");
- Assert.AreEqual (data.Length, buffer->AudioDataByteSize, "CopyToAudioData 2 - AudioDataByteSize");
+ Assert.That (buffer->AudioDataByteSize, Is.EqualTo (data.Length), "CopyToAudioData 2 - AudioDataByteSize");
Assert.That (buffer->AsSpan ().Length, Is.EqualTo (5000), "CopyToAudioData 2 - AsSpan");
Assert.That (buffer->AsSpan ().Slice (0, data.Length).ToArray (), Is.EqualTo (buffer->AsSpanOfValidData ().ToArray ()), "CopyToAudioData 2 - Sliced AsSpan");
data = new byte [5000];
buffer->CopyToAudioData (data);
Assert.That (buffer->AsSpanOfValidData ().ToArray (), Is.EqualTo (data), "CopyToAudioData 3");
- Assert.AreEqual (data.Length, buffer->AudioDataByteSize, "CopyToAudioData 3 - AudioDataByteSize");
+ Assert.That (buffer->AudioDataByteSize, Is.EqualTo (data.Length), "CopyToAudioData 3 - AudioDataByteSize");
Assert.That (buffer->AsSpan ().Length, Is.EqualTo (5000), "CopyToAudioData 3 - AsSpan");
Assert.That (buffer->AsSpan ().Slice (0, data.Length).ToArray (), Is.EqualTo (buffer->AsSpanOfValidData ().ToArray ()), "CopyToAudioData 3 - Sliced AsSpan");
@@ -93,14 +93,14 @@ public unsafe void Properties ()
data = new byte [0];
buffer->CopyToAudioData (IntPtr.Zero, 0);
Assert.That (buffer->AsSpanOfValidData ().ToArray (), Is.EqualTo (data), "CopyToAudioData 5");
- Assert.AreEqual (data.Length, buffer->AudioDataByteSize, "CopyToAudioData 5 - AudioDataByteSize");
+ Assert.That (buffer->AudioDataByteSize, Is.EqualTo (data.Length), "CopyToAudioData 5 - AudioDataByteSize");
Assert.That (buffer->AsSpan ().Length, Is.EqualTo (5000), "CopyToAudioData 5 - AsSpan");
Assert.That (buffer->AsSpan ().Slice (0, data.Length).ToArray (), Is.EqualTo (buffer->AsSpanOfValidData ().ToArray ()), "CopyToAudioData 5 - Sliced AsSpan");
data = new byte [0];
buffer->CopyToAudioData (data);
Assert.That (buffer->AsSpanOfValidData ().ToArray (), Is.EqualTo (data), "CopyToAudioData 6");
- Assert.AreEqual (data.Length, buffer->AudioDataByteSize, "CopyToAudioData 6 - AudioDataByteSize");
+ Assert.That (buffer->AudioDataByteSize, Is.EqualTo (data.Length), "CopyToAudioData 6 - AudioDataByteSize");
Assert.That (buffer->AsSpan ().Length, Is.EqualTo (5000), "CopyToAudioData 6 - AsSpan");
Assert.That (buffer->AsSpan ().Slice (0, data.Length).ToArray (), Is.EqualTo (buffer->AsSpanOfValidData ().ToArray ()), "CopyToAudioData 6 - Sliced AsSpan");
diff --git a/tests/monotouch-test/AudioToolbox/AudioQueueTest.cs b/tests/monotouch-test/AudioToolbox/AudioQueueTest.cs
index ba5531637927..a5249b42ea58 100644
--- a/tests/monotouch-test/AudioToolbox/AudioQueueTest.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioQueueTest.cs
@@ -41,9 +41,9 @@ public void ChannelAssignments ()
for (int i = 0; i < aq.AudioStreamDescription.ChannelsPerFrame; i++) {
assignments.Add (new AudioQueueChannelAssignment (id, (uint) i));
}
- Assert.AreEqual (AudioQueueStatus.Ok, aq.SetChannelAssignments (assignments.ToArray ()));
+ Assert.That (aq.SetChannelAssignments (assignments.ToArray ()), Is.EqualTo (AudioQueueStatus.Ok));
} else {
- Assert.Ignore ("No outputs in the current route ({0})", route.Description);
+ Assert.Ignore ($"No outputs in the current route ({route.Description})");
}
}
@@ -63,13 +63,13 @@ public void ProcessingTap ()
// called = true;
return 33;
}, AudioQueueProcessingTapFlags.PreEffects, out ret)) {
- Assert.AreEqual (AudioQueueStatus.Ok, ret, "#1");
+ Assert.That (ret, Is.EqualTo (AudioQueueStatus.Ok), "#1");
unsafe {
AudioQueueBuffer* buffer;
- Assert.AreEqual (AudioQueueStatus.Ok, aq.AllocateBuffer (5000, out buffer), "#2");
- Assert.AreEqual (AudioQueueStatus.Ok, aq.EnqueueBuffer (buffer), "#3");
- //Assert.AreEqual (AudioQueueStatus.Ok, aq.Start (), "#4");
+ Assert.That (aq.AllocateBuffer (5000, out buffer), Is.EqualTo (AudioQueueStatus.Ok), "#2");
+ Assert.That (aq.EnqueueBuffer (buffer), Is.EqualTo (AudioQueueStatus.Ok), "#3");
+ //Assert.That (aq.Start (), Is.EqualTo (AudioQueueStatus.Ok), "#4");
}
}
@@ -88,20 +88,20 @@ public unsafe void AllocateBuffer_1 ()
{
var asbd = AudioStreamBasicDescription.CreateLinearPCM ();
using var aq = new InputAudioQueue (asbd);
- Assert.AreEqual (AudioQueueStatus.Ok, aq.AllocateBuffer (5000, out AudioQueueBuffer* buffer), "AllocateBuffer");
+ Assert.That (aq.AllocateBuffer (5000, out AudioQueueBuffer* buffer), Is.EqualTo (AudioQueueStatus.Ok), "AllocateBuffer");
Assert.Multiple (() => {
- Assert.AreEqual (5000, buffer->AudioDataBytesCapacity, "AudioDataBytesCapacity");
- Assert.AreNotEqual (IntPtr.Zero, buffer->AudioData, "AudioData");
- Assert.AreEqual (0, buffer->AudioDataByteSize, "AudioDataByteSize");
- Assert.AreEqual (IntPtr.Zero, buffer->UserData, "UserData");
- Assert.AreEqual (0, buffer->PacketDescriptionCapacity, "PacketDescriptionCapacity");
- Assert.AreEqual (IntPtr.Zero, buffer->IntPtrPacketDescriptions, "IntPtrPacketDescriptions");
- Assert.AreEqual (0, buffer->PacketDescriptionCount, "PacketDescriptionCount");
- Assert.AreEqual (0, buffer->PacketDescriptions.Length, "PacketDescriptions");
- Assert.AreEqual (5000, buffer->AsSpan ().Length, "AsSpan ().Length");
- Assert.AreEqual (0, buffer->AsSpanOfValidData ().Length, "AsSpanOfValidData ().Length");
+ Assert.That (buffer->AudioDataBytesCapacity, Is.EqualTo (5000), "AudioDataBytesCapacity");
+ Assert.That (buffer->AudioData, Is.Not.EqualTo (IntPtr.Zero), "AudioData");
+ Assert.That (buffer->AudioDataByteSize, Is.EqualTo (0), "AudioDataByteSize");
+ Assert.That (buffer->UserData, Is.EqualTo (IntPtr.Zero), "UserData");
+ Assert.That (buffer->PacketDescriptionCapacity, Is.EqualTo (0), "PacketDescriptionCapacity");
+ Assert.That (buffer->IntPtrPacketDescriptions, Is.EqualTo (IntPtr.Zero), "IntPtrPacketDescriptions");
+ Assert.That (buffer->PacketDescriptionCount, Is.EqualTo (0), "PacketDescriptionCount");
+ Assert.That (buffer->PacketDescriptions.Length, Is.EqualTo (0), "PacketDescriptions");
+ Assert.That (buffer->AsSpan ().Length, Is.EqualTo (5000), "AsSpan ().Length");
+ Assert.That (buffer->AsSpanOfValidData ().Length, Is.EqualTo (0), "AsSpanOfValidData ().Length");
});
- Assert.AreEqual (AudioQueueStatus.Ok, aq.FreeBuffer (buffer), "FreeBuffer");
+ Assert.That (aq.FreeBuffer (buffer), Is.EqualTo (AudioQueueStatus.Ok), "FreeBuffer");
}
[Test]
@@ -119,18 +119,18 @@ public unsafe void AllocateBuffer_2 ()
FramesPerPacket = 1024,
};
using var aq = new OutputAudioQueue (asbd);
- Assert.AreEqual (AudioQueueStatus.Ok, aq.AllocateBuffer (5000, 1, out var buffer), "AllocateBuffer");
+ Assert.That (aq.AllocateBuffer (5000, 1, out var buffer), Is.EqualTo (AudioQueueStatus.Ok), "AllocateBuffer");
Assert.Multiple (() => {
- Assert.AreEqual (5000, buffer->AudioDataBytesCapacity, "AudioDataBytesCapacity");
- Assert.AreNotEqual (IntPtr.Zero, buffer->AudioData, "AudioData");
- Assert.AreEqual (0, buffer->AudioDataByteSize, "AudioDataByteSize");
- Assert.AreEqual (IntPtr.Zero, buffer->UserData, "UserData");
- Assert.AreEqual (1, buffer->PacketDescriptionCapacity, "PacketDescriptionCapacity");
- Assert.AreNotEqual (IntPtr.Zero, buffer->IntPtrPacketDescriptions, "IntPtrPacketDescriptions");
- Assert.AreEqual (0, buffer->PacketDescriptionCount, "PacketDescriptionCount");
- Assert.AreEqual (0, buffer->PacketDescriptions.Length, "PacketDescriptions");
- Assert.AreEqual (5000, buffer->AsSpan ().Length, "AsSpan ().Length");
- Assert.AreEqual (0, buffer->AsSpanOfValidData ().Length, "AsSpanOfValidData ().Length");
+ Assert.That (buffer->AudioDataBytesCapacity, Is.EqualTo (5000), "AudioDataBytesCapacity");
+ Assert.That (buffer->AudioData, Is.Not.EqualTo (IntPtr.Zero), "AudioData");
+ Assert.That (buffer->AudioDataByteSize, Is.EqualTo (0), "AudioDataByteSize");
+ Assert.That (buffer->UserData, Is.EqualTo (IntPtr.Zero), "UserData");
+ Assert.That (buffer->PacketDescriptionCapacity, Is.EqualTo (1), "PacketDescriptionCapacity");
+ Assert.That (buffer->IntPtrPacketDescriptions, Is.Not.EqualTo (IntPtr.Zero), "IntPtrPacketDescriptions");
+ Assert.That (buffer->PacketDescriptionCount, Is.EqualTo (0), "PacketDescriptionCount");
+ Assert.That (buffer->PacketDescriptions.Length, Is.EqualTo (0), "PacketDescriptions");
+ Assert.That (buffer->AsSpan ().Length, Is.EqualTo (5000), "AsSpan ().Length");
+ Assert.That (buffer->AsSpanOfValidData ().Length, Is.EqualTo (0), "AsSpanOfValidData ().Length");
});
}
}
diff --git a/tests/monotouch-test/AudioToolbox/AudioStreamBasicDescriptionTest.cs b/tests/monotouch-test/AudioToolbox/AudioStreamBasicDescriptionTest.cs
index 5dcb29710f7f..ae99b691544e 100644
--- a/tests/monotouch-test/AudioToolbox/AudioStreamBasicDescriptionTest.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioStreamBasicDescriptionTest.cs
@@ -18,26 +18,26 @@ public class AudioStreamBasicDescriptionTest {
public void CreateLinearPCM ()
{
var pcm = AudioStreamBasicDescription.CreateLinearPCM ();
- Assert.IsNotNull (pcm.FormatName);
- Assert.IsFalse (pcm.IsVariableBitrate);
+ Assert.That (pcm.FormatName, Is.Not.Null);
+ Assert.That (pcm.IsVariableBitrate, Is.False);
}
[Test]
public void VBR ()
{
var mp3 = new AudioStreamBasicDescription (AudioFormatType.MPEGLayer3);
- Assert.IsTrue (mp3.IsVariableBitrate);
+ Assert.That (mp3.IsVariableBitrate, Is.True);
}
[Test]
public void GetFormatInfo ()
{
var asbd = new AudioStreamBasicDescription (AudioFormatType.MPEG4AAC);
- Assert.AreEqual (AudioFormatError.None, AudioStreamBasicDescription.GetFormatInfo (ref asbd));
+ Assert.That (AudioStreamBasicDescription.GetFormatInfo (ref asbd), Is.EqualTo (AudioFormatError.None));
- Assert.IsNotNull (AudioStreamBasicDescription.GetAvailableEncodeChannelLayoutTags (asbd));
- Assert.IsNotNull (AudioStreamBasicDescription.GetAvailableEncodeNumberChannels (asbd));
- Assert.IsNotNull (asbd.GetOutputFormatList ());
+ Assert.That (AudioStreamBasicDescription.GetAvailableEncodeChannelLayoutTags (asbd), Is.Not.Null);
+ Assert.That (AudioStreamBasicDescription.GetAvailableEncodeNumberChannels (asbd), Is.Not.Null);
+ Assert.That (asbd.GetOutputFormatList (), Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/AudioToolbox/AudioUnitTest.cs b/tests/monotouch-test/AudioToolbox/AudioUnitTest.cs
index 5b6d362b0d31..598c96e22c2a 100644
--- a/tests/monotouch-test/AudioToolbox/AudioUnitTest.cs
+++ b/tests/monotouch-test/AudioToolbox/AudioUnitTest.cs
@@ -32,13 +32,13 @@ public void Callbacks ()
var rv = audioUnit.SetInputCallback (InputCallback, AudioUnitScopeType.Input, 1);
if (rv == AudioUnitStatus.CannotDoInCurrentContext)
Assert.Ignore ("Can't set input callback"); // No microphone? In a VM? This seems to happen often on bots.
- Assert.AreEqual (AudioUnitStatus.OK, rv, "SetInputCallback");
- Assert.AreEqual (AudioUnitStatus.OK, audioUnit.Initialize (), "Initialize");
+ Assert.That (rv, Is.EqualTo (AudioUnitStatus.OK), "SetInputCallback");
+ Assert.That (audioUnit.Initialize (), Is.EqualTo (AudioUnitStatus.OK), "Initialize");
try {
- Assert.AreEqual (AudioUnitStatus.OK, audioUnit.Start (), "Start");
- Assert.IsTrue (inputCallbackEvent.WaitOne (TimeSpan.FromSeconds (1)), "No input callback for 1 second");
+ Assert.That (audioUnit.Start (), Is.EqualTo (AudioUnitStatus.OK), "Start");
+ Assert.That (inputCallbackEvent.WaitOne (TimeSpan.FromSeconds (1)), Is.True, "No input callback for 1 second");
} finally {
- Assert.AreEqual (AudioUnitStatus.OK, audioUnit.Stop (), "Stop");
+ Assert.That (audioUnit.Stop (), Is.EqualTo (AudioUnitStatus.OK), "Stop");
}
}
diff --git a/tests/monotouch-test/AudioToolbox/MusicPlayer.cs b/tests/monotouch-test/AudioToolbox/MusicPlayer.cs
index f9639a2fe6aa..7970fa47be19 100644
--- a/tests/monotouch-test/AudioToolbox/MusicPlayer.cs
+++ b/tests/monotouch-test/AudioToolbox/MusicPlayer.cs
@@ -19,14 +19,14 @@ public class MusicPlayerTest {
public void Defaults ()
{
using (var player = new MusicPlayer ()) {
- Assert.IsFalse (player.IsPlaying, "IsPlaying");
- Assert.AreEqual (0, player.Time, "Time");
- Assert.AreEqual (1, player.PlayRateScalar, "PlayRateScalar");
- Assert.AreEqual (MusicPlayerStatus.InvalidPlayerState, player.GetHostTimeForBeats (0, out var hosttime), "GetHostTimeForBeats");
- Assert.AreEqual (0, hosttime, "GetHostTimeForBeats - rv");
- Assert.AreEqual (MusicPlayerStatus.InvalidPlayerState, player.GetBeatsForHostTime (0, out var beats), "GetBeatsForHostTime");
- Assert.AreEqual (0, beats, "GetBeatsForHostTime - rv");
- Assert.IsNull (player.MusicSequence, "MusicSequence");
+ Assert.That (player.IsPlaying, Is.False, "IsPlaying");
+ Assert.That (player.Time, Is.EqualTo (0), "Time");
+ Assert.That (player.PlayRateScalar, Is.EqualTo (1), "PlayRateScalar");
+ Assert.That (player.GetHostTimeForBeats (0, out var hosttime), Is.EqualTo (MusicPlayerStatus.InvalidPlayerState), "GetHostTimeForBeats");
+ Assert.That (hosttime, Is.EqualTo (0), "GetHostTimeForBeats - rv");
+ Assert.That (player.GetBeatsForHostTime (0, out var beats), Is.EqualTo (MusicPlayerStatus.InvalidPlayerState), "GetBeatsForHostTime");
+ Assert.That (beats, Is.EqualTo (0), "GetBeatsForHostTime - rv");
+ Assert.That (player.MusicSequence, Is.Null, "MusicSequence");
}
}
@@ -35,13 +35,13 @@ public void MusicSequenceTest ()
{
using (var player = new MusicPlayer ()) {
using (var ms = new MusicSequence ()) {
- Assert.IsNull (player.MusicSequence, "MusicSequence A");
+ Assert.That (player.MusicSequence, Is.Null, "MusicSequence A");
player.MusicSequence = null;
- Assert.IsNull (player.MusicSequence, "MusicSequence B");
+ Assert.That (player.MusicSequence, Is.Null, "MusicSequence B");
player.MusicSequence = ms;
- Assert.AreSame (ms, player.MusicSequence, "MusicSequence C");
+ Assert.That (player.MusicSequence, Is.SameAs (ms), "MusicSequence C");
player.MusicSequence = null;
- Assert.IsNull (player.MusicSequence, "MusicSequence D");
+ Assert.That (player.MusicSequence, Is.Null, "MusicSequence D");
}
}
}
@@ -50,9 +50,9 @@ public void MusicSequenceTest ()
public void PlayRateScalarTest ()
{
using (var player = new MusicPlayer ()) {
- Assert.AreEqual (1, player.PlayRateScalar, "PlayRateScalar A");
+ Assert.That (player.PlayRateScalar, Is.EqualTo (1), "PlayRateScalar A");
player.PlayRateScalar = 2;
- Assert.AreEqual (2, player.PlayRateScalar, "PlayRateScalar B");
+ Assert.That (player.PlayRateScalar, Is.EqualTo (2), "PlayRateScalar B");
}
}
@@ -60,14 +60,14 @@ public void PlayRateScalarTest ()
public void TimeTest ()
{
using (var player = new MusicPlayer ()) {
- Assert.AreEqual (0, player.Time, "Time A");
+ Assert.That (player.Time, Is.EqualTo (0), "Time A");
player.Time = 1;
- Assert.AreEqual (0, player.Time, "Time B");
- Assert.AreEqual (MusicPlayerStatus.Success, player.GetTime (out var time), "GetTime A");
- Assert.AreEqual (0, time, "GetTime B");
- Assert.AreEqual (MusicPlayerStatus.Success, player.SetTime (1), "SetTime A");
- Assert.AreEqual (MusicPlayerStatus.Success, player.GetTime (out time), "GetTime C");
- Assert.AreEqual (0, time, "GetTime D");
+ Assert.That (player.Time, Is.EqualTo (0), "Time B");
+ Assert.That (player.GetTime (out var time), Is.EqualTo (MusicPlayerStatus.Success), "GetTime A");
+ Assert.That (time, Is.EqualTo (0), "GetTime B");
+ Assert.That (player.SetTime (1), Is.EqualTo (MusicPlayerStatus.Success), "SetTime A");
+ Assert.That (player.GetTime (out time), Is.EqualTo (MusicPlayerStatus.Success), "GetTime C");
+ Assert.That (time, Is.EqualTo (0), "GetTime D");
}
}
@@ -75,19 +75,19 @@ public void TimeTest ()
public void CreateTest ()
{
using var player = MusicPlayer.Create (out var status);
- Assert.NotNull (player, "Got a player");
- Assert.AreEqual (MusicPlayerStatus.Success, status, "Status");
+ Assert.That (player, Is.Not.Null, "Got a player");
+ Assert.That (status, Is.EqualTo (MusicPlayerStatus.Success), "Status");
}
[Test]
public void StartStopPreroll ()
{
using var player = MusicPlayer.Create (out var status);
- Assert.NotNull (player, "Got a player");
- Assert.AreEqual (MusicPlayerStatus.Success, status, "Status");
- Assert.AreEqual (MusicPlayerStatus.NoSequence, player.Preroll (), "Preroll");
- Assert.AreEqual (MusicPlayerStatus.NoSequence, player.Start (), "Start");
- Assert.AreEqual (MusicPlayerStatus.NoSequence, player.Stop (), "Stop");
+ Assert.That (player, Is.Not.Null, "Got a player");
+ Assert.That (status, Is.EqualTo (MusicPlayerStatus.Success), "Status");
+ Assert.That (player.Preroll (), Is.EqualTo (MusicPlayerStatus.NoSequence), "Preroll");
+ Assert.That (player.Start (), Is.EqualTo (MusicPlayerStatus.NoSequence), "Start");
+ Assert.That (player.Stop (), Is.EqualTo (MusicPlayerStatus.NoSequence), "Stop");
}
}
}
diff --git a/tests/monotouch-test/AudioToolbox/MusicSequenceTest.cs b/tests/monotouch-test/AudioToolbox/MusicSequenceTest.cs
index 9776a53d2f44..f5e70da480f2 100644
--- a/tests/monotouch-test/AudioToolbox/MusicSequenceTest.cs
+++ b/tests/monotouch-test/AudioToolbox/MusicSequenceTest.cs
@@ -21,7 +21,7 @@ public class MusicSequenceTest {
public void Defaults ()
{
using (var ms = new MusicSequence ()) {
- Assert.NotNull (ms.AUGraph, "AUGraph");
+ Assert.That (ms.AUGraph, Is.Not.Null, "AUGraph");
Assert.That (ms.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle");
Assert.That (ms.SequenceType, Is.EqualTo (MusicSequenceType.Beats), "SequenceType");
Assert.That (ms.TrackCount, Is.EqualTo (0), "TrackCount");
diff --git a/tests/monotouch-test/AudioToolbox/MusicTrackTest.cs b/tests/monotouch-test/AudioToolbox/MusicTrackTest.cs
index b9cae1aa4ea2..3b1229f9c6be 100644
--- a/tests/monotouch-test/AudioToolbox/MusicTrackTest.cs
+++ b/tests/monotouch-test/AudioToolbox/MusicTrackTest.cs
@@ -41,24 +41,24 @@ public void Defaults ()
Assert.That (track.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle");
Assert.That (track.Sequence, Is.Not.Null, "Sequence");
- Assert.IsFalse (track.MuteStatus, "MuteStatus");
+ Assert.That (track.MuteStatus, Is.False, "MuteStatus");
track.MuteStatus = true;
- Assert.IsTrue (track.MuteStatus, "MuteStatus B");
+ Assert.That (track.MuteStatus, Is.True, "MuteStatus B");
track.MuteStatus = false;
- Assert.IsFalse (track.MuteStatus, "MuteStatus C");
+ Assert.That (track.MuteStatus, Is.False, "MuteStatus C");
- Assert.IsFalse (track.SoloStatus, "SoloStatus");
+ Assert.That (track.SoloStatus, Is.False, "SoloStatus");
track.SoloStatus = true;
- Assert.IsTrue (track.SoloStatus, "SoloStatus B");
+ Assert.That (track.SoloStatus, Is.True, "SoloStatus B");
track.SoloStatus = false;
- Assert.IsFalse (track.SoloStatus, "SoloStatus C");
+ Assert.That (track.SoloStatus, Is.False, "SoloStatus C");
- Assert.AreEqual (0.0f, track.TrackLength, "TrackLength");
+ Assert.That (track.TrackLength, Is.EqualTo (0.0f), "TrackLength");
var originalTrackLength = track.TrackLength;
track.TrackLength = 1.32f;
- Assert.AreEqual (1.32f, track.TrackLength, "TrackLength B");
+ Assert.That (track.TrackLength, Is.EqualTo (1.32f), "TrackLength B");
track.TrackLength = originalTrackLength;
- Assert.AreEqual (0.0f, track.TrackLength, "TrackLength C");
+ Assert.That (track.TrackLength, Is.EqualTo (0.0f), "TrackLength C");
}
[Test]
@@ -72,7 +72,7 @@ public void MidiEndPointProperty ()
track.SetDestMidiEndpoint (endpoint);
MidiEndpoint outEnpoint;
var status = track.GetDestMidiEndpoint (out outEnpoint);
- Assert.AreEqual (endpoint.Handle, outEnpoint.Handle, "Track endpoint.");
+ Assert.That (outEnpoint.Handle, Is.EqualTo (endpoint.Handle), "Track endpoint.");
}
}
}
diff --git a/tests/monotouch-test/AudioToolbox/SoundBankTest.cs b/tests/monotouch-test/AudioToolbox/SoundBankTest.cs
index 6f5075059bf6..e9d53b0ca401 100644
--- a/tests/monotouch-test/AudioToolbox/SoundBankTest.cs
+++ b/tests/monotouch-test/AudioToolbox/SoundBankTest.cs
@@ -26,7 +26,7 @@ public void GetName ()
Assert.Throws (delegate { SoundBank.GetName (null); }, "null");
using (NSUrl url = new NSUrl ("http://www.xamarin.com")) {
- Assert.Null (SoundBank.GetName (url), "Not a SoundBank");
+ Assert.That (SoundBank.GetName (url), Is.Null, "Not a SoundBank");
}
}
@@ -52,7 +52,7 @@ public void GetInstrumentInfo ()
Assert.Throws (delegate { SoundBank.GetInstrumentInfo (null); }, "null");
using (NSUrl url = new NSUrl ("http://www.xamarin.com")) {
- Assert.Null (SoundBank.GetInstrumentInfo (url), "Not a SoundBank");
+ Assert.That (SoundBank.GetInstrumentInfo (url), Is.Null, "Not a SoundBank");
}
}
diff --git a/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs b/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs
index 946efd148956..b923dac81b75 100644
--- a/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs
+++ b/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs
@@ -29,13 +29,13 @@ public void FromFile ()
var completed = new TaskCompletionSource ();
const int timeout = 10;
- Assert.AreEqual (AudioServicesError.None, ss.AddSystemSoundCompletion (delegate
+ Assert.That (ss.AddSystemSoundCompletion (delegate
{
completed.SetResult (true);
- }));
+ }), Is.EqualTo (AudioServicesError.None));
ss.PlaySystemSound ();
- Assert.IsTrue (TestRuntime.RunAsync (TimeSpan.FromSeconds (timeout), completed.Task), "PlaySystemSound");
+ Assert.That (TestRuntime.RunAsync (TimeSpan.FromSeconds (timeout), completed.Task), Is.True, "PlaySystemSound");
}
}
@@ -74,7 +74,7 @@ public void TestCallbackPlaySystem ()
const int timeout = 10;
ss.PlaySystemSound (() => { completed.SetResult (true); });
- Assert.IsTrue (TestRuntime.RunAsync (TimeSpan.FromSeconds (timeout), completed.Task), "TestCallbackPlaySystem");
+ Assert.That (TestRuntime.RunAsync (TimeSpan.FromSeconds (timeout), completed.Task), Is.True, "TestCallbackPlaySystem");
}
}
@@ -92,7 +92,7 @@ public void TestCallbackPlayAlert ()
const int timeout = 10;
ss.PlayAlertSound (() => { completed.SetResult (true); });
- Assert.IsTrue (TestRuntime.RunAsync (TimeSpan.FromSeconds (timeout), completed.Task), "TestCallbackPlayAlert");
+ Assert.That (TestRuntime.RunAsync (TimeSpan.FromSeconds (timeout), completed.Task), Is.True, "TestCallbackPlayAlert");
}
}
diff --git a/tests/monotouch-test/AudioUnit/AUAudioUnitFactoryTest.cs b/tests/monotouch-test/AudioUnit/AUAudioUnitFactoryTest.cs
index 1fe4293ae359..ce98f690e99c 100644
--- a/tests/monotouch-test/AudioUnit/AUAudioUnitFactoryTest.cs
+++ b/tests/monotouch-test/AudioUnit/AUAudioUnitFactoryTest.cs
@@ -32,9 +32,8 @@ public void CreateAudioUnit ()
using (var auFactory = new CustomAudioUnitFactory ()) {
NSError error;
using (var audioUnit = auFactory.CreateAudioUnit (desc, out error)) {
- Assert.True (audioUnit is not null, "CustomAudioUnitFactory returned null object for valid component description");
- Assert.True (audioUnit.ManufacturerName == expectedManufacturer,
- $"CustomAudioUnitFactory returned audio unit with incorrect manufacturer. Expected - {expectedManufacturer}, actual - {audioUnit.ManufacturerName}");
+ Assert.That (audioUnit is not null, Is.True, "CustomAudioUnitFactory returned null object for valid component description");
+ Assert.That (audioUnit.ManufacturerName == expectedManufacturer, Is.True, $"CustomAudioUnitFactory returned audio unit with incorrect manufacturer. Expected - {expectedManufacturer}, actual - {audioUnit.ManufacturerName}");
}
}
}
diff --git a/tests/monotouch-test/AudioUnit/AUGraphTest.cs b/tests/monotouch-test/AudioUnit/AUGraphTest.cs
index 73aa779ae8b0..74dfb29bba34 100644
--- a/tests/monotouch-test/AudioUnit/AUGraphTest.cs
+++ b/tests/monotouch-test/AudioUnit/AUGraphTest.cs
@@ -19,24 +19,24 @@ public void BasicOperations ()
{
using (var aug = new AUGraph ()) {
aug.Open ();
- Assert.IsTrue (aug.IsOpen, "#0");
- Assert.IsFalse (aug.IsInitialized, "#0a");
- Assert.IsFalse (aug.IsRunning, "#0b");
+ Assert.That (aug.IsOpen, Is.True, "#0");
+ Assert.That (aug.IsInitialized, Is.False, "#0a");
+ Assert.That (aug.IsRunning, Is.False, "#0b");
var node = aug.AddNode (AudioComponentDescription.CreateOutput (AudioTypeOutput.Generic));
int count;
- Assert.AreEqual (AUGraphError.OK, aug.GetNodeCount (out count), "#1");
- Assert.AreEqual (1, count, "#2");
+ Assert.That (aug.GetNodeCount (out count), Is.EqualTo (AUGraphError.OK), "#1");
+ Assert.That (count, Is.EqualTo (1), "#2");
var info = aug.GetNodeInfo (node);
- Assert.IsNotNull (info, "#3");
+ Assert.That (info, Is.Not.Null, "#3");
int node2;
- Assert.AreEqual (AUGraphError.OK, aug.GetNode (0, out node2), "#4");
- Assert.AreEqual (1, node2, "#4a");
+ Assert.That (aug.GetNode (0, out node2), Is.EqualTo (AUGraphError.OK), "#4");
+ Assert.That (node2, Is.EqualTo (1), "#4a");
float max_load;
- Assert.AreEqual (AUGraphError.OK, aug.GetMaxCPULoad (out max_load));
+ Assert.That (aug.GetMaxCPULoad (out max_load), Is.EqualTo (AUGraphError.OK));
}
}
@@ -49,16 +49,16 @@ public void Connections ()
var node_1 = aug.AddNode (AudioComponentDescription.CreateGenerator (AudioTypeGenerator.AudioFilePlayer));
var node_2 = aug.AddNode (AudioComponentDescription.CreateOutput (AudioTypeOutput.Generic));
- Assert.AreEqual (AUGraphError.OK, aug.ConnnectNodeInput (node_1, 0, node_2, 0), "#1");
+ Assert.That (aug.ConnnectNodeInput (node_1, 0, node_2, 0), Is.EqualTo (AUGraphError.OK), "#1");
uint count;
aug.GetNumberOfInteractions (out count);
- Assert.AreEqual (1, count, "#2");
+ Assert.That (count, Is.EqualTo (1), "#2");
- Assert.AreEqual (AUGraphError.OK, aug.Initialize (), "#3");
+ Assert.That (aug.Initialize (), Is.EqualTo (AUGraphError.OK), "#3");
- Assert.AreEqual (AUGraphError.OK, aug.ClearConnections (), "#4");
+ Assert.That (aug.ClearConnections (), Is.EqualTo (AUGraphError.OK), "#4");
aug.GetNumberOfInteractions (out count);
- Assert.AreEqual (0, count, "#5");
+ Assert.That (count, Is.EqualTo (0), "#5");
}
}
@@ -67,14 +67,14 @@ public void CreateTest ()
{
int errCode;
using (var aug = AUGraph.Create (out errCode)) {
- Assert.NotNull (aug, "CreateTest");
- Assert.AreEqual (0, errCode, "CreateTest");
+ Assert.That (aug, Is.Not.Null, "CreateTest");
+ Assert.That (errCode, Is.EqualTo (0), "CreateTest");
// Make sure it is a working instance
aug.Open ();
- Assert.IsTrue (aug.IsOpen, "CreateTest #0");
- Assert.IsFalse (aug.IsInitialized, "CreateTest #0a");
- Assert.IsFalse (aug.IsRunning, "CreateTest #0b");
+ Assert.That (aug.IsOpen, Is.True, "CreateTest #0");
+ Assert.That (aug.IsInitialized, Is.False, "CreateTest #0a");
+ Assert.That (aug.IsRunning, Is.False, "CreateTest #0b");
}
}
@@ -86,18 +86,18 @@ public void GetNativeTest ()
{
IntPtr ret = IntPtr.Zero;
var errCode = NewAUGraph (ref ret);
- Assert.AreEqual (0, errCode, "GetNativeTest");
+ Assert.That (errCode, Is.EqualTo (0), "GetNativeTest");
Assert.That (ret, Is.Not.EqualTo (IntPtr.Zero), "ret");
using (var aug = Runtime.GetINativeObject (ret, true)) {
- Assert.NotNull (aug, "CreateTest");
+ Assert.That (aug, Is.Not.Null, "CreateTest");
Assert.That ((IntPtr) aug.Handle, Is.EqualTo (ret), "Handle");
// Make sure it is a working instance
aug.Open ();
- Assert.IsTrue (aug.IsOpen, "CreateTest #0");
- Assert.IsFalse (aug.IsInitialized, "CreateTest #0a");
- Assert.IsFalse (aug.IsRunning, "CreateTest #0b");
+ Assert.That (aug.IsOpen, Is.True, "CreateTest #0");
+ Assert.That (aug.IsInitialized, Is.False, "CreateTest #0a");
+ Assert.That (aug.IsRunning, Is.False, "CreateTest #0b");
}
}
}
diff --git a/tests/monotouch-test/AudioUnit/AUGraphTestMac.cs b/tests/monotouch-test/AudioUnit/AUGraphTestMac.cs
index b9e99e62b40d..6a4a1812b1ee 100644
--- a/tests/monotouch-test/AudioUnit/AUGraphTestMac.cs
+++ b/tests/monotouch-test/AudioUnit/AUGraphTestMac.cs
@@ -36,14 +36,14 @@ void SetupAUGraph ()
int outputNode = graph.AddNode (outputDesciption);
AUGraphError error = graph.ConnnectNodeInput (mixerNode, 0, outputNode, 0);
- Assert.AreEqual (AUGraphError.OK, error);
+ Assert.That (error, Is.EqualTo (AUGraphError.OK));
graph.Open ();
mMixer = graph.GetNodeInfo (mixerNode);
AudioUnitStatus status = mMixer.SetElementCount (AudioUnitScopeType.Input, 0);
- Assert.AreEqual (AudioUnitStatus.OK, status);
+ Assert.That (status, Is.EqualTo (AudioUnitStatus.OK));
}
[Test]
@@ -59,7 +59,7 @@ public void DoTest ()
//graph.RenderCallback += HandleRenderCallback;
AudioUnitStatus status = mMixer.SetRenderCallback (MixerRenderCallback);
- Assert.AreEqual (AudioUnitStatus.OK, status);
+ Assert.That (status, Is.EqualTo (AudioUnitStatus.OK));
WaitOnGraphAndMixerCallbacks ();
}
diff --git a/tests/monotouch-test/AudioUnit/AUParameterNodeTest.cs b/tests/monotouch-test/AudioUnit/AUParameterNodeTest.cs
index 6b0ac617062a..6d52be3b1838 100644
--- a/tests/monotouch-test/AudioUnit/AUParameterNodeTest.cs
+++ b/tests/monotouch-test/AudioUnit/AUParameterNodeTest.cs
@@ -31,14 +31,11 @@ public void CreateTokenByAddingParameterRecordingObserver ()
Exception ex = null;
var recordingObserver = tree.CreateTokenByAddingParameterRecordingObserver ((nint numberOfEvents, ref AURecordedParameterEvent events) => {
try {
- Assert.True (numberOfEvents == 1,
- $"Number of events was wrong. Expected {1} but was {numberOfEvents}");
+ Assert.That (numberOfEvents == 1, Is.True, $"Number of events was wrong. Expected {1} but was {numberOfEvents}");
- Assert.True (events.Address == address,
- $"Address was wrong. Expected {address} but was {events.Address}");
+ Assert.That (events.Address == address, Is.True, $"Address was wrong. Expected {address} but was {events.Address}");
- Assert.True (events.Value == newValue,
- $"Value was wrong. Expected {newValue} but was {events.Value}");
+ Assert.That (events.Value == newValue, Is.True, $"Value was wrong. Expected {newValue} but was {events.Value}");
recordingObserverInvoked = true;
} catch (Exception e) {
@@ -48,12 +45,12 @@ public void CreateTokenByAddingParameterRecordingObserver ()
}
});
- Assert.True (recordingObserver.ObserverToken != IntPtr.Zero, "TokenByAddingParameterRecordingObserver return zero pointer for recording observer.");
+ Assert.That (recordingObserver.ObserverToken != IntPtr.Zero, Is.True, "TokenByAddingParameterRecordingObserver return zero pointer for recording observer.");
parameter.Value = newValue;
completion.WaitOne (TimeSpan.FromSeconds (1));
- Assert.IsNull (ex, "Exceptions");
- Assert.True (recordingObserverInvoked, "Recording observer was not invoked when parameter value was changed.");
+ Assert.That (ex, Is.Null, "Exceptions");
+ Assert.That (recordingObserverInvoked, Is.True, "Recording observer was not invoked when parameter value was changed.");
}
}
}
@@ -77,11 +74,11 @@ public void RemoveParameterObserver ()
tree.RemoveParameterObserver (recordingObserver);
- Assert.True (recordingObserver.ObserverToken != IntPtr.Zero, "TokenByAddingParameterRecordingObserver return zero pointer for recording observer.");
+ Assert.That (recordingObserver.ObserverToken != IntPtr.Zero, Is.True, "TokenByAddingParameterRecordingObserver return zero pointer for recording observer.");
parameter.Value = newValue;
completion.WaitOne (TimeSpan.FromSeconds (1));
- Assert.False (recordingObserverInvoked, "Recording observer was invoked however observer it should be removed already.");
+ Assert.That (recordingObserverInvoked, Is.False, "Recording observer was invoked however observer it should be removed already.");
}
}
}
@@ -100,11 +97,9 @@ public void ImplementorStringFromValueCallback ()
using (var parameter = CreateAUParameter ()) {
parameter.ImplementorStringFromValueCallback = new AUImplementorStringFromValueCallback ((AUParameter param, ref float? value) => {
try {
- Assert.True (floatValue == value.Value,
- $"Passed float value was incorrect. Expected {floatValue} but was {value}");
+ Assert.That (floatValue == value.Value, Is.True, $"Passed float value was incorrect. Expected {floatValue} but was {value}");
- Assert.True (param.Identifier == parameter.Identifier,
- $"Passed AUParameter was incorrect. Expected {parameter.Identifier} but was {param.Identifier}");
+ Assert.That (param.Identifier == parameter.Identifier, Is.True, $"Passed AUParameter was incorrect. Expected {parameter.Identifier} but was {param.Identifier}");
} catch (Exception e) {
ex = e;
} finally {
@@ -113,13 +108,12 @@ public void ImplementorStringFromValueCallback ()
return (NSString) value.ToString ();
});
- Assert.IsNull (ex, "Exception");
+ Assert.That (ex, Is.Null, "Exception");
var str = parameter.GetString (floatValue);
- Assert.True (implementorCallbackInvoked, "StringValueFrom callback was not invoked.");
- Assert.True (str == expectedStringValue,
- $"String doesn't match. Expected {expectedStringValue}, actual {str}");
+ Assert.That (implementorCallbackInvoked, Is.True, "StringValueFrom callback was not invoked.");
+ Assert.That (str == expectedStringValue, Is.True, $"String doesn't match. Expected {expectedStringValue}, actual {str}");
}
}
@@ -135,11 +129,9 @@ public void ImplementorValueFromStringCallback ()
using (var parameter = CreateAUParameter ()) {
parameter.ImplementorValueFromStringCallback = new AUImplementorValueFromStringCallback ((param, str) => {
- Assert.True (str == stringValue,
- $"Passed string value was incorrect. Expected {stringValue} but was {str}");
+ Assert.That (str == stringValue, Is.True, $"Passed string value was incorrect. Expected {stringValue} but was {str}");
- Assert.True (param.Identifier == parameter.Identifier,
- $"Passed AUParameter was incorrect. Expected {parameter.Identifier} but was {param.Identifier}");
+ Assert.That (param.Identifier == parameter.Identifier, Is.True, $"Passed AUParameter was incorrect. Expected {parameter.Identifier} but was {param.Identifier}");
implementorCallbackInvoked = true;
return Single.Parse (str);
@@ -147,9 +139,8 @@ public void ImplementorValueFromStringCallback ()
var value = parameter.GetValue (stringValue);
- Assert.True (implementorCallbackInvoked, "ValueFromString callback was not invoked.");
- Assert.False (Math.Abs (value - expectedValue) > float.Epsilon,
- $"Values doesn't match. Expected {expectedValue}, actual {value}");
+ Assert.That (implementorCallbackInvoked, Is.True, "ValueFromString callback was not invoked.");
+ Assert.That (Math.Abs (value - expectedValue) > float.Epsilon, Is.False, $"Values doesn't match. Expected {expectedValue}, actual {value}");
}
}
@@ -170,17 +161,16 @@ public void ImplementorDisplayNameWithLengthCallback ()
using (var parameter = CreateAUParameter ()) {
parameter.ImplementorDisplayNameWithLengthCallback = new AUImplementorDisplayNameWithLengthCallback ((node, desiredLength) => {
- Assert.AreEqual ((nint) length, (nint) desiredLength, "Passed length value is incorrect.");
- Assert.True (node.Identifier == parameter.Identifier,
- $"Passed AUParameterNode was incorrect. Expected {parameter.Identifier} but was {node.Identifier}");
+ Assert.That ((nint) desiredLength, Is.EqualTo ((nint) length), "Passed length value is incorrect.");
+ Assert.That (node.Identifier == parameter.Identifier, Is.True, $"Passed AUParameterNode was incorrect. Expected {parameter.Identifier} but was {node.Identifier}");
implementorCallbackInvoked = true;
return node.DisplayName.Substring (0, (int) desiredLength);
});
var s = parameter.GetDisplayName (length);
- Assert.True (implementorCallbackInvoked, "Display name callback was not invoked.");
- Assert.True (expectedTruncatedName == s, $"Truncated node display name was incorrect. Expected {expectedTruncatedName} but was {s}");
+ Assert.That (implementorCallbackInvoked, Is.True, "Display name callback was not invoked.");
+ Assert.That (expectedTruncatedName == s, Is.True, $"Truncated node display name was incorrect. Expected {expectedTruncatedName} but was {s}");
}
}
diff --git a/tests/monotouch-test/AudioUnit/AVSpeechSynthesisProviderAudioUnitTest.cs b/tests/monotouch-test/AudioUnit/AVSpeechSynthesisProviderAudioUnitTest.cs
index 78116f2749de..dc1f9d8f60f0 100644
--- a/tests/monotouch-test/AudioUnit/AVSpeechSynthesisProviderAudioUnitTest.cs
+++ b/tests/monotouch-test/AudioUnit/AVSpeechSynthesisProviderAudioUnitTest.cs
@@ -19,8 +19,8 @@ public void Create ()
ComponentManufacturer = AudioComponentManufacturerType.Apple,
};
using var unit = AVSpeechSynthesisProviderAudioUnit.Create (cd, (AudioComponentInstantiationOptions) 0, out var error);
- Assert.IsNotNull (unit, "Unit");
- Assert.IsNull (error, "Error");
+ Assert.That (unit, Is.Not.Null, "Unit");
+ Assert.That (error, Is.Null, "Error");
}
}
}
diff --git a/tests/monotouch-test/AudioUnit/AudioUnitTest.cs b/tests/monotouch-test/AudioUnit/AudioUnitTest.cs
index c4fa750ba3aa..9aed16e30a03 100644
--- a/tests/monotouch-test/AudioUnit/AudioUnitTest.cs
+++ b/tests/monotouch-test/AudioUnit/AudioUnitTest.cs
@@ -37,7 +37,7 @@ public void GetElementCount ()
var mixerNode = graph.AddNode (AudioComponentDescription.CreateMixer (AudioTypeMixer.MultiChannel));
graph.Open ();
var mixer = graph.GetNodeInfo (mixerNode);
- Assert.AreEqual (1, mixer.GetElementCount (AudioUnitScopeType.Global));
+ Assert.That (mixer.GetElementCount (AudioUnitScopeType.Global), Is.EqualTo (1));
}
[Test]
@@ -62,9 +62,9 @@ public void CopyIconTest ()
[Test]
public unsafe void TestSizeOf ()
{
- Assert.AreEqual (sizeof (AudioFormat), Marshal.SizeOf ());
- Assert.AreEqual (sizeof (AudioValueRange), Marshal.SizeOf ());
- Assert.AreEqual (sizeof (AudioClassDescription), Marshal.SizeOf ());
+ Assert.That (Marshal.SizeOf (), Is.EqualTo (sizeof (AudioFormat)));
+ Assert.That (Marshal.SizeOf (), Is.EqualTo (sizeof (AudioValueRange)));
+ Assert.That (Marshal.SizeOf (), Is.EqualTo (sizeof (AudioClassDescription)));
}
}
}
diff --git a/tests/monotouch-test/AudioUnit/ExtAudioFileTest.cs b/tests/monotouch-test/AudioUnit/ExtAudioFileTest.cs
index 7c1905ffe41b..1c4f7938b794 100644
--- a/tests/monotouch-test/AudioUnit/ExtAudioFileTest.cs
+++ b/tests/monotouch-test/AudioUnit/ExtAudioFileTest.cs
@@ -19,10 +19,10 @@ public void WrapAudioFileID ()
{
var path = NSBundle.MainBundle.PathForResource ("1", "caf", "AudioToolbox");
using (var file = ExtAudioFile.OpenUrl (CFUrl.FromFile (path))) {
- Assert.IsNotNull (file.AudioFile, "#1");
+ Assert.That (file.AudioFile, Is.Not.Null, "#1");
ExtAudioFile f2;
- Assert.AreEqual (ExtAudioFileError.OK, ExtAudioFile.WrapAudioFileID (file.AudioFile.Value, true, out f2));
+ Assert.That (ExtAudioFile.WrapAudioFileID (file.AudioFile.Value, true, out f2), Is.EqualTo (ExtAudioFileError.OK));
}
}
@@ -41,8 +41,8 @@ public void OpenNSUrlTest ()
var path = NSBundle.MainBundle.PathForResource ("1", "caf", "AudioToolbox");
ExtAudioFileError err;
using (var file = ExtAudioFile.OpenUrl (NSUrl.FromFilename (path), out err)) {
- Assert.IsTrue (err == ExtAudioFileError.OK, "OpenNSUrlTest");
- Assert.IsNotNull (file.AudioFile, "OpenNSUrlTest");
+ Assert.That (err == ExtAudioFileError.OK, Is.True, "OpenNSUrlTest");
+ Assert.That (file.AudioFile, Is.Not.Null, "OpenNSUrlTest");
}
}
@@ -52,8 +52,8 @@ public void OpenCFUrlTest ()
var path = NSBundle.MainBundle.PathForResource ("1", "caf", "AudioToolbox");
ExtAudioFileError err;
using (var file = ExtAudioFile.OpenUrl (CFUrl.FromFile (path), out err)) {
- Assert.IsTrue (err == ExtAudioFileError.OK, "OpenCFUrlTest");
- Assert.IsNotNull (file.AudioFile, "OpenCFUrlTest");
+ Assert.That (err == ExtAudioFileError.OK, Is.True, "OpenCFUrlTest");
+ Assert.That (file.AudioFile, Is.Not.Null, "OpenCFUrlTest");
}
}
}
diff --git a/tests/monotouch-test/AuthenticationServices/PublicPrivateKeyAuthenticationTests.cs b/tests/monotouch-test/AuthenticationServices/PublicPrivateKeyAuthenticationTests.cs
index 9ca83740977b..8f7ec732d96a 100644
--- a/tests/monotouch-test/AuthenticationServices/PublicPrivateKeyAuthenticationTests.cs
+++ b/tests/monotouch-test/AuthenticationServices/PublicPrivateKeyAuthenticationTests.cs
@@ -25,7 +25,7 @@ public void Setup ()
public void GetAllSupportedPublicKeyCredentialDescriptorTransports ()
{
var transports = PublicPrivateKeyAuthentication.GetAllSupportedPublicKeyCredentialDescriptorTransports ();
- Assert.IsNotNull (PublicPrivateKeyAuthentication.GetAllSupportedPublicKeyCredentialDescriptorTransports (), "The transports should not be null");
+ Assert.That (PublicPrivateKeyAuthentication.GetAllSupportedPublicKeyCredentialDescriptorTransports (), Is.Not.Null, "The transports should not be null");
// since there is no default enum value, make sure there is not
// more than one ASAuthorizationSecurityKeyPublicKeyCredentialDescriptorTransport.Usb
@@ -34,7 +34,7 @@ public void GetAllSupportedPublicKeyCredentialDescriptorTransports ()
if (transport == ASAuthorizationSecurityKeyPublicKeyCredentialDescriptorTransport.Usb)
usbCounter++;
}
- Assert.LessOrEqual (usbCounter, 1, "There were multiple usb transports found. Add any new transports to GetAllSupportedPublicKeyCredentialDescriptorTransports inside src/AuthenticationServices/PublicPrivateKeyAuthentication.cs");
+ Assert.That (usbCounter, Is.LessThanOrEqualTo (1), "There were multiple usb transports found. Add any new transports to GetAllSupportedPublicKeyCredentialDescriptorTransports inside src/AuthenticationServices/PublicPrivateKeyAuthentication.cs");
}
}
}
diff --git a/tests/monotouch-test/BackgroundTasks/BGTaskSchedulerTest.cs b/tests/monotouch-test/BackgroundTasks/BGTaskSchedulerTest.cs
index 098448c55665..7d111954adf8 100644
--- a/tests/monotouch-test/BackgroundTasks/BGTaskSchedulerTest.cs
+++ b/tests/monotouch-test/BackgroundTasks/BGTaskSchedulerTest.cs
@@ -44,16 +44,16 @@ public void SubmitTaskRequestTest ()
{
TestRuntime.AssertDevice ();
TestRuntime.AssertXcodeVersion (11, 0);
- Assert.True (registered, "Task was not registered.");
+ Assert.That (registered, Is.True, "Task was not registered.");
// get the shared scheduler, create a request and submit it, this will be called asap
// and the autoreset event set.
var request = new BGProcessingTaskRequest (taskIdentifier);
NSError error;
BGTaskScheduler.Shared.Submit (request, out error);
- Assert.IsNull (error, $"Error submiting request {error}");
+ Assert.That (error, Is.Null, $"Error submiting request {error}");
LaunchBGTask ();
autoResetEvent.WaitOne (300);
- Assert.True (taskWasCalled, "Called task.");
+ Assert.That (taskWasCalled, Is.True, "Called task.");
}
}
}
diff --git a/tests/monotouch-test/CarPlay/CPMessageListItemTests.cs b/tests/monotouch-test/CarPlay/CPMessageListItemTests.cs
index 39b870b86876..b407fb9c1d35 100644
--- a/tests/monotouch-test/CarPlay/CPMessageListItemTests.cs
+++ b/tests/monotouch-test/CarPlay/CPMessageListItemTests.cs
@@ -33,13 +33,13 @@ public void InitUsingConversationIdentifier ()
var trailingItemConfig = new CPMessageListItemTrailingConfiguration (new CPMessageTrailingItem (), null);
CPMessageListItem listItem = new CPMessageListItem ("convoId", "text", leadingItemConfig, trailingItemConfig, "detailText", "trailingText", CPMessageListItemType.Identifier);
- Assert.NotNull (listItem, "CPMessageListItem not be null.");
- Assert.AreEqual (listItem.Text, "text");
- Assert.AreEqual (listItem.ConversationIdentifier, "convoId");
- Assert.AreSame (listItem.LeadingConfiguration, leadingItemConfig);
- Assert.AreSame (listItem.TrailingConfiguration, trailingItemConfig);
- Assert.AreEqual (listItem.DetailText, "detailText");
- Assert.AreEqual (listItem.TrailingText, "trailingText");
+ Assert.That (listItem, Is.Not.Null, "CPMessageListItem not be null.");
+ Assert.That ("text", Is.EqualTo (listItem.Text));
+ Assert.That ("convoId", Is.EqualTo (listItem.ConversationIdentifier));
+ Assert.That (leadingItemConfig, Is.SameAs (listItem.LeadingConfiguration));
+ Assert.That (trailingItemConfig, Is.SameAs (listItem.TrailingConfiguration));
+ Assert.That ("detailText", Is.EqualTo (listItem.DetailText));
+ Assert.That ("trailingText", Is.EqualTo (listItem.TrailingText));
}
[Test]
@@ -49,13 +49,13 @@ public void InitUsingFullName ()
var trailingItemConfig = new CPMessageListItemTrailingConfiguration (new CPMessageTrailingItem (), null);
CPMessageListItem listItem = new CPMessageListItem ("fullName", "phoneOrEmail", leadingItemConfig, trailingItemConfig, "detailText", "trailingText", CPMessageListItemType.FullName);
- Assert.NotNull (listItem, "CPMessageListItem not be null.");
- Assert.AreEqual (listItem.Text, "fullName");
- Assert.AreEqual (listItem.PhoneOrEmailAddress, "phoneOrEmail");
- Assert.AreSame (listItem.LeadingConfiguration, leadingItemConfig);
- Assert.AreSame (listItem.TrailingConfiguration, trailingItemConfig);
- Assert.AreEqual (listItem.DetailText, "detailText");
- Assert.AreEqual (listItem.TrailingText, "trailingText");
+ Assert.That (listItem, Is.Not.Null, "CPMessageListItem not be null.");
+ Assert.That ("fullName", Is.EqualTo (listItem.Text));
+ Assert.That ("phoneOrEmail", Is.EqualTo (listItem.PhoneOrEmailAddress));
+ Assert.That (leadingItemConfig, Is.SameAs (listItem.LeadingConfiguration));
+ Assert.That (trailingItemConfig, Is.SameAs (listItem.TrailingConfiguration));
+ Assert.That ("detailText", Is.EqualTo (listItem.DetailText));
+ Assert.That ("trailingText", Is.EqualTo (listItem.TrailingText));
}
}
diff --git a/tests/monotouch-test/CarPlay/CPNavigationWaypointTest.cs b/tests/monotouch-test/CarPlay/CPNavigationWaypointTest.cs
index 6018b1b55850..b74a81646d01 100644
--- a/tests/monotouch-test/CarPlay/CPNavigationWaypointTest.cs
+++ b/tests/monotouch-test/CarPlay/CPNavigationWaypointTest.cs
@@ -34,19 +34,19 @@ public void CreateWithCenterPointAndEntryPoints ()
var waypoint = CPNavigationWaypoint.Create (centerPoint, null, "Test", "123 Main St", entryPoints, null);
- Assert.IsNotNull (waypoint, "waypoint");
- Assert.AreEqual ("Test", waypoint.Name, "Name");
- Assert.AreEqual ("123 Main St", waypoint.Address, "Address");
- Assert.AreEqual ((nuint) 2, waypoint.EntryPointsCount, "EntryPointsCount");
+ Assert.That (waypoint, Is.Not.Null, "waypoint");
+ Assert.That (waypoint.Name, Is.EqualTo ("Test"), "Name");
+ Assert.That (waypoint.Address, Is.EqualTo ("123 Main St"), "Address");
+ Assert.That (waypoint.EntryPointsCount, Is.EqualTo ((nuint) 2), "EntryPointsCount");
var result = waypoint.EntryPoints;
- Assert.AreEqual (2, result.Length, "EntryPoints.Length");
- Assert.AreEqual (37.7750, result [0].Latitude, 0.0001, "EntryPoints[0].Latitude");
- Assert.AreEqual (-122.4195, result [0].Longitude, 0.0001, "EntryPoints[0].Longitude");
- Assert.AreEqual (5.0, result [0].Altitude, 0.0001, "EntryPoints[0].Altitude");
- Assert.AreEqual (37.7751, result [1].Latitude, 0.0001, "EntryPoints[1].Latitude");
- Assert.AreEqual (-122.4196, result [1].Longitude, 0.0001, "EntryPoints[1].Longitude");
- Assert.AreEqual (15.0, result [1].Altitude, 0.0001, "EntryPoints[1].Altitude");
+ Assert.That (result.Length, Is.EqualTo (2), "EntryPoints.Length");
+ Assert.That (result [0].Latitude, Is.EqualTo (37.7750).Within (0.0001), "EntryPoints[0].Latitude");
+ Assert.That (result [0].Longitude, Is.EqualTo (-122.4195).Within (0.0001), "EntryPoints[0].Longitude");
+ Assert.That (result [0].Altitude, Is.EqualTo (5.0).Within (0.0001), "EntryPoints[0].Altitude");
+ Assert.That (result [1].Latitude, Is.EqualTo (37.7751).Within (0.0001), "EntryPoints[1].Latitude");
+ Assert.That (result [1].Longitude, Is.EqualTo (-122.4196).Within (0.0001), "EntryPoints[1].Longitude");
+ Assert.That (result [1].Altitude, Is.EqualTo (15.0).Within (0.0001), "EntryPoints[1].Altitude");
}
[Test]
@@ -56,12 +56,12 @@ public void CreateWithNullEntryPoints ()
var waypoint = CPNavigationWaypoint.Create (centerPoint, null, "NYC", null, null, null);
- Assert.IsNotNull (waypoint, "waypoint");
- Assert.AreEqual ("NYC", waypoint.Name, "Name");
- Assert.AreEqual ((nuint) 0, waypoint.EntryPointsCount, "EntryPointsCount");
+ Assert.That (waypoint, Is.Not.Null, "waypoint");
+ Assert.That (waypoint.Name, Is.EqualTo ("NYC"), "Name");
+ Assert.That (waypoint.EntryPointsCount, Is.EqualTo ((nuint) 0), "EntryPointsCount");
var result = waypoint.EntryPoints;
- Assert.AreEqual (0, result.Length, "EntryPoints.Length");
+ Assert.That (result.Length, Is.EqualTo (0), "EntryPoints.Length");
}
[Test]
@@ -71,9 +71,9 @@ public void CreateWithEmptyEntryPoints ()
var waypoint = CPNavigationWaypoint.Create (centerPoint, null, "London", null, new CPLocationCoordinate3D [0], null);
- Assert.IsNotNull (waypoint, "waypoint");
- Assert.AreEqual ((nuint) 0, waypoint.EntryPointsCount, "EntryPointsCount");
- Assert.AreEqual (0, waypoint.EntryPoints.Length, "EntryPoints.Length");
+ Assert.That (waypoint, Is.Not.Null, "waypoint");
+ Assert.That (waypoint.EntryPointsCount, Is.EqualTo ((nuint) 0), "EntryPointsCount");
+ Assert.That (waypoint.EntryPoints.Length, Is.EqualTo (0), "EntryPoints.Length");
}
[Test]
@@ -86,12 +86,12 @@ public void CreateWithSingleEntryPoint ()
var waypoint = CPNavigationWaypoint.Create (centerPoint, null, null, null, entryPoints, null);
- Assert.IsNotNull (waypoint, "waypoint");
- Assert.AreEqual ((nuint) 1, waypoint.EntryPointsCount, "EntryPointsCount");
+ Assert.That (waypoint, Is.Not.Null, "waypoint");
+ Assert.That (waypoint.EntryPointsCount, Is.EqualTo ((nuint) 1), "EntryPointsCount");
var result = waypoint.EntryPoints;
- Assert.AreEqual (1, result.Length, "EntryPoints.Length");
- Assert.AreEqual (48.8567, result [0].Latitude, 0.0001, "EntryPoints[0].Latitude");
+ Assert.That (result.Length, Is.EqualTo (1), "EntryPoints.Length");
+ Assert.That (result [0].Latitude, Is.EqualTo (48.8567).Within (0.0001), "EntryPoints[0].Latitude");
}
[Test]
@@ -101,9 +101,9 @@ public void CenterPointRoundTrip ()
var waypoint = CPNavigationWaypoint.Create (centerPoint, null, null, null, null, null);
- Assert.AreEqual (-33.8688, waypoint.CenterPoint.Latitude, 0.0001, "CenterPoint.Latitude");
- Assert.AreEqual (151.2093, waypoint.CenterPoint.Longitude, 0.0001, "CenterPoint.Longitude");
- Assert.AreEqual (58.0, waypoint.CenterPoint.Altitude, 0.0001, "CenterPoint.Altitude");
+ Assert.That (waypoint.CenterPoint.Latitude, Is.EqualTo (-33.8688).Within (0.0001), "CenterPoint.Latitude");
+ Assert.That (waypoint.CenterPoint.Longitude, Is.EqualTo (151.2093).Within (0.0001), "CenterPoint.Longitude");
+ Assert.That (waypoint.CenterPoint.Altitude, Is.EqualTo (58.0).Within (0.0001), "CenterPoint.Altitude");
}
}
@@ -145,20 +145,20 @@ public void CreateWithCoordinates ()
estimates, estimates,
coordinates);
- Assert.IsNotNull (segment, "segment");
- Assert.AreEqual ((nint) 3, segment.CoordinatesCount, "CoordinatesCount");
+ Assert.That (segment, Is.Not.Null, "segment");
+ Assert.That (segment.CoordinatesCount, Is.EqualTo ((nint) 3), "CoordinatesCount");
var result = segment.Coordinates;
- Assert.AreEqual (3, result.Length, "Coordinates.Length");
- Assert.AreEqual (37.0, result [0].Latitude, 0.0001, "Coordinates[0].Latitude");
- Assert.AreEqual (-122.0, result [0].Longitude, 0.0001, "Coordinates[0].Longitude");
- Assert.AreEqual (0.0, result [0].Altitude, 0.0001, "Coordinates[0].Altitude");
- Assert.AreEqual (36.0, result [1].Latitude, 0.0001, "Coordinates[1].Latitude");
- Assert.AreEqual (-121.0, result [1].Longitude, 0.0001, "Coordinates[1].Longitude");
- Assert.AreEqual (100.0, result [1].Altitude, 0.0001, "Coordinates[1].Altitude");
- Assert.AreEqual (35.0, result [2].Latitude, 0.0001, "Coordinates[2].Latitude");
- Assert.AreEqual (-120.0, result [2].Longitude, 0.0001, "Coordinates[2].Longitude");
- Assert.AreEqual (200.0, result [2].Altitude, 0.0001, "Coordinates[2].Altitude");
+ Assert.That (result.Length, Is.EqualTo (3), "Coordinates.Length");
+ Assert.That (result [0].Latitude, Is.EqualTo (37.0).Within (0.0001), "Coordinates[0].Latitude");
+ Assert.That (result [0].Longitude, Is.EqualTo (-122.0).Within (0.0001), "Coordinates[0].Longitude");
+ Assert.That (result [0].Altitude, Is.EqualTo (0.0).Within (0.0001), "Coordinates[0].Altitude");
+ Assert.That (result [1].Latitude, Is.EqualTo (36.0).Within (0.0001), "Coordinates[1].Latitude");
+ Assert.That (result [1].Longitude, Is.EqualTo (-121.0).Within (0.0001), "Coordinates[1].Longitude");
+ Assert.That (result [1].Altitude, Is.EqualTo (100.0).Within (0.0001), "Coordinates[1].Altitude");
+ Assert.That (result [2].Latitude, Is.EqualTo (35.0).Within (0.0001), "Coordinates[2].Latitude");
+ Assert.That (result [2].Longitude, Is.EqualTo (-120.0).Within (0.0001), "Coordinates[2].Longitude");
+ Assert.That (result [2].Altitude, Is.EqualTo (200.0).Within (0.0001), "Coordinates[2].Altitude");
}
[Test]
@@ -187,9 +187,9 @@ public void OriginAndDestination ()
estimates, estimates,
coordinates);
- Assert.IsNotNull (segment.Origin, "Origin");
- Assert.IsNotNull (segment.Destination, "Destination");
- Assert.IsNotNull (segment.Identifier, "Identifier");
+ Assert.That (segment.Origin, Is.Not.Null, "Origin");
+ Assert.That (segment.Destination, Is.Not.Null, "Destination");
+ Assert.That (segment.Identifier, Is.Not.Null, "Identifier");
}
}
}
diff --git a/tests/monotouch-test/CloudKit/CKFetchRecordChangesOperationTest.cs b/tests/monotouch-test/CloudKit/CKFetchRecordChangesOperationTest.cs
index c945247a5b10..0b9bb4bc4cb2 100644
--- a/tests/monotouch-test/CloudKit/CKFetchRecordChangesOperationTest.cs
+++ b/tests/monotouch-test/CloudKit/CKFetchRecordChangesOperationTest.cs
@@ -28,21 +28,21 @@ public void TearDown ()
public void TestRecordChangedSetter ()
{
op.RecordChanged = (record) => { Console.WriteLine ("Changed"); };
- Assert.NotNull (op.RecordChanged);
+ Assert.That (op.RecordChanged, Is.Not.Null);
}
[Test]
public void TestRecordDeletedSetter ()
{
op.RecordDeleted = (record) => { Console.WriteLine ("Deleted"); };
- Assert.NotNull (op.RecordDeleted);
+ Assert.That (op.RecordDeleted, Is.Not.Null);
}
[Test]
public void TestAllChangesReported ()
{
op.AllChangesReported = (s, c, e) => { Console.WriteLine ("Completed"); };
- Assert.NotNull (op.AllChangesReported);
+ Assert.That (op.AllChangesReported, Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/CloudKit/CKFetchRecordZonesOperationTest.cs b/tests/monotouch-test/CloudKit/CKFetchRecordZonesOperationTest.cs
index cdca38a6b5d2..d22410ddcbf1 100644
--- a/tests/monotouch-test/CloudKit/CKFetchRecordZonesOperationTest.cs
+++ b/tests/monotouch-test/CloudKit/CKFetchRecordZonesOperationTest.cs
@@ -27,7 +27,7 @@ public void TearDown ()
public void TestCompletedSetter ()
{
op.Completed = (idDict, e) => { Console.WriteLine ("Completed"); };
- Assert.NotNull (op.Completed);
+ Assert.That (op.Completed, Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/CloudKit/CKFetchRecordsOperationTest.cs b/tests/monotouch-test/CloudKit/CKFetchRecordsOperationTest.cs
index 7b3a86b4c80f..98ef91325ce3 100644
--- a/tests/monotouch-test/CloudKit/CKFetchRecordsOperationTest.cs
+++ b/tests/monotouch-test/CloudKit/CKFetchRecordsOperationTest.cs
@@ -27,21 +27,21 @@ public void TearDown ()
public void PerRecordProgressSetter ()
{
op.PerRecordProgress = (id, p) => { Console.WriteLine ("Notification"); };
- Assert.NotNull (op.PerRecordProgress);
+ Assert.That (op.PerRecordProgress, Is.Not.Null);
}
[Test]
public void PerRecordCompletionSetter ()
{
op.PerRecordCompletion = (record, id, e) => { Console.WriteLine ("Notification"); };
- Assert.NotNull (op.PerRecordCompletion);
+ Assert.That (op.PerRecordCompletion, Is.Not.Null);
}
[Test]
public void TestCompletedSetter ()
{
op.Completed = (idDict, e) => { Console.WriteLine ("Completed"); };
- Assert.NotNull (op.Completed);
+ Assert.That (op.Completed, Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/CloudKit/CKFetchSubscriptionsOperationTest.cs b/tests/monotouch-test/CloudKit/CKFetchSubscriptionsOperationTest.cs
index 14992f42f8d5..e36b5632c5e6 100644
--- a/tests/monotouch-test/CloudKit/CKFetchSubscriptionsOperationTest.cs
+++ b/tests/monotouch-test/CloudKit/CKFetchSubscriptionsOperationTest.cs
@@ -27,7 +27,7 @@ public void TearDown ()
public void TestCompletedSetter ()
{
op.Completed = (dict, e) => { Console.WriteLine ("Completed"); };
- Assert.NotNull (op.Completed);
+ Assert.That (op.Completed, Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/CloudKit/CKModifyRecordZonesOperationTest.cs b/tests/monotouch-test/CloudKit/CKModifyRecordZonesOperationTest.cs
index 4ef7c2457e42..54335a083446 100644
--- a/tests/monotouch-test/CloudKit/CKModifyRecordZonesOperationTest.cs
+++ b/tests/monotouch-test/CloudKit/CKModifyRecordZonesOperationTest.cs
@@ -26,7 +26,7 @@ public void TearDown ()
public void TestCompletedSetter ()
{
op.Completed = (saved, deleted, e) => { Console.WriteLine ("Completed"); };
- Assert.NotNull (op.Completed);
+ Assert.That (op.Completed, Is.Not.Null);
}
[Test]
diff --git a/tests/monotouch-test/CloudKit/CKModifyRecordsOperationTest.cs b/tests/monotouch-test/CloudKit/CKModifyRecordsOperationTest.cs
index 48bed8ccd3fb..e0bbb365dfb0 100644
--- a/tests/monotouch-test/CloudKit/CKModifyRecordsOperationTest.cs
+++ b/tests/monotouch-test/CloudKit/CKModifyRecordsOperationTest.cs
@@ -26,21 +26,21 @@ public void TearDown ()
public void PerRecordProgressSetter ()
{
op.PerRecordProgress = (record, p) => { Console.WriteLine ("Progress"); };
- Assert.NotNull (op.PerRecordProgress);
+ Assert.That (op.PerRecordProgress, Is.Not.Null);
}
[Test]
public void PerRecordCompletionSetter ()
{
op.PerRecordCompletion = (record, e) => { Console.WriteLine ("Notification"); };
- Assert.NotNull (op.PerRecordCompletion);
+ Assert.That (op.PerRecordCompletion, Is.Not.Null);
}
[Test]
public void TestCompletedSetter ()
{
op.Completed = (saved, deleted, e) => { Console.WriteLine ("Completed"); };
- Assert.NotNull (op.Completed);
+ Assert.That (op.Completed, Is.Not.Null);
}
[Test]
diff --git a/tests/monotouch-test/CloudKit/CKModifySubscriptionsOperationTest.cs b/tests/monotouch-test/CloudKit/CKModifySubscriptionsOperationTest.cs
index a27932189e1e..f991403410cd 100644
--- a/tests/monotouch-test/CloudKit/CKModifySubscriptionsOperationTest.cs
+++ b/tests/monotouch-test/CloudKit/CKModifySubscriptionsOperationTest.cs
@@ -26,7 +26,7 @@ public void TearDown ()
public void TestCompletedSetter ()
{
op.Completed = (saved, deleted, e) => { Console.WriteLine ("Completed"); };
- Assert.NotNull (op.Completed);
+ Assert.That (op.Completed, Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/CloudKit/CKQueryOperationTest.cs b/tests/monotouch-test/CloudKit/CKQueryOperationTest.cs
index 7c983936b458..4e8c4219b2f5 100644
--- a/tests/monotouch-test/CloudKit/CKQueryOperationTest.cs
+++ b/tests/monotouch-test/CloudKit/CKQueryOperationTest.cs
@@ -28,14 +28,14 @@ public void TearDown ()
public void TestRecordFetchedSetter ()
{
op.RecordFetched = (record) => { Console.WriteLine ("Completed"); };
- Assert.NotNull (op.RecordFetched);
+ Assert.That (op.RecordFetched, Is.Not.Null);
}
[Test]
public void TestCompletedSetter ()
{
op.Completed = (cursor, e) => { Console.WriteLine ("Completed"); };
- Assert.NotNull (op.Completed);
+ Assert.That (op.Completed, Is.Not.Null);
}
}
}
diff --git a/tests/monotouch-test/CloudKit/CKUserIdentityLookupInfoTest.cs b/tests/monotouch-test/CloudKit/CKUserIdentityLookupInfoTest.cs
index 2c329ecdabb5..482c09f3a363 100644
--- a/tests/monotouch-test/CloudKit/CKUserIdentityLookupInfoTest.cs
+++ b/tests/monotouch-test/CloudKit/CKUserIdentityLookupInfoTest.cs
@@ -15,16 +15,16 @@ public void MinimumSdkCheck ()
public void TestFromEmail ()
{
var info = CKUserIdentityLookupInfo.FromEmail ("example@test.com");
- Assert.NotNull (info);
- Assert.AreNotEqual (info.Handle, IntPtr.Zero);
+ Assert.That (info, Is.Not.Null);
+ Assert.That (IntPtr.Zero, Is.Not.EqualTo (info.Handle));
}
[Test]
public void TestFromPhoneNumber ()
{
var info = CKUserIdentityLookupInfo.FromPhoneNumber ("91899899");
- Assert.NotNull (info);
- Assert.AreNotEqual (info.Handle, IntPtr.Zero);
+ Assert.That (info, Is.Not.Null);
+ Assert.That (IntPtr.Zero, Is.Not.EqualTo (info.Handle));
}
[Test]
@@ -32,8 +32,8 @@ public void TestFromRecordID ()
{
var record = new CKRecordID ("recordName");
var info = new CKUserIdentityLookupInfo (record);
- Assert.NotNull (info);
- Assert.AreNotEqual (info.Handle, IntPtr.Zero);
+ Assert.That (info, Is.Not.Null);
+ Assert.That (IntPtr.Zero, Is.Not.EqualTo (info.Handle));
}
[Test]
@@ -41,7 +41,7 @@ public void TestGetLookupInfosWithEmails ()
{
var emails = new string [] { "example@test.com" };
var result = CKUserIdentityLookupInfo.GetLookupInfosWithEmails (emails);
- Assert.AreEqual (1, result.Length);
+ Assert.That (result.Length, Is.EqualTo (1));
}
[Test]
@@ -49,7 +49,7 @@ public void TestGetLookupInfosWithPhoneNumbers ()
{
var numbers = new string [] { "9111223" };
var result = CKUserIdentityLookupInfo.GetLookupInfosWithPhoneNumbers (numbers);
- Assert.AreEqual (1, result.Length);
+ Assert.That (result.Length, Is.EqualTo (1));
}
[Test]
@@ -58,7 +58,7 @@ public void TestGetLookupInfosWithRecordIds ()
var record = new CKRecordID ("recordName");
var records = new CKRecordID [] { record };
var result = CKUserIdentityLookupInfo.GetLookupInfos (records);
- Assert.AreEqual (1, result.Length);
+ Assert.That (result.Length, Is.EqualTo (1));
}
}
}
diff --git a/tests/monotouch-test/Compression/CompressionStreamTest.cs b/tests/monotouch-test/Compression/CompressionStreamTest.cs
index 8b2dfc94e50e..9ccc4c30d867 100644
--- a/tests/monotouch-test/Compression/CompressionStreamTest.cs
+++ b/tests/monotouch-test/Compression/CompressionStreamTest.cs
@@ -72,8 +72,8 @@ public void CheckCompressDecompress (CompressionAlgorithm algorithm)
DeflateStream decompressing = new DeflateStream (backing, CompressionMode.Decompress, algorithm);
MemoryStream output = new MemoryStream ();
CopyStream (decompressing, output);
- Assert.AreNotEqual (0, output.Length, "Length should be more than 0.");
- Assert.IsTrue (compare_buffers (data, output.GetBuffer (), (int) output.Length), "Buffers are not equal.");
+ Assert.That (output.Length, Is.Not.EqualTo (0), "Length should be more than 0.");
+ Assert.That (compare_buffers (data, output.GetBuffer (), (int) output.Length), Is.True, "Buffers are not equal.");
decompressing.Close ();
output.Close ();
}
@@ -86,7 +86,7 @@ public void CheckDecompress ()
MemoryStream backing = new MemoryStream (compressed_data);
DeflateStream decompressing = new DeflateStream (backing, CompressionMode.Decompress, CompressionAlgorithm.Zlib);
StreamReader reader = new StreamReader (decompressing);
- Assert.AreEqual ("Hello", reader.ReadLine ());
+ Assert.That (reader.ReadLine (), Is.EqualTo ("Hello"));
decompressing.Close ();
}
@@ -172,19 +172,19 @@ public void CheckGetCanSeekProp ()
Assert.Ignore ("Requires iOS 9.0+ or macOS 10.11+");
MemoryStream backing = new MemoryStream (compressed_data);
DeflateStream decompress = new DeflateStream (backing, CompressionMode.Decompress, CompressionAlgorithm.Zlib);
- Assert.IsFalse (decompress.CanSeek, "#A1");
- Assert.IsTrue (backing.CanSeek, "#A2");
+ Assert.That (decompress.CanSeek, Is.False, "#A1");
+ Assert.That (backing.CanSeek, Is.True, "#A2");
decompress.Dispose ();
- Assert.IsFalse (decompress.CanSeek, "#A3");
- Assert.IsFalse (backing.CanSeek, "#A4");
+ Assert.That (decompress.CanSeek, Is.False, "#A3");
+ Assert.That (backing.CanSeek, Is.False, "#A4");
backing = new MemoryStream ();
DeflateStream compress = new DeflateStream (backing, CompressionMode.Compress, CompressionAlgorithm.Zlib);
- Assert.IsFalse (compress.CanSeek, "#B1");
- Assert.IsTrue (backing.CanSeek, "#B2");
+ Assert.That (compress.CanSeek, Is.False, "#B1");
+ Assert.That (backing.CanSeek, Is.True, "#B2");
compress.Dispose ();
- Assert.IsFalse (decompress.CanSeek, "#B3");
- Assert.IsFalse (backing.CanSeek, "#B4");
+ Assert.That (decompress.CanSeek, Is.False, "#B3");
+ Assert.That (backing.CanSeek, Is.False, "#B4");
}
[Test]
@@ -194,19 +194,19 @@ public void CheckGetCanReadProp ()
Assert.Ignore ("Requires iOS 9.0+ or macOS 10.11+");
MemoryStream backing = new MemoryStream (compressed_data);
DeflateStream decompress = new DeflateStream (backing, CompressionMode.Decompress, CompressionAlgorithm.Zlib);
- Assert.IsTrue (decompress.CanRead, "#A1");
- Assert.IsTrue (backing.CanRead, "#A2");
+ Assert.That (decompress.CanRead, Is.True, "#A1");
+ Assert.That (backing.CanRead, Is.True, "#A2");
decompress.Dispose ();
- Assert.IsFalse (decompress.CanRead, "#A3");
- Assert.IsFalse (backing.CanRead, "#A4");
+ Assert.That (decompress.CanRead, Is.False, "#A3");
+ Assert.That (backing.CanRead, Is.False, "#A4");
backing = new MemoryStream ();
DeflateStream compress = new DeflateStream (backing, CompressionMode.Compress, CompressionAlgorithm.Zlib);
- Assert.IsFalse (compress.CanRead, "#B1");
- Assert.IsTrue (backing.CanRead, "#B2");
+ Assert.That (compress.CanRead, Is.False, "#B1");
+ Assert.That (backing.CanRead, Is.True, "#B2");
compress.Dispose ();
- Assert.IsFalse (decompress.CanRead, "#B3");
- Assert.IsFalse (backing.CanRead, "#B4");
+ Assert.That (decompress.CanRead, Is.False, "#B3");
+ Assert.That (backing.CanRead, Is.False, "#B4");
}
[Test]
@@ -216,19 +216,19 @@ public void CheckGetCanWriteProp ()
Assert.Ignore ("Requires iOS 9.0+ or macOS 10.11+");
MemoryStream backing = new MemoryStream ();
DeflateStream decompress = new DeflateStream (backing, CompressionMode.Decompress, CompressionAlgorithm.Zlib);
- Assert.IsFalse (decompress.CanWrite, "#A1");
- Assert.IsTrue (backing.CanWrite, "#A2");
+ Assert.That (decompress.CanWrite, Is.False, "#A1");
+ Assert.That (backing.CanWrite, Is.True, "#A2");
decompress.Dispose ();
- Assert.IsFalse (decompress.CanWrite, "#A3");
- Assert.IsFalse (backing.CanWrite, "#A4");
+ Assert.That (decompress.CanWrite, Is.False, "#A3");
+ Assert.That (backing.CanWrite, Is.False, "#A4");
backing = new MemoryStream ();
DeflateStream compress = new DeflateStream (backing, CompressionMode.Compress, CompressionAlgorithm.Zlib);
- Assert.IsTrue (compress.CanWrite, "#B1");
- Assert.IsTrue (backing.CanWrite, "#B2");
+ Assert.That (compress.CanWrite, Is.True, "#B1");
+ Assert.That (backing.CanWrite, Is.True, "#B2");
compress.Dispose ();
- Assert.IsFalse (decompress.CanWrite, "#B3");
- Assert.IsFalse (backing.CanWrite, "#B4");
+ Assert.That (decompress.CanWrite, Is.False, "#B3");
+ Assert.That (backing.CanWrite, Is.False, "#B4");
}
[Test]
@@ -317,7 +317,7 @@ public override int Read (byte [] buffer, int offset, int count)
// blocks the thread waiting for at least a byte to return.
// This assert guarantees that Read is called only when there
// is something to be read.
- Assert.IsTrue (Position < Length, "Trying to read empty stream.");
+ Assert.That (Position < Length, Is.True, "Trying to read empty stream.");
return base.Read (buffer, offset, count);
}
diff --git a/tests/monotouch-test/Compression/ThoroughCompressionStreamTest.cs b/tests/monotouch-test/Compression/ThoroughCompressionStreamTest.cs
index 5895ebf0ccf9..0cb832e725d7 100644
--- a/tests/monotouch-test/Compression/ThoroughCompressionStreamTest.cs
+++ b/tests/monotouch-test/Compression/ThoroughCompressionStreamTest.cs
@@ -63,8 +63,8 @@ void DecodeRealFile (CompressionAlgorithm algorithm, string compressedFile, stri
output.Seek (0, SeekOrigin.Begin);
StreamReader reader = new StreamReader (output);
output.Seek (0, SeekOrigin.Begin);
- Assert.AreNotEqual (0, output.Length, "Stream length should not be 0,");
- Assert.IsTrue (compare_buffers (File.ReadAllBytes (uncompressedFile), output.GetBuffer (), (int) output.Length), "Streams are not equal.");
+ Assert.That (output.Length, Is.Not.EqualTo (0), "Stream length should not be 0,");
+ Assert.That (compare_buffers (File.ReadAllBytes (uncompressedFile), output.GetBuffer (), (int) output.Length), Is.True, "Streams are not equal.");
decompressing.Close ();
output.Close ();
}
diff --git a/tests/monotouch-test/Contacts/ContactFormatterTest.cs b/tests/monotouch-test/Contacts/ContactFormatterTest.cs
index 35fa3eefa5bd..88a7e245949a 100644
--- a/tests/monotouch-test/Contacts/ContactFormatterTest.cs
+++ b/tests/monotouch-test/Contacts/ContactFormatterTest.cs
@@ -30,8 +30,8 @@ public void GetDescriptorForRequiredKeys_FullName ()
// while most input for ICNKeyDescriptor are done with NSString
// the output is opaque and an internal type
// note: this is not very robust - but I want to know if this changes during the next betas
- Assert.True (keys.Description.StartsWith (" [] {
new CNLabeledValue ("label", new CNContactRelation ("relation"))
};
- Assert.AreEqual (1, contact.ContactRelations.Length, "ContactRelations");
+ Assert.That (contact.ContactRelations.Length, Is.EqualTo (1), "ContactRelations");
contact.ContactType = CNContactType.Organization;
- Assert.AreEqual (CNContactType.Organization, contact.ContactType, "ContactType");
+ Assert.That (contact.ContactType, Is.EqualTo (CNContactType.Organization), "ContactType");
contact.Dates = new CNLabeledValue [] {
new CNLabeledValue ("label", new NSDateComponents () {
Month = 6
})
};
- Assert.AreEqual (1, contact.Dates.Length, "Dates");
+ Assert.That (contact.Dates.Length, Is.EqualTo (1), "Dates");
contact.DepartmentName = "department";
- Assert.AreEqual ("department", contact.DepartmentName, "DepartmentName");
+ Assert.That (contact.DepartmentName, Is.EqualTo ("department"), "DepartmentName");
contact.EmailAddresses = new CNLabeledValue [] {
new CNLabeledValue ("label", (NSString) "foo@bar.com")
};
- Assert.AreEqual (1, contact.EmailAddresses.Length, "EmailAddresses");
+ Assert.That (contact.EmailAddresses.Length, Is.EqualTo (1), "EmailAddresses");
contact.FamilyName = "familyName";
- Assert.AreEqual ("familyName", contact.FamilyName, "FamilyName");
+ Assert.That (contact.FamilyName, Is.EqualTo ("familyName"), "FamilyName");
contact.GivenName = "givenName";
- Assert.AreEqual ("givenName", contact.GivenName, "GivenName");
+ Assert.That (contact.GivenName, Is.EqualTo ("givenName"), "GivenName");
- Assert.AreNotEqual (string.Empty, contact.Identifier, "Identifier");
+ Assert.That (contact.Identifier, Is.Not.EqualTo (string.Empty), "Identifier");
contact.ImageData = new NSData ();
- Assert.IsNotNull (contact.ImageData, "ImageData-2");
+ Assert.That (contact.ImageData, Is.Not.Null, "ImageData-2");
// iOS 10 (beta 1) fixed this bug (if not null then it's available)
var avail = TestRuntime.CheckXcodeVersion (8, 0);
Assert.That (contact.ImageDataAvailable, Is.EqualTo (avail), "ImageDataAvailable-2");
@@ -102,47 +102,47 @@ public void Properties ()
contact.InstantMessageAddresses = new CNLabeledValue [] {
new CNLabeledValue ("label", new CNInstantMessageAddress ("user", "service")),
};
- Assert.AreEqual (1, contact.InstantMessageAddresses.Length, "InstantMessageAddresses");
+ Assert.That (contact.InstantMessageAddresses.Length, Is.EqualTo (1), "InstantMessageAddresses");
contact.JobTitle = "title";
- Assert.AreEqual ("title", contact.JobTitle, "JobTitle");
+ Assert.That (contact.JobTitle, Is.EqualTo ("title"), "JobTitle");
contact.MiddleName = "middleName";
- Assert.AreEqual ("middleName", contact.MiddleName, "MiddleName");
+ Assert.That (contact.MiddleName, Is.EqualTo ("middleName"), "MiddleName");
contact.NamePrefix = "namePrefix";
- Assert.AreEqual ("namePrefix", contact.NamePrefix, "NamePrefix");
+ Assert.That (contact.NamePrefix, Is.EqualTo ("namePrefix"), "NamePrefix");
contact.NameSuffix = "nameSuffix";
- Assert.AreEqual ("nameSuffix", contact.NameSuffix, "NameSuffix");
+ Assert.That (contact.NameSuffix, Is.EqualTo ("nameSuffix"), "NameSuffix");
contact.Nickname = "nickname";
- Assert.AreEqual ("nickname", contact.Nickname, "Nickname");
+ Assert.That (contact.Nickname, Is.EqualTo ("nickname"), "Nickname");
contact.NonGregorianBirthday = new NSDateComponents () {
Year = 2099,
};
- Assert.AreEqual ((nint) 2099, contact.NonGregorianBirthday.Year, "NonGregorianBirthday");
+ Assert.That (contact.NonGregorianBirthday.Year, Is.EqualTo ((nint) 2099), "NonGregorianBirthday");
contact.Note = "note";
- Assert.AreEqual ("note", contact.Note, "Note");
+ Assert.That (contact.Note, Is.EqualTo ("note"), "Note");
contact.OrganizationName = "organizationName";
- Assert.AreEqual ("organizationName", contact.OrganizationName, "OrganizationName");
+ Assert.That (contact.OrganizationName, Is.EqualTo ("organizationName"), "OrganizationName");
contact.PhoneNumbers = new CNLabeledValue [] {
new CNLabeledValue ("label", new CNPhoneNumber ("123-345-456"))
};
- Assert.AreEqual (1, contact.PhoneNumbers.Length, "PhoneNumbers");
+ Assert.That (contact.PhoneNumbers.Length, Is.EqualTo (1), "PhoneNumbers");
contact.PhoneticFamilyName = "phoneticFamilyName";
- Assert.AreEqual ("phoneticFamilyName", contact.PhoneticFamilyName, "PhoneticFamilyName");
+ Assert.That (contact.PhoneticFamilyName, Is.EqualTo ("phoneticFamilyName"), "PhoneticFamilyName");
contact.PhoneticGivenName = "phoneticGivenName";
- Assert.AreEqual ("phoneticGivenName", contact.PhoneticGivenName, "PhoneticGivenName");
+ Assert.That (contact.PhoneticGivenName, Is.EqualTo ("phoneticGivenName"), "PhoneticGivenName");
contact.PhoneticMiddleName = "phoneticMiddleName";
- Assert.AreEqual ("phoneticMiddleName", contact.PhoneticMiddleName, "PhoneticMiddleName");
+ Assert.That (contact.PhoneticMiddleName, Is.EqualTo ("phoneticMiddleName"), "PhoneticMiddleName");
contact.PostalAddresses = new CNLabeledValue [] {
new CNLabeledValue ("label", new CNMutablePostalAddress ()
@@ -150,20 +150,20 @@ public void Properties ()
Street = "my Street",
})
};
- Assert.AreEqual (1, contact.PostalAddresses.Length, "PostalAddresses");
+ Assert.That (contact.PostalAddresses.Length, Is.EqualTo (1), "PostalAddresses");
contact.PreviousFamilyName = "previousFamilyName";
- Assert.AreEqual ("previousFamilyName", contact.PreviousFamilyName, "PreviousFamilyName");
+ Assert.That (contact.PreviousFamilyName, Is.EqualTo ("previousFamilyName"), "PreviousFamilyName");
contact.SocialProfiles = new CNLabeledValue [] {
new CNLabeledValue ("label", new CNSocialProfile ("url", "username", "useridentifier", "service"))
};
- Assert.AreEqual (1, contact.SocialProfiles.Length, "SocialProfiles");
+ Assert.That (contact.SocialProfiles.Length, Is.EqualTo (1), "SocialProfiles");
contact.UrlAddresses = new CNLabeledValue [] {
new CNLabeledValue ("label", (NSString) "url@address.com")
};
- Assert.AreEqual (1, contact.UrlAddresses.Length, "UrlAddresses");
+ Assert.That (contact.UrlAddresses.Length, Is.EqualTo (1), "UrlAddresses");
}
}
}
diff --git a/tests/monotouch-test/CoreAnimation/CABasicAnimation.cs b/tests/monotouch-test/CoreAnimation/CABasicAnimation.cs
index 81c8a6275293..b5ea95974675 100644
--- a/tests/monotouch-test/CoreAnimation/CABasicAnimation.cs
+++ b/tests/monotouch-test/CoreAnimation/CABasicAnimation.cs
@@ -15,20 +15,20 @@ public void CABasicAnimation_FromToBy_INativeTests ()
CABasicAnimation test = CABasicAnimation.FromKeyPath ("bounds");
NSNumber number = new NSNumber (10);
test.From = number;
- Assert.AreEqual (test.From, number, "NSObject from");
+ Assert.That (number, Is.EqualTo (test.From), "NSObject from");
test.To = number;
- Assert.AreEqual (test.To, number, "NSObject to");
+ Assert.That (number, Is.EqualTo (test.To), "NSObject to");
test.By = number;
- Assert.AreEqual (test.By, number, "NSObject by");
+ Assert.That (number, Is.EqualTo (test.By), "NSObject by");
CGColor color = new CGColor (.5f, .5f, .5f);
test = CABasicAnimation.FromKeyPath ("color");
test.SetFrom (color);
- Assert.AreEqual (test.GetFromAs (), color, "INativeObject from");
+ Assert.That (color, Is.EqualTo (test.GetFromAs ()), "INativeObject from");
test.SetTo (color);
- Assert.AreEqual (test.GetToAs (), color, "INativeObject to");
+ Assert.That (color, Is.EqualTo (test.GetToAs ()), "INativeObject to");
test.SetBy (color);
- Assert.AreEqual (test.GetByAs (), color, "INativeObject by");
+ Assert.That (color, Is.EqualTo (test.GetByAs ()), "INativeObject by");
}
}
}
diff --git a/tests/monotouch-test/CoreAnimation/CAFrameRateRangeTest.cs b/tests/monotouch-test/CoreAnimation/CAFrameRateRangeTest.cs
index 9ab666d1270e..f601a332f4f1 100644
--- a/tests/monotouch-test/CoreAnimation/CAFrameRateRangeTest.cs
+++ b/tests/monotouch-test/CoreAnimation/CAFrameRateRangeTest.cs
@@ -14,10 +14,10 @@ public void SetUp ()
[Test]
public void IsEqualToTest ()
- => Assert.True (CAFrameRateRange.Default.IsEqualTo (CAFrameRateRange.Default));
+ => Assert.That (CAFrameRateRange.Default.IsEqualTo (CAFrameRateRange.Default), Is.True);
[Test]
public void DefaultTest ()
- => Assert.IsNotNull (CAFrameRateRange.Default, "Default");
+ => Assert.That (CAFrameRateRange.Default, Is.Not.Null, "Default");
}
}
diff --git a/tests/monotouch-test/CoreAnimation/CAGradientLayerTest.cs b/tests/monotouch-test/CoreAnimation/CAGradientLayerTest.cs
index 41b3056a928a..d25e8df70504 100644
--- a/tests/monotouch-test/CoreAnimation/CAGradientLayerTest.cs
+++ b/tests/monotouch-test/CoreAnimation/CAGradientLayerTest.cs
@@ -18,18 +18,18 @@ public class CAGradientLayerTest {
public void Colors_GetSet ()
{
using var layer = new CAGradientLayer ();
- Assert.IsNull (layer.Colors, "Colors/default");
+ Assert.That (layer.Colors, Is.Null, "Colors/default");
var red = new CGColor (1, 0, 0);
var green = new CGColor (0, 1, 0);
var blue = new CGColor (0, 0, 1);
layer.Colors = new CGColor [] { red, green, blue };
var colors = layer.Colors;
- Assert.IsNotNull (colors, "Colors/assigned");
- Assert.AreEqual (3, colors!.Length, "Colors/length");
+ Assert.That (colors, Is.Not.Null, "Colors/assigned");
+ Assert.That (colors!.Length, Is.EqualTo (3), "Colors/length");
layer.Colors = null;
- Assert.IsNull (layer.Colors, "Colors/null");
+ Assert.That (layer.Colors, Is.Null, "Colors/null");
}
}
}
diff --git a/tests/monotouch-test/CoreAnimation/CAKeyFrameAnimation.cs b/tests/monotouch-test/CoreAnimation/CAKeyFrameAnimation.cs
index 4145c0afb31c..c145318d35b5 100644
--- a/tests/monotouch-test/CoreAnimation/CAKeyFrameAnimation.cs
+++ b/tests/monotouch-test/CoreAnimation/CAKeyFrameAnimation.cs
@@ -14,9 +14,9 @@ public void CAKeyFrameAnimation_ValuesTests ()
{
CAKeyFrameAnimation keyFrameAni = new CAKeyFrameAnimation ();
keyFrameAni.Values = new NSObject [] { new NSNumber (5) };
- Assert.AreEqual (1, keyFrameAni.Values.Length);
+ Assert.That (keyFrameAni.Values.Length, Is.EqualTo (1));
NSNumber arrayNumber = (NSNumber) keyFrameAni.Values [0];
- Assert.AreEqual (5, arrayNumber.Int32Value);
+ Assert.That (arrayNumber.Int32Value, Is.EqualTo (5));
CGRect frame = new CGRect (10, 10, 10, 10);
@@ -26,9 +26,9 @@ public void CAKeyFrameAnimation_ValuesTests ()
CGBitmapFlags.ByteOrderDefault | CGBitmapFlags.Last, provider, null, false, CGColorRenderingIntent.Default);
keyFrameAni.SetValues (new CGImage [] { image, image });
- Assert.AreEqual (2, keyFrameAni.Values.Length);
+ Assert.That (keyFrameAni.Values.Length, Is.EqualTo (2));
CGImage arrayImage = (CGImage) keyFrameAni.GetValuesAs () [1];
- Assert.AreEqual (image.Handle, arrayImage.Handle);
+ Assert.That (arrayImage.Handle, Is.EqualTo (image.Handle));
}
}
}
diff --git a/tests/monotouch-test/CoreAnimation/CALayer.cs b/tests/monotouch-test/CoreAnimation/CALayer.cs
index 4cda76ebab25..fe4b90f3fc7a 100644
--- a/tests/monotouch-test/CoreAnimation/CALayer.cs
+++ b/tests/monotouch-test/CoreAnimation/CALayer.cs
@@ -23,11 +23,11 @@ public void CALayer_ValuesTests ()
layer.Contents = image;
CGImage arrayImage = layer.Contents;
- Assert.AreEqual (image.Handle, arrayImage.Handle);
+ Assert.That (arrayImage.Handle, Is.EqualTo (image.Handle));
layer.SetContents (NSImage);
NSImage arrayNSImage = layer.GetContentsAs ();
- Assert.AreEqual (NSImage.Handle, arrayNSImage.Handle);
+ Assert.That (arrayNSImage.Handle, Is.EqualTo (NSImage.Handle));
layer.SetContents (null); // Should not throw
layer.Contents = null; // Should not throw
diff --git a/tests/monotouch-test/CoreAnimation/CATextLayerTests.cs b/tests/monotouch-test/CoreAnimation/CATextLayerTests.cs
index 6976c48cc09f..8e9d7de067fc 100644
--- a/tests/monotouch-test/CoreAnimation/CATextLayerTests.cs
+++ b/tests/monotouch-test/CoreAnimation/CATextLayerTests.cs
@@ -23,10 +23,10 @@ public void CATextLayerTruncationModeTest ()
TextTruncationMode = CATextLayerTruncationMode.Middle
};
- Assert.AreEqual (CATextLayerTruncationMode.Middle, textLayer.TextTruncationMode, "TextTruncationMode");
+ Assert.That (textLayer.TextTruncationMode, Is.EqualTo (CATextLayerTruncationMode.Middle), "TextTruncationMode");
textLayer.TextTruncationMode = CATextLayerTruncationMode.End;
- Assert.AreEqual (CATextLayerTruncationMode.End, textLayer.TextTruncationMode, "TextTruncationMode 2");
+ Assert.That (textLayer.TextTruncationMode, Is.EqualTo (CATextLayerTruncationMode.End), "TextTruncationMode 2");
}
[Test]
@@ -37,10 +37,10 @@ public void CATextLayerAlignmentModeTest ()
TextAlignmentMode = CATextLayerAlignmentMode.Justified
};
- Assert.AreEqual (CATextLayerAlignmentMode.Justified, textLayer.TextAlignmentMode, "TextAlignmentMode");
+ Assert.That (textLayer.TextAlignmentMode, Is.EqualTo (CATextLayerAlignmentMode.Justified), "TextAlignmentMode");
textLayer.TextAlignmentMode = CATextLayerAlignmentMode.Natural;
- Assert.AreEqual (CATextLayerAlignmentMode.Natural, textLayer.TextAlignmentMode, "TextAlignmentMode 2");
+ Assert.That (textLayer.TextAlignmentMode, Is.EqualTo (CATextLayerAlignmentMode.Natural), "TextAlignmentMode 2");
}
}
}
diff --git a/tests/monotouch-test/CoreAnimation/EmitterCellTest.cs b/tests/monotouch-test/CoreAnimation/EmitterCellTest.cs
index 9583ac6598d2..c16edbd5085c 100644
--- a/tests/monotouch-test/CoreAnimation/EmitterCellTest.cs
+++ b/tests/monotouch-test/CoreAnimation/EmitterCellTest.cs
@@ -21,12 +21,12 @@ public void XEmitterCellTest ()
using (var ec = new CAEmitterCell ()) {
// ICAMediaTiming
Assert.That (ec.BeginTime, Is.EqualTo (0.0d), "BeginTime");
- Assert.True (Double.IsInfinity (ec.Duration), "Duration");
+ Assert.That (Double.IsInfinity (ec.Duration), Is.True, "Duration");
Assert.That (ec.Speed, Is.EqualTo (1.0f), "Speed");
Assert.That (ec.TimeOffset, Is.EqualTo (0.0d), "TimeOffset");
Assert.That (ec.RepeatCount, Is.EqualTo (0.0f), "RepeatCount");
Assert.That (ec.RepeatDuration, Is.EqualTo (0.0d), "RepeatDuration");
- Assert.False (ec.AutoReverses, "AutoReverses");
+ Assert.That (ec.AutoReverses, Is.False, "AutoReverses");
Assert.That (ec.FillMode, Is.EqualTo ("removed"), "FillMode");
}
}
diff --git a/tests/monotouch-test/CoreAnimation/LayerTest.cs b/tests/monotouch-test/CoreAnimation/LayerTest.cs
index ed7f174462d7..5cf0be59a801 100644
--- a/tests/monotouch-test/CoreAnimation/LayerTest.cs
+++ b/tests/monotouch-test/CoreAnimation/LayerTest.cs
@@ -23,11 +23,11 @@ public class LayerTest {
public void Mask ()
{
using (CALayer layer = new CALayer ()) {
- Assert.Null (layer.Mask, "Mask/default");
+ Assert.That (layer.Mask, Is.Null, "Mask/default");
layer.Mask = new CALayer ();
- Assert.NotNull (layer.Mask, "Mask/assigned");
+ Assert.That (layer.Mask, Is.Not.Null, "Mask/assigned");
layer.Mask = null;
- Assert.Null (layer.Mask, "Mask/nullable");
+ Assert.That (layer.Mask, Is.Null, "Mask/nullable");
}
}
@@ -36,9 +36,9 @@ public void CAActionTest ()
{
// bug 2441
CAActionTestClass obj = new CAActionTestClass ();
- Assert.IsNull (obj.ActionForKey ("animation"), "a");
- Assert.IsNull (obj.Actions, "b");
- Assert.IsNull (CAActionTestClass.DefaultActionForKey ("animation"), "c");
+ Assert.That (obj.ActionForKey ("animation"), Is.Null, "a");
+ Assert.That (obj.Actions, Is.Null, "b");
+ Assert.That (CAActionTestClass.DefaultActionForKey ("animation"), Is.Null, "c");
var animationKey = new NSString ("animation");
var basicAnimationKey = new NSString ("basicAnimation");
@@ -51,8 +51,8 @@ public void CAActionTest ()
Assert.That (obj.ActionForKey ("animation") == dict [animationKey], "e");
Assert.That (obj.ActionForKey ("basicAnimation") == dict [basicAnimationKey], "f");
- Assert.IsNull (CAActionTestClass.DefaultActionForKey ("animation"), "g");
- Assert.IsNull (CALayer.DefaultActionForKey ("animation"), "h");
+ Assert.That (CAActionTestClass.DefaultActionForKey ("animation"), Is.Null, "g");
+ Assert.That (CALayer.DefaultActionForKey ("animation"), Is.Null, "h");
}
class CAActionTestClass : CALayer {
@@ -63,8 +63,8 @@ class CAActionTestClass : CALayer {
public void ConvertPoint ()
{
using (CALayer layer = new CALayer ()) {
- Assert.True (layer.ConvertPointFromLayer (CGPoint.Empty, null).IsEmpty, "From/Empty/null");
- Assert.True (layer.ConvertPointToLayer (CGPoint.Empty, null).IsEmpty, "To/Empty/null");
+ Assert.That (layer.ConvertPointFromLayer (CGPoint.Empty, null).IsEmpty, Is.True, "From/Empty/null");
+ Assert.That (layer.ConvertPointToLayer (CGPoint.Empty, null).IsEmpty, Is.True, "To/Empty/null");
}
}
@@ -72,8 +72,8 @@ public void ConvertPoint ()
public void ConvertRect ()
{
using (CALayer layer = new CALayer ()) {
- Assert.True (layer.ConvertRectFromLayer (CGRect.Empty, null).IsEmpty, "From/Empty/null");
- Assert.True (layer.ConvertRectToLayer (CGRect.Empty, null).IsEmpty, "To/Empty/null");
+ Assert.That (layer.ConvertRectFromLayer (CGRect.Empty, null).IsEmpty, Is.True, "From/Empty/null");
+ Assert.That (layer.ConvertRectToLayer (CGRect.Empty, null).IsEmpty, Is.True, "To/Empty/null");
}
}
@@ -91,9 +91,9 @@ public void AddAnimation ()
{
using (var layer = new CALayer ()) {
var animation = new CABasicAnimation ();
- Assert.IsNull (layer.AnimationForKey ("key"), "#key A");
+ Assert.That (layer.AnimationForKey ("key"), Is.Null, "#key A");
layer.AddAnimation (animation, "key");
- Assert.IsNotNull (layer.AnimationForKey ("key"), "#key B");
+ Assert.That (layer.AnimationForKey ("key"), Is.Not.Null, "#key B");
}
}
@@ -122,7 +122,7 @@ public void TestBug26532 ()
GC.Collect ();
foreach (var slayer in layer.Sublayers.OfType ()) {
- Assert.AreEqual ("42", slayer.Secret);
+ Assert.That (slayer.Secret, Is.EqualTo ("42"));
}
foreach (var slayer in layer.Sublayers.OfType ())
@@ -142,7 +142,7 @@ public void TestBug26532 ()
NSRunLoop.Main.RunUntil (NSDate.Now.AddSeconds (0.05));
}
- Assert.IsNull (ex, "Exceptions");
+ Assert.That (ex, Is.Null, "Exceptions");
Assert.That (TextLayersDisposed, Is.AtLeast (layerCount / 2), "disposed text layers");
}
diff --git a/tests/monotouch-test/CoreAnimation/ShapeLayerTest.cs b/tests/monotouch-test/CoreAnimation/ShapeLayerTest.cs
index c68894fd83db..0139d979d133 100644
--- a/tests/monotouch-test/CoreAnimation/ShapeLayerTest.cs
+++ b/tests/monotouch-test/CoreAnimation/ShapeLayerTest.cs
@@ -25,23 +25,23 @@ public class ShapeLayerTest {
public void NullableProperties ()
{
var sl = new CAShapeLayer ();
- Assert.NotNull (sl.FillColor, "FillColor");
+ Assert.That (sl.FillColor, Is.Not.Null, "FillColor");
sl.FillColor = null;
- Assert.Null (sl.Path, "Path");
+ Assert.That (sl.Path, Is.Null, "Path");
sl.Path = null;
- Assert.Null (sl.LineDashPattern, "LineDashPattern");
+ Assert.That (sl.LineDashPattern, Is.Null, "LineDashPattern");
sl.LineDashPattern = null;
- Assert.Null (sl.StrokeColor, "StrokeColor");
+ Assert.That (sl.StrokeColor, Is.Null, "StrokeColor");
sl.StrokeColor = null;
sl.FillColor = TestRuntime.GetCGColor (UIColor.Black);
- Assert.NotNull (sl.FillColor, "FillColor");
+ Assert.That (sl.FillColor, Is.Not.Null, "FillColor");
sl.Path = new CGPath ();
- Assert.NotNull (sl.Path, "Path");
+ Assert.That (sl.Path, Is.Not.Null, "Path");
sl.LineDashPattern = new [] { new NSNumber (5), new NSNumber (10) };
- Assert.NotNull (sl.LineDashPattern, "LineDashPattern");
+ Assert.That (sl.LineDashPattern, Is.Not.Null, "LineDashPattern");
sl.StrokeColor = TestRuntime.GetCGColor (UIColor.White);
- Assert.NotNull (sl.StrokeColor, "StrokeColor");
+ Assert.That (sl.StrokeColor, Is.Not.Null, "StrokeColor");
}
}
}
diff --git a/tests/monotouch-test/CoreAnimation/TransactionTest.cs b/tests/monotouch-test/CoreAnimation/TransactionTest.cs
index 53d914050964..0747d5239ff1 100644
--- a/tests/monotouch-test/CoreAnimation/TransactionTest.cs
+++ b/tests/monotouch-test/CoreAnimation/TransactionTest.cs
@@ -19,7 +19,7 @@ public class TransactionTest {
public void CompletionBlock_Null ()
{
CATransaction.CompletionBlock = null;
- Assert.Null (CATransaction.CompletionBlock, "CompletionBlock");
+ Assert.That (CATransaction.CompletionBlock, Is.Null, "CompletionBlock");
}
[Test]
@@ -28,7 +28,7 @@ public void AnimationTimingFunction_Null ()
// NULL is not specified in Apple doc
// but since it's the default value it makes sense to be able to set it back
CATransaction.AnimationTimingFunction = null;
- Assert.Null (CATransaction.AnimationTimingFunction, "AnimationTimingFunction");
+ Assert.That (CATransaction.AnimationTimingFunction, Is.Null, "AnimationTimingFunction");
}
}
}
diff --git a/tests/monotouch-test/CoreBluetooth/CentralManagerTest.cs b/tests/monotouch-test/CoreBluetooth/CentralManagerTest.cs
index 725f0733e1f0..15c0185d099c 100644
--- a/tests/monotouch-test/CoreBluetooth/CentralManagerTest.cs
+++ b/tests/monotouch-test/CoreBluetooth/CentralManagerTest.cs
@@ -84,7 +84,7 @@ public void TearDown ()
public void Constructors ()
{
// Manager creates it, we'll simply check it has a non-null delegate
- Assert.NotNull (mgr.Delegate, "Delegate");
+ Assert.That (mgr.Delegate, Is.Not.Null, "Delegate");
}
[Test]
diff --git a/tests/monotouch-test/CoreBluetooth/PeerTest.cs b/tests/monotouch-test/CoreBluetooth/PeerTest.cs
index 5b7397579da2..5ed838ead0a8 100644
--- a/tests/monotouch-test/CoreBluetooth/PeerTest.cs
+++ b/tests/monotouch-test/CoreBluetooth/PeerTest.cs
@@ -24,7 +24,7 @@ public void Constructor ()
// crash at dispose time in beta 4 (and 5)
// the type is undocumented but I think it's should be abstract (not user creatable)
// using (var p = new CBPeer ()) {
- // Assert.NotNull (p);
+ // Assert.That (p, Is.Not.Null);
// }
}
}
diff --git a/tests/monotouch-test/CoreBluetooth/PeripheralScanningOptionsTest.cs b/tests/monotouch-test/CoreBluetooth/PeripheralScanningOptionsTest.cs
index cc8edbe775bb..bf42642dbd03 100644
--- a/tests/monotouch-test/CoreBluetooth/PeripheralScanningOptionsTest.cs
+++ b/tests/monotouch-test/CoreBluetooth/PeripheralScanningOptionsTest.cs
@@ -20,7 +20,7 @@ public void Defaults ()
{
var options = new PeripheralScanningOptions ();
Assert.That (options.Dictionary.Count, Is.EqualTo ((nuint) 0), "Count");
- Assert.False (options.AllowDuplicatesKey, "AllowDuplicatesKey");
+ Assert.That (options.AllowDuplicatesKey, Is.False, "AllowDuplicatesKey");
}
[Test]
@@ -30,7 +30,7 @@ public void AllowDuplicatesKey_True ()
AllowDuplicatesKey = true
};
Assert.That (options.Dictionary.Count, Is.EqualTo ((nuint) 1), "Count");
- Assert.True (options.AllowDuplicatesKey, "AllowDuplicatesKey");
+ Assert.That (options.AllowDuplicatesKey, Is.True, "AllowDuplicatesKey");
}
[Test]
@@ -40,7 +40,7 @@ public void AllowDuplicatesKey_False ()
AllowDuplicatesKey = false
};
Assert.That (options.Dictionary.Count, Is.EqualTo ((nuint) 1), "Count");
- Assert.False (options.AllowDuplicatesKey, "AllowDuplicatesKey");
+ Assert.That (options.AllowDuplicatesKey, Is.False, "AllowDuplicatesKey");
}
}
}
diff --git a/tests/monotouch-test/CoreBluetooth/UuidTest.cs b/tests/monotouch-test/CoreBluetooth/UuidTest.cs
index aa97e792aedf..2d9ddbdc5313 100644
--- a/tests/monotouch-test/CoreBluetooth/UuidTest.cs
+++ b/tests/monotouch-test/CoreBluetooth/UuidTest.cs
@@ -28,7 +28,7 @@ public void Roundtrip_16bits ()
{
using (CBUUID uuid = CBUUID.FromString ("1234")) {
Assert.That (uuid.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle");
- Assert.IsNotNull (uuid.Data, "Data");
+ Assert.That (uuid.Data, Is.Not.Null, "Data");
var firstExpected = "Unknown (<1234>)";
var secondExpected = "1234";
Assert.That (uuid.Description, Is.EqualTo (firstExpected).Or.EqualTo (secondExpected), "Description");
@@ -45,7 +45,7 @@ public void Roundtrip_128bits ()
{
using (CBUUID uuid = CBUUID.FromString ("12345678-90AB-CDEF-cafe-c80c20443d0b")) {
Assert.That (uuid.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle");
- Assert.IsNotNull (uuid.Data, "Data");
+ Assert.That (uuid.Data, Is.Not.Null, "Data");
var firstExpected = "Unknown (<12345678 90abcdef cafec80c 20443d0b>)";
var secondExpected = "12345678-90AB-CDEF-CAFE-C80C20443D0B";
Assert.That (uuid.Description, Is.EqualTo (firstExpected).Or.EqualTo (secondExpected), "Description");
@@ -97,25 +97,25 @@ public void Equality_PartialEquals ()
var guid = new byte [] { 0xaa, 0xbb };
using (var u1 = CBUUID.FromBytes (guid))
using (var u2 = CBUUID.FromBytes (guid)) {
- Assert.True (u1.Equals ((object) u2), "Equals-1a");
- Assert.True (u1.Equals ((NSObject) u2), "Equals-1b");
- Assert.True (u1.Equals ((CBUUID) u2), "Equals-1b");
+ Assert.That (u1.Equals ((object) u2), Is.True, "Equals-1a");
+ Assert.That (u1.Equals ((NSObject) u2), Is.True, "Equals-1b");
+ Assert.That (u1.Equals ((CBUUID) u2), Is.True, "Equals-1b");
Assert.That (u1.GetHashCode (), Is.EqualTo (u2.GetHashCode ()), "GetHashCode-1");
}
using (var u1 = CBUUID.FromPartial (0x1234))
using (var u2 = CBUUID.FromPartial (0x1234)) {
- Assert.True (u1.Equals ((object) u2), "Equals-2a");
- Assert.True (u1.Equals ((NSObject) u2), "Equals-2b");
- Assert.True (u1.Equals ((CBUUID) u2), "Equals-2b");
+ Assert.That (u1.Equals ((object) u2), Is.True, "Equals-2a");
+ Assert.That (u1.Equals ((NSObject) u2), Is.True, "Equals-2b");
+ Assert.That (u1.Equals ((CBUUID) u2), Is.True, "Equals-2b");
Assert.That (u1.GetHashCode (), Is.EqualTo (u2.GetHashCode ()), "GetHashCode-2");
}
using (var u1 = CBUUID.FromString ("1234"))
using (var u2 = CBUUID.FromBytes (new byte [] { 0x12, 0x34 })) {
- Assert.True (u1.Equals ((object) u2), "Equals-3a");
- Assert.True (u1.Equals ((NSObject) u2), "Equals-3b");
- Assert.True (u1.Equals ((CBUUID) u2), "Equals-3b");
+ Assert.That (u1.Equals ((object) u2), Is.True, "Equals-3a");
+ Assert.That (u1.Equals ((NSObject) u2), Is.True, "Equals-3b");
+ Assert.That (u1.Equals ((CBUUID) u2), Is.True, "Equals-3b");
Assert.That (u1.GetHashCode (), Is.EqualTo (u2.GetHashCode ()), "GetHashCode-3");
}
#if MONOMAC
@@ -133,25 +133,25 @@ public void Equality_PartialEqualsFull ()
{
using (var u1 = CBUUID.FromPartial (0x0127))
using (var u2 = MakeFull (0x01, 0x27)) {
- Assert.True (u1.Equals ((object) u2), "Equals-1a");
- Assert.True (u1.Equals ((NSObject) u2), "Equals-1b");
- Assert.True (u1.Equals ((CBUUID) u2), "Equals-1b");
+ Assert.That (u1.Equals ((object) u2), Is.True, "Equals-1a");
+ Assert.That (u1.Equals ((NSObject) u2), Is.True, "Equals-1b");
+ Assert.That (u1.Equals ((CBUUID) u2), Is.True, "Equals-1b");
Assert.That (u1.GetHashCode (), Is.EqualTo (u2.GetHashCode ()), "GetHashCode-1");
}
using (var u1 = CBUUID.FromBytes (new byte [] { 0xab, 0xcd }))
using (var u2 = MakeFull (0xab, 0xcd)) {
- Assert.True (u1.Equals ((object) u2), "Equals-2a");
- Assert.True (u1.Equals ((NSObject) u2), "Equals-2b");
- Assert.True (u1.Equals ((CBUUID) u2), "Equals-2b");
+ Assert.That (u1.Equals ((object) u2), Is.True, "Equals-2a");
+ Assert.That (u1.Equals ((NSObject) u2), Is.True, "Equals-2b");
+ Assert.That (u1.Equals ((CBUUID) u2), Is.True, "Equals-2b");
Assert.That (u1.GetHashCode (), Is.EqualTo (u2.GetHashCode ()), "GetHashCode-2");
}
using (var u1 = CBUUID.FromString ("1234"))
using (var u2 = CBUUID.FromString ("00001234-0000-1000-8000-00805f9b34fb")) {
- Assert.True (u1.Equals ((object) u2), "Equals-3a");
- Assert.True (u1.Equals ((NSObject) u2), "Equals-3b");
- Assert.True (u1.Equals ((CBUUID) u2), "Equals-3b");
+ Assert.That (u1.Equals ((object) u2), Is.True, "Equals-3a");
+ Assert.That (u1.Equals ((NSObject) u2), Is.True, "Equals-3b");
+ Assert.That (u1.Equals ((CBUUID) u2), Is.True, "Equals-3b");
Assert.That (u1.GetHashCode (), Is.EqualTo (u2.GetHashCode ()), "GetHashCode-3");
}
#if MONOMAC
diff --git a/tests/monotouch-test/CoreData/AttributeDescriptionTest.cs b/tests/monotouch-test/CoreData/AttributeDescriptionTest.cs
index 4406a88bd688..20973f10c150 100644
--- a/tests/monotouch-test/CoreData/AttributeDescriptionTest.cs
+++ b/tests/monotouch-test/CoreData/AttributeDescriptionTest.cs
@@ -29,7 +29,7 @@ public void DefaultValue ()
using (var ad = new NSAttributeDescription ())
using (var o = new NSObject ()) {
ad.DefaultValue = o;
- Assert.AreSame (o, ad.DefaultValue, "DefaultValue");
+ Assert.That (ad.DefaultValue, Is.SameAs (o), "DefaultValue");
}
}
@@ -37,10 +37,9 @@ public void DefaultValue ()
public void GetSetRenamingIdentifier ()
{
using (var ad = new NSAttributeDescription ()) {
- Assert.IsNull (ad.RenamingIdentifier, "An unset RenamingIdentifier should be null.");
+ Assert.That (ad.RenamingIdentifier, Is.Null, "An unset RenamingIdentifier should be null.");
ad.RenamingIdentifier = "Foo";
- Assert.AreEqual ("Foo", ad.RenamingIdentifier,
- "RenamingIndentifier was not corrently set.");
+ Assert.That (ad.RenamingIdentifier, Is.EqualTo ("Foo"), "RenamingIndentifier was not corrently set.");
}
}
}
diff --git a/tests/monotouch-test/CoreData/EntityDescriptionTest.cs b/tests/monotouch-test/CoreData/EntityDescriptionTest.cs
index 0bf9bdce1a6f..f2002ed82b8f 100644
--- a/tests/monotouch-test/CoreData/EntityDescriptionTest.cs
+++ b/tests/monotouch-test/CoreData/EntityDescriptionTest.cs
@@ -16,8 +16,8 @@ public void UniquenessConstraints ()
// Default is an empty array, not null
var defaultValue = entity.UniquenessConstraints;
- Assert.IsNotNull (defaultValue, "default not null");
- Assert.AreEqual (0, defaultValue!.Length, "default empty");
+ Assert.That (defaultValue, Is.Not.Null, "default not null");
+ Assert.That (defaultValue!.Length, Is.EqualTo (0), "default empty");
// Add attributes so the entity knows about these property names
using var nameAttr = new NSAttributeDescription { Name = "name", AttributeType = NSAttributeType.String };
@@ -32,10 +32,10 @@ public void UniquenessConstraints ()
entity.UniquenessConstraints = constraints;
var result = entity.UniquenessConstraints;
- Assert.IsNotNull (result, "result");
- Assert.AreEqual (2, result!.Length, "outer length");
- Assert.AreEqual (2, result [0].Length, "constraint0 length");
- Assert.AreEqual (1, result [1].Length, "constraint1 length");
+ Assert.That (result, Is.Not.Null, "result");
+ Assert.That (result!.Length, Is.EqualTo (2), "outer length");
+ Assert.That (result [0].Length, Is.EqualTo (2), "constraint0 length");
+ Assert.That (result [1].Length, Is.EqualTo (1), "constraint1 length");
}
}
}
diff --git a/tests/monotouch-test/CoreData/ExpressionDescriptionTest.cs b/tests/monotouch-test/CoreData/ExpressionDescriptionTest.cs
index 9a09f0ee1287..0218c0b5da62 100644
--- a/tests/monotouch-test/CoreData/ExpressionDescriptionTest.cs
+++ b/tests/monotouch-test/CoreData/ExpressionDescriptionTest.cs
@@ -18,9 +18,9 @@ public void GetSetExpression ()
{
using (var exp = new NSExpressionDescription ()) {
exp.Name = "Test";
- Assert.IsNull (exp.Expression, "An unset Expression should be null.");
+ Assert.That (exp.Expression, Is.Null, "An unset Expression should be null.");
exp.Expression = new NSExpression (NSExpressionType.Block);
- Assert.IsNotNull (exp.Expression, "Expression was not correctly set.");
+ Assert.That (exp.Expression, Is.Not.Null, "Expression was not correctly set.");
}
}
@@ -29,11 +29,9 @@ public void GetSetResultType ()
{
using (var exp = new NSExpressionDescription ()) {
exp.Name = "Test";
- Assert.AreEqual (exp.ResultType, NSAttributeType.Undefined,
- "The default value of an unset ResultType should be 'Undefined'");
+ Assert.That (NSAttributeType.Undefined, Is.EqualTo (exp.ResultType), "The default value of an unset ResultType should be 'Undefined'");
exp.ResultType = NSAttributeType.Boolean;
- Assert.AreEqual (NSAttributeType.Boolean, exp.ResultType,
- "ResultType was not correctly set.");
+ Assert.That (exp.ResultType, Is.EqualTo (NSAttributeType.Boolean), "ResultType was not correctly set.");
}
}
}
diff --git a/tests/monotouch-test/CoreData/FetchRequestExpressionTest.cs b/tests/monotouch-test/CoreData/FetchRequestExpressionTest.cs
index 2ade5dbe0ed2..1c94b579d051 100644
--- a/tests/monotouch-test/CoreData/FetchRequestExpressionTest.cs
+++ b/tests/monotouch-test/CoreData/FetchRequestExpressionTest.cs
@@ -21,7 +21,7 @@ public void GetRequest ()
using (var exp = new NSExpression (NSExpressionType.Block))
using (var context = new NSExpression (NSExpressionType.EvaluatedObject))
using (var fetch = NSFetchRequestExpression.FromFetch (exp, context, false))
- Assert.NotNull (fetch.Request);
+ Assert.That (fetch.Request, Is.Not.Null);
}
[Test]
@@ -30,7 +30,7 @@ public void GetContext ()
using (var exp = new NSExpression (NSExpressionType.Block))
using (var context = new NSExpression (NSExpressionType.EvaluatedObject))
using (var fetch = NSFetchRequestExpression.FromFetch (exp, context, false))
- Assert.NotNull (fetch.Context);
+ Assert.That (fetch.Context, Is.Not.Null);
}
[Test]
@@ -39,12 +39,12 @@ public void GetIsCountOnly ()
using (var exp = new NSExpression (NSExpressionType.Block))
using (var context = new NSExpression (NSExpressionType.EvaluatedObject))
using (var fetch = NSFetchRequestExpression.FromFetch (exp, context, false))
- Assert.IsFalse (fetch.IsCountOnly, "IsCountOnly was not correctly set to false.");
+ Assert.That (fetch.IsCountOnly, Is.False, "IsCountOnly was not correctly set to false.");
using (var exp = new NSExpression (NSExpressionType.Block))
using (var context = new NSExpression (NSExpressionType.EvaluatedObject))
using (var fetch = NSFetchRequestExpression.FromFetch (exp, context, true))
- Assert.IsTrue (fetch.IsCountOnly, "IsCountOnly was not correctly set to true.");
+ Assert.That (fetch.IsCountOnly, Is.True, "IsCountOnly was not correctly set to true.");
}
}
}
diff --git a/tests/monotouch-test/CoreData/FetchRequestTest.cs b/tests/monotouch-test/CoreData/FetchRequestTest.cs
index 989c968457b3..2262617a2f32 100644
--- a/tests/monotouch-test/CoreData/FetchRequestTest.cs
+++ b/tests/monotouch-test/CoreData/FetchRequestTest.cs
@@ -19,25 +19,25 @@ public class FetchRequestTest {
public void DefaultValues ()
{
using (var fr = new NSFetchRequest ()) {
- Assert.Null (fr.AffectedStores, "AffectedStores");
- Assert.Null (fr.Entity, "Entity");
- Assert.Null (fr.EntityName, "EntityName");
+ Assert.That (fr.AffectedStores, Is.Null, "AffectedStores");
+ Assert.That (fr.Entity, Is.Null, "Entity");
+ Assert.That (fr.EntityName, Is.Null, "EntityName");
Assert.That (fr.FetchBatchSize, Is.EqualTo ((nint) 0), "FetchBatchSize");
Assert.That (fr.FetchLimit, Is.EqualTo ((nuint) 0), "FetchLimit");
Assert.That (fr.FetchOffset, Is.EqualTo ((nuint) 0), "FetchOffset");
- Assert.Null (fr.HavingPredicate, "HavingPredicate");
- Assert.True (fr.IncludesPendingChanges, "IncludesPendingChanges");
- Assert.True (fr.IncludesPropertyValues, "IncludesPropertyValues");
- Assert.True (fr.IncludesSubentities, "IncludesSubentities");
- Assert.Null (fr.Predicate, "Predicate");
- Assert.Null (fr.PropertiesToFetch, "PropertiesToFetch");
- Assert.Null (fr.PropertiesToGroupBy, "PropertiesToGroupBy");
- Assert.Null (fr.RelationshipKeyPathsForPrefetching, "RelationshipKeyPathsForPrefetching");
+ Assert.That (fr.HavingPredicate, Is.Null, "HavingPredicate");
+ Assert.That (fr.IncludesPendingChanges, Is.True, "IncludesPendingChanges");
+ Assert.That (fr.IncludesPropertyValues, Is.True, "IncludesPropertyValues");
+ Assert.That (fr.IncludesSubentities, Is.True, "IncludesSubentities");
+ Assert.That (fr.Predicate, Is.Null, "Predicate");
+ Assert.That (fr.PropertiesToFetch, Is.Null, "PropertiesToFetch");
+ Assert.That (fr.PropertiesToGroupBy, Is.Null, "PropertiesToGroupBy");
+ Assert.That (fr.RelationshipKeyPathsForPrefetching, Is.Null, "RelationshipKeyPathsForPrefetching");
Assert.That (fr.ResultType, Is.EqualTo (NSFetchRequestResultType.ManagedObject), "ResultType");
- Assert.False (fr.ReturnsDistinctResults, "ReturnsDistinctResults");
- Assert.True (fr.ReturnsObjectsAsFaults, "ReturnsObjectsAsFaults");
- Assert.False (fr.ShouldRefreshRefetchedObjects, "ShouldRefreshRefetchedObjects");
- Assert.Null (fr.SortDescriptors, "SortDescriptors");
+ Assert.That (fr.ReturnsDistinctResults, Is.False, "ReturnsDistinctResults");
+ Assert.That (fr.ReturnsObjectsAsFaults, Is.True, "ReturnsObjectsAsFaults");
+ Assert.That (fr.ShouldRefreshRefetchedObjects, Is.False, "ShouldRefreshRefetchedObjects");
+ Assert.That (fr.SortDescriptors, Is.Null, "SortDescriptors");
}
}
@@ -48,7 +48,7 @@ public void CtorString ()
Assert.That (fr.EntityName, Is.EqualTo ("entityName"), "EntityName");
// Entity is invalid (and throws) so we do not check it - except to see if we can set it to null
fr.Entity = null;
- Assert.Null (fr.Entity, "Entity");
+ Assert.That (fr.Entity, Is.Null, "Entity");
}
}
diff --git a/tests/monotouch-test/CoreData/FetchedResultsControllerTest.cs b/tests/monotouch-test/CoreData/FetchedResultsControllerTest.cs
index fff9593997f5..97e4ce269e0d 100644
--- a/tests/monotouch-test/CoreData/FetchedResultsControllerTest.cs
+++ b/tests/monotouch-test/CoreData/FetchedResultsControllerTest.cs
@@ -29,8 +29,8 @@ public void Default ()
{
using (NSFetchedResultsController frc = new NSFetchedResultsController ()) {
NSError e;
- Assert.False (frc.PerformFetch (out e), "PerformFetch");
- Assert.Null (e, "NSError");
+ Assert.That (frc.PerformFetch (out e), Is.False, "PerformFetch");
+ Assert.That (e, Is.Null, "NSError");
}
}
@@ -45,7 +45,7 @@ public void PerformFetch_Minimal ()
r.Entity = new NSEntityDescription ();
using (NSFetchedResultsController frc = new NSFetchedResultsController (r, c, null, null)) {
NSError e;
- Assert.False (frc.PerformFetch (out e), "PerformFetch");
+ Assert.That (frc.PerformFetch (out e), Is.False, "PerformFetch");
}
}
}
diff --git a/tests/monotouch-test/CoreData/ManagedObjectContextTest.cs b/tests/monotouch-test/CoreData/ManagedObjectContextTest.cs
index 76bcfdf805cf..d471502f9890 100644
--- a/tests/monotouch-test/CoreData/ManagedObjectContextTest.cs
+++ b/tests/monotouch-test/CoreData/ManagedObjectContextTest.cs
@@ -19,18 +19,18 @@ public class ManagedObjectContextTest {
void Default (NSManagedObjectContext moc)
{
Assert.That (moc.DeletedObjects.Count, Is.EqualTo ((nuint) 0), "DeletedObjects");
- Assert.False (moc.HasChanges, "HasChanges");
+ Assert.That (moc.HasChanges, Is.False, "HasChanges");
Assert.That (moc.InsertedObjects.Count, Is.EqualTo ((nuint) 0), "InsertedObjects");
Assert.That (moc.MergePolicy, Is.Not.EqualTo (IntPtr.Zero), "MergePolicy");
- Assert.Null (moc.ParentContext, "ParentContext");
- Assert.Null (moc.PersistentStoreCoordinator, "PersistentStoreCoordinator");
+ Assert.That (moc.ParentContext, Is.Null, "ParentContext");
+ Assert.That (moc.PersistentStoreCoordinator, Is.Null, "PersistentStoreCoordinator");
Assert.That (moc.RegisteredObjects.Count, Is.EqualTo ((nuint) 0), "RegisteredObjects");
- Assert.False (moc.RetainsRegisteredObjects, "RetainsRegisteredObjects");
+ Assert.That (moc.RetainsRegisteredObjects, Is.False, "RetainsRegisteredObjects");
Assert.That (moc.StalenessInterval, Is.EqualTo (-1), "StalenessInterval");
if (TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 12, throwIfOtherPlatform: false))
- Assert.Null (moc.UndoManager, "UndoManager");
+ Assert.That (moc.UndoManager, Is.Null, "UndoManager");
else
- Assert.NotNull (moc.UndoManager, "UndoManager");
+ Assert.That (moc.UndoManager, Is.Not.Null, "UndoManager");
Assert.That (moc.UpdatedObjects.Count, Is.EqualTo ((nuint) 0), "UpdatedObjects");
Assert.That (moc.UserInfo.Count, Is.EqualTo ((nuint) 0), "UserInfo");
}
diff --git a/tests/monotouch-test/CoreData/ManagedObjectModelTest.cs b/tests/monotouch-test/CoreData/ManagedObjectModelTest.cs
index 940bc15fa7ee..a4cb9e9772e2 100644
--- a/tests/monotouch-test/CoreData/ManagedObjectModelTest.cs
+++ b/tests/monotouch-test/CoreData/ManagedObjectModelTest.cs
@@ -19,7 +19,7 @@ void Default (NSManagedObjectModel moc)
{
Assert.That (moc.EntitiesByName.Count, Is.EqualTo ((nuint) 0), "EntitiesByName");
Assert.That (moc.Configurations.Length, Is.EqualTo (0), "Configurations");
- Assert.Null (moc.LocalizationDictionary, "LocalizationDictionary");
+ Assert.That (moc.LocalizationDictionary, Is.Null, "LocalizationDictionary");
Assert.That (moc.FetchRequestTemplatesByName.Count, Is.EqualTo ((nuint) 0), "FetchRequestTemplatesByName");
Assert.That (moc.VersionIdentifiers.Count, Is.EqualTo ((nuint) 0), "VersionIdentifiers");
Assert.That (moc.EntityVersionHashesByName.Count, Is.EqualTo ((nuint) 0), "EntityVersionHashesByName");
@@ -29,7 +29,7 @@ void Default (NSManagedObjectModel moc)
public void IsConfiguration_Null ()
{
using (var moc = new NSManagedObjectModel ()) {
- Assert.IsFalse (moc.IsConfigurationCompatibleWithStoreMetadata (null, new NSDictionary ()), "IsConfiguration");
+ Assert.That (moc.IsConfigurationCompatibleWithStoreMetadata (null, new NSDictionary ()), Is.False, "IsConfiguration");
Default (moc);
}
}
diff --git a/tests/monotouch-test/CoreData/NSPersistentStoreCoordinatorTest.cs b/tests/monotouch-test/CoreData/NSPersistentStoreCoordinatorTest.cs
index bdb9355d09fa..a7ac3b0ba6af 100644
--- a/tests/monotouch-test/CoreData/NSPersistentStoreCoordinatorTest.cs
+++ b/tests/monotouch-test/CoreData/NSPersistentStoreCoordinatorTest.cs
@@ -70,7 +70,7 @@ public void GetManagedObjectId ()
managedObjectModel.SetEntities (managedObjectModel.Entities, String.Empty);
using var psc = new NSPersistentStoreCoordinator (managedObjectModel);
- Assert.IsNull (psc.GetManagedObjectId ("magnitude"), "GetManagedObjectId");
+ Assert.That (psc.GetManagedObjectId ("magnitude"), Is.Null, "GetManagedObjectId");
}
}
}
diff --git a/tests/monotouch-test/CoreData/PropertyDescriptionTest.cs b/tests/monotouch-test/CoreData/PropertyDescriptionTest.cs
index 288541e917e7..f4961c1b0bd1 100644
--- a/tests/monotouch-test/CoreData/PropertyDescriptionTest.cs
+++ b/tests/monotouch-test/CoreData/PropertyDescriptionTest.cs
@@ -18,9 +18,9 @@ public void WeakFramework ()
public void GetSetName ()
{
using (var pd = new NSPropertyDescription ()) {
- Assert.IsNull (pd.Name, "An unset Name should be null");
+ Assert.That (pd.Name, Is.Null, "An unset Name should be null");
pd.Name = "Name";
- Assert.AreEqual ("Name", pd.Name, "Name was not corretly set.");
+ Assert.That (pd.Name, Is.EqualTo ("Name"), "Name was not corretly set.");
}
}
@@ -28,9 +28,9 @@ public void GetSetName ()
public void GetSetOpcional ()
{
using (var pd = new NSPropertyDescription ()) {
- Assert.IsTrue (pd.Optional, "A property should be Optional as default.");
+ Assert.That (pd.Optional, Is.True, "A property should be Optional as default.");
pd.Optional = false;
- Assert.IsFalse (pd.Optional, "Optional was not correctly set.");
+ Assert.That (pd.Optional, Is.False, "Optional was not correctly set.");
}
}
@@ -38,9 +38,9 @@ public void GetSetOpcional ()
public void GetSetTransient ()
{
using (var pd = new NSPropertyDescription ()) {
- Assert.IsFalse (pd.Transient, "A property should not be Transient by default.");
+ Assert.That (pd.Transient, Is.False, "A property should not be Transient by default.");
pd.Transient = true;
- Assert.IsTrue (pd.Transient, "Transient was not correctly set.");
+ Assert.That (pd.Transient, Is.True, "Transient was not correctly set.");
}
}
@@ -48,11 +48,9 @@ public void GetSetTransient ()
public void GetSetRenamingIdentifier ()
{
using (var pd = new NSPropertyDescription ()) {
- Assert.IsNull (pd.RenamingIdentifier,
- "A property by default should have the RenamingIndentifier set to null");
+ Assert.That (pd.RenamingIdentifier, Is.Null, "A property by default should have the RenamingIndentifier set to null");
pd.RenamingIdentifier = "Foo";
- Assert.AreEqual ("Foo", pd.RenamingIdentifier,
- "RenamingIdentifier was not correctly set.");
+ Assert.That (pd.RenamingIdentifier, Is.EqualTo ("Foo"), "RenamingIdentifier was not correctly set.");
}
}
}
diff --git a/tests/monotouch-test/CoreFoundation/ArrayTest.cs b/tests/monotouch-test/CoreFoundation/ArrayTest.cs
index 2fa248478a6a..56ebf60c12ec 100644
--- a/tests/monotouch-test/CoreFoundation/ArrayTest.cs
+++ b/tests/monotouch-test/CoreFoundation/ArrayTest.cs
@@ -11,26 +11,26 @@ public class ArrayTest {
void VerifyArray (CFArray? a)
{
- Assert.IsNotNull (a, "NotNull");
- Assert.AreEqual ((nint) 3, a.Count, "Count");
+ Assert.That (a, Is.Not.Null, "NotNull");
+ Assert.That (a.Count, Is.EqualTo ((nint) 3), "Count");
for (var i = 0; i < a.Count; i++)
- Assert.AreEqual (TestArray [i], (string) CFString.FromHandle (a.GetValue (i), false), i.ToString ());
+ Assert.That ((string) CFString.FromHandle (a.GetValue (i), false), Is.EqualTo (TestArray [i]), i.ToString ());
}
void VerifyArray (NSString []? a)
{
- Assert.IsNotNull (a, "NotNull");
- Assert.AreEqual (3, a.Length, "Count");
+ Assert.That (a, Is.Not.Null, "NotNull");
+ Assert.That (a.Length, Is.EqualTo (3), "Count");
for (var i = 0; i < a.Length; i++)
- Assert.AreEqual (TestArray [i], (string) a [i], i.ToString ());
+ Assert.That ((string) a [i], Is.EqualTo (TestArray [i]), i.ToString ());
}
void VerifyArray (string []? a)
{
- Assert.IsNotNull (a, "NotNull");
- Assert.AreEqual (3, a.Length, "Count");
+ Assert.That (a, Is.Not.Null, "NotNull");
+ Assert.That (a.Length, Is.EqualTo (3), "Count");
for (var i = 0; i < a.Length; i++)
- Assert.AreEqual (TestArray [i], (string) a [i], i.ToString ());
+ Assert.That ((string) a [i], Is.EqualTo (TestArray [i]), i.ToString ());
}
[Test]
@@ -39,7 +39,7 @@ public void CreateTest ()
var handle = CFArray.Create (TestArray);
using var a = Runtime.GetINativeObject (handle, true);
VerifyArray (a);
- Assert.AreEqual ((nint) 1, CFGetRetainCount (handle), "RC");
+ Assert.That (CFGetRetainCount (handle), Is.EqualTo ((nint) 1), "RC");
}
[Test]
@@ -47,7 +47,7 @@ public void FromStringsTest ()
{
using var a = CFArray.FromStrings (TestArray);
VerifyArray (a);
- Assert.AreEqual ((nint) 1, CFGetRetainCount (a.Handle), "RC");
+ Assert.That (CFGetRetainCount (a.Handle), Is.EqualTo ((nint) 1), "RC");
}
[Test]
@@ -55,23 +55,23 @@ public void CreateWithNullItemsTest ()
{
var handle = CFArray.Create (new string? [] { "a", null, "b" });
using var a = Runtime.GetINativeObject (handle, true);
- Assert.IsNotNull (a, "NotNull");
- Assert.AreEqual ((nint) 3, a!.Count, "Count");
- Assert.AreEqual ("a", CFString.FromHandle (a.GetValue (0), false), "0");
- Assert.AreEqual (NSNull.Null.Handle, a.GetValue (1), "1 - null item is CFNull");
- Assert.AreEqual ("b", CFString.FromHandle (a.GetValue (2), false), "2");
- Assert.AreEqual ((nint) 1, CFGetRetainCount (handle), "RC");
+ Assert.That (a, Is.Not.Null, "NotNull");
+ Assert.That (a!.Count, Is.EqualTo ((nint) 3), "Count");
+ Assert.That (CFString.FromHandle (a.GetValue (0), false), Is.EqualTo ("a"), "0");
+ Assert.That (a.GetValue (1), Is.EqualTo (NSNull.Null.Handle), "1 - null item is CFNull");
+ Assert.That (CFString.FromHandle (a.GetValue (2), false), Is.EqualTo ("b"), "2");
+ Assert.That (CFGetRetainCount (handle), Is.EqualTo ((nint) 1), "RC");
}
[Test]
public void FromStringsWithNullItemsTest ()
{
using var a = CFArray.FromStrings (new string? [] { "x", null, "y" });
- Assert.IsNotNull (a, "NotNull");
- Assert.AreEqual ((nint) 3, a.Count, "Count");
- Assert.AreEqual ("x", CFString.FromHandle (a.GetValue (0), false), "0");
- Assert.AreEqual (NSNull.Null.Handle, a.GetValue (1), "1 - null item is CFNull");
- Assert.AreEqual ("y", CFString.FromHandle (a.GetValue (2), false), "2");
+ Assert.That (a, Is.Not.Null, "NotNull");
+ Assert.That (a.Count, Is.EqualTo ((nint) 3), "Count");
+ Assert.That (CFString.FromHandle (a.GetValue (0), false), Is.EqualTo ("x"), "0");
+ Assert.That (a.GetValue (1), Is.EqualTo (NSNull.Null.Handle), "1 - null item is CFNull");
+ Assert.That (CFString.FromHandle (a.GetValue (2), false), Is.EqualTo ("y"), "2");
}
[Test]
@@ -80,11 +80,11 @@ public void CreateWithIReadOnlyListTest ()
IReadOnlyList list = new List { "p", null, "q" };
var handle = CFArray.Create (list);
using var a = Runtime.GetINativeObject (handle, true);
- Assert.IsNotNull (a, "NotNull");
- Assert.AreEqual ((nint) 3, a!.Count, "Count");
- Assert.AreEqual ("p", CFString.FromHandle (a.GetValue (0), false), "0");
- Assert.AreEqual (NSNull.Null.Handle, a.GetValue (1), "1 - null item is CFNull");
- Assert.AreEqual ("q", CFString.FromHandle (a.GetValue (2), false), "2");
+ Assert.That (a, Is.Not.Null, "NotNull");
+ Assert.That (a!.Count, Is.EqualTo ((nint) 3), "Count");
+ Assert.That (CFString.FromHandle (a.GetValue (0), false), Is.EqualTo ("p"), "0");
+ Assert.That (a.GetValue (1), Is.EqualTo (NSNull.Null.Handle), "1 - null item is CFNull");
+ Assert.That (CFString.FromHandle (a.GetValue (2), false), Is.EqualTo ("q"), "2");
}
[Test]
@@ -93,7 +93,7 @@ public void ArrayFromHandleTest ()
var handle = CFArray.Create (TestArray);
var a = CFArray.ArrayFromHandle (handle);
VerifyArray (a);
- Assert.AreEqual ((nint) 1, CFGetRetainCount (handle), "RC");
+ Assert.That (CFGetRetainCount (handle), Is.EqualTo ((nint) 1), "RC");
CFRelease (handle);
}
@@ -104,7 +104,7 @@ public void ArrayFromHandleTest_bool_true ()
CFRetain (handle);
var a = CFArray.ArrayFromHandle (handle, true);
VerifyArray (a);
- Assert.AreEqual ((nint) 1, CFGetRetainCount (handle), "RC");
+ Assert.That (CFGetRetainCount (handle), Is.EqualTo ((nint) 1), "RC");
CFRelease (handle);
}
@@ -114,7 +114,7 @@ public void ArrayFromHandleTest_bool_false ()
var handle = CFArray.Create (TestArray);
var a = CFArray.ArrayFromHandle (handle, false);
VerifyArray (a);
- Assert.AreEqual ((nint) 1, CFGetRetainCount (handle), "RC");
+ Assert.That (CFGetRetainCount (handle), Is.EqualTo ((nint) 1), "RC");
CFRelease (handle);
}
@@ -124,7 +124,7 @@ public void ArrayFromHandleFuncTest ()
var handle = CFArray.Create (TestArray);
var a = CFArray.ArrayFromHandleFunc (handle, (v) => CFString.FromHandle (v));
VerifyArray (a);
- Assert.AreEqual ((nint) 1, CFGetRetainCount (handle), "RC");
+ Assert.That (CFGetRetainCount (handle), Is.EqualTo ((nint) 1), "RC");
CFRelease (handle);
}
@@ -135,7 +135,7 @@ public void ArrayFromHandleFuncTest_bool_true ()
CFRetain (handle);
var a = CFArray.ArrayFromHandleFunc (handle, (v) => CFString.FromHandle (v), true);
VerifyArray (a);
- Assert.AreEqual ((nint) 1, CFGetRetainCount (handle), "RC");
+ Assert.That (CFGetRetainCount (handle), Is.EqualTo ((nint) 1), "RC");
CFRelease (handle);
}
@@ -145,7 +145,7 @@ public void ArrayFromHandleFuncTest_bool_false ()
var handle = CFArray.Create (TestArray);
var a = CFArray.ArrayFromHandleFunc (handle, (v) => CFString.FromHandle (v), false);
VerifyArray (a);
- Assert.AreEqual ((nint) 1, CFGetRetainCount (handle), "RC");
+ Assert.That (CFGetRetainCount (handle), Is.EqualTo ((nint) 1), "RC");
CFRelease (handle);
}
diff --git a/tests/monotouch-test/CoreFoundation/BundleTest.cs b/tests/monotouch-test/CoreFoundation/BundleTest.cs
index 69246f32ae6e..6e7cd189b4fe 100644
--- a/tests/monotouch-test/CoreFoundation/BundleTest.cs
+++ b/tests/monotouch-test/CoreFoundation/BundleTest.cs
@@ -15,10 +15,9 @@ public class BundleTest {
public void TestGetAll ()
{
var bundles = CFBundle.GetAll ();
- Assert.IsTrue (bundles.Length > 0);
+ Assert.That (bundles.Length > 0, Is.True);
foreach (CFBundle b in bundles) {
- Assert.IsFalse (String.IsNullOrEmpty (b.Url.ToString ()),
- String.Format ("Found bundle with null url and id {0}", b.Identifier));
+ Assert.That (String.IsNullOrEmpty (b.Url.ToString ()), Is.False, String.Format ("Found bundle with null url and id {0}", b.Identifier));
}
}
@@ -26,7 +25,7 @@ public void TestGetAll ()
public void TestGetBundleIdMissing ()
{
var bundle = CFBundle.Get ("????");
- Assert.IsNull (bundle);
+ Assert.That (bundle, Is.Null);
}
[Test]
@@ -34,7 +33,7 @@ public void TestGetBundleId ()
{
// grab all bundles and make sure we do get the correct ones using their id
var bundles = CFBundle.GetAll ();
- Assert.IsTrue (bundles.Length > 0);
+ Assert.That (bundles.Length > 0, Is.True);
// There may be multiple apps providing the same bundle ID (the typical example is that we usually have multiple Xcodes installed)
// So compute a map for bundle id -> bundle paths that's used in the second part here to verify the CFBundle.Get results.
@@ -52,11 +51,10 @@ public void TestGetBundleId ()
var id = b.Identifier;
if (!String.IsNullOrEmpty (id)) {
var otherBundle = CFBundle.Get (id);
- Assert.AreEqual (b.Info.Type, otherBundle.Info.Type,
- String.Format ("Found bundle with diff type and id {0}", id));
+ Assert.That (otherBundle.Info.Type, Is.EqualTo (b.Info.Type), String.Format ("Found bundle with diff type and id {0}", id));
var bPath = (string) ((NSString) b.Url.Path).ResolveSymlinksInPath ();
var list = dict [id];
- Assert.That (list, Does.Contain (bPath), "None of the bundles for {0} matches the path {1}", id, bPath);
+ Assert.That (list, Does.Contain (bPath), $"None of the bundles for {id} matches the path {bPath}");
}
}
}
@@ -73,8 +71,8 @@ public void TestGetMain ()
{
var main = CFBundle.GetMain ();
var expectedBundleId = "com.xamarin.monotouch-test";
- Assert.AreEqual (expectedBundleId, main.Identifier);
- Assert.IsTrue (main.HasLoadedExecutable);
+ Assert.That (main.Identifier, Is.EqualTo (expectedBundleId));
+ Assert.That (main.HasLoadedExecutable, Is.True);
}
[Test]
@@ -136,7 +134,7 @@ public void TestSupportFilesDirectoryUrl ()
public void TestArchitectures ()
{
var main = CFBundle.GetMain ();
- Assert.IsTrue (main.Architectures.Length > 0);
+ Assert.That (main.Architectures.Length > 0, Is.True);
}
[Test]
@@ -150,7 +148,7 @@ public void TestUrl ()
public void TestDevelopmentRegion ()
{
var main = CFBundle.GetMain ();
- Assert.IsTrue (String.IsNullOrEmpty (main.DevelopmentRegion));
+ Assert.That (String.IsNullOrEmpty (main.DevelopmentRegion), Is.True);
}
[Test]
@@ -161,7 +159,7 @@ public void TestLocalizations ()
var expected = new string [] {
"Base", "en-AU", "en-UK", "es", "es-AR", "es-ES"
}.OrderBy (v => v).ToArray ();
- Assert.AreEqual (string.Join (";", expected), string.Join (";", localizations), "Localizations");
+ Assert.That (string.Join (";", localizations), Is.EqualTo (string.Join (";", expected)), "Localizations");
}
[Test]
@@ -175,7 +173,7 @@ public void TestPreferredLocalizations ()
{
var preferred = new string [] { "en", "es" };
var used = CFBundle.GetPreferredLocalizations (preferred);
- Assert.IsTrue (used.Length > 0);
+ Assert.That (used.Length > 0, Is.True);
foreach (var u in used)
Assert.That (preferred, Contains.Item (u), u);
}
@@ -199,7 +197,7 @@ public void TestGetAuxiliaryExecutableUrlNull ()
{
var main = CFBundle.GetMain ();
var url = main.GetAuxiliaryExecutableUrl ("fake-exe");
- Assert.IsNull (url);
+ Assert.That (url, Is.Null);
}
[TestCase ("")]
@@ -334,9 +332,9 @@ public void TestGetInfoDictionaryNull ()
public void TestGetInfoDictionary ()
{
var main = CFBundle.GetMain ();
- Assert.NotNull (main.Url, "Url");
+ Assert.That (main.Url, Is.Not.Null, "Url");
var dict = CFBundle.GetInfoDictionary (main.Url);
- Assert.NotNull (dict, "GetInfoDictionary");
+ Assert.That (dict, Is.Not.Null, "GetInfoDictionary");
Assert.That (dict.Count, Is.GreaterThan ((nuint) 0), "Count");
}
@@ -382,7 +380,7 @@ public void GetLocalizedString ()
break;
}
s = main.GetLocalizedString (key, defaultValue, tableName);
- Assert.AreEqual (expectedValue, s, $"{tableName}/{key}");
+ Assert.That (s, Is.EqualTo (expectedValue), $"{tableName}/{key}");
}
// no matching table, so default value
@@ -391,7 +389,7 @@ public void GetLocalizedString ()
key = "GoodMorning";
expectedValue = "default";
s = main.GetLocalizedString (key, defaultValue, tableName);
- Assert.AreEqual (expectedValue, s, $"{tableName}/{key}");
+ Assert.That (s, Is.EqualTo (expectedValue), $"{tableName}/{key}");
}
tableName = "CustomTable";
@@ -418,7 +416,7 @@ public void GetLocalizedString ()
break;
}
s = main.GetLocalizedString (key, defaultValue, tableName);
- Assert.AreEqual (expectedValue, s, key);
+ Assert.That (s, Is.EqualTo (expectedValue), key);
});
}
@@ -442,112 +440,112 @@ public void GetLocalizedStringWithLanguages ()
tableName = "CustomTable";
key = "Local Animal";
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { });
- Assert.AreEqual ("Tiger of the Highlands", s, $"{tableName}/{key}:[]");
+ Assert.That (s, Is.EqualTo ("Tiger of the Highlands"), $"{tableName}/{key}:[]");
// There's no en-US translation, so the en-UK one is picked instead
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "en-US" });
- Assert.AreEqual ("Tiger of the Highlands", s, $"{tableName}/{key}:en-US");
+ Assert.That (s, Is.EqualTo ("Tiger of the Highlands"), $"{tableName}/{key}:en-US");
// There's no de-DE translation, so the en-UK one is picked instead
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "de-DE" });
- Assert.AreEqual ("Tiger of the Highlands", s, $"{tableName}/{key}:en-US");
+ Assert.That (s, Is.EqualTo ("Tiger of the Highlands"), $"{tableName}/{key}:en-US");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "en-AU" });
- Assert.AreEqual ("Quokka", s, $"{tableName}/{key}:en-AU");
+ Assert.That (s, Is.EqualTo ("Quokka"), $"{tableName}/{key}:en-AU");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "en-UK" });
- Assert.AreEqual ("Tiger of the Highlands", s, $"{tableName}/{key}:en-UK");
+ Assert.That (s, Is.EqualTo ("Tiger of the Highlands"), $"{tableName}/{key}:en-UK");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-ES" });
- Assert.AreEqual ("Lince ibérico", s, $"{tableName}/{key}:es-ES");
+ Assert.That (s, Is.EqualTo ("Lince ibérico"), $"{tableName}/{key}:es-ES");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-AR" });
- Assert.AreEqual ("Pato vapor cabeza blanca", s, $"{tableName}/{key}:es-AR");
+ Assert.That (s, Is.EqualTo ("Pato vapor cabeza blanca"), $"{tableName}/{key}:es-AR");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es" });
- Assert.AreEqual ("Ocelote", s, $"{tableName}/{key}:es");
+ Assert.That (s, Is.EqualTo ("Ocelote"), $"{tableName}/{key}:es");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-MX" });
- Assert.AreEqual ("Ocelote", s, $"{tableName}/{key}:es-MX");
+ Assert.That (s, Is.EqualTo ("Ocelote"), $"{tableName}/{key}:es-MX");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-AR", "es-ES" });
- Assert.AreEqual ("Pato vapor cabeza blanca", s, $"{tableName}/{key}:es-AR;es-ES");
+ Assert.That (s, Is.EqualTo ("Pato vapor cabeza blanca"), $"{tableName}/{key}:es-AR;es-ES");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-ES", "es-AR" });
- Assert.AreEqual ("Lince ibérico", s, $"{tableName}/{key}:es-ES;es-AR");
+ Assert.That (s, Is.EqualTo ("Lince ibérico"), $"{tableName}/{key}:es-ES;es-AR");
foreach (var tn in new string [] { "Localizable", null, "" }) {
tableName = tn;
key = "GoodMorning";
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { });
- Assert.AreEqual ("Wakey, wakey, eggs and bakey", s, $"{tableName}/{key}:[]");
+ Assert.That (s, Is.EqualTo ("Wakey, wakey, eggs and bakey"), $"{tableName}/{key}:[]");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "en-CA" });
- Assert.AreEqual ("Wakey, wakey, eggs and bakey", s, $"{tableName}/{key}:en-CA");
+ Assert.That (s, Is.EqualTo ("Wakey, wakey, eggs and bakey"), $"{tableName}/{key}:en-CA");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "en-US" });
- Assert.AreEqual ("Wakey, wakey, eggs and bakey", s, $"{tableName}/{key}:en-US");
+ Assert.That (s, Is.EqualTo ("Wakey, wakey, eggs and bakey"), $"{tableName}/{key}:en-US");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "en-AU" });
- Assert.AreEqual ("G'day mate", s, $"{tableName}/{key}:en-AU");
+ Assert.That (s, Is.EqualTo ("G'day mate"), $"{tableName}/{key}:en-AU");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "en-UK" });
- Assert.AreEqual ("Wakey, wakey, eggs and bakey", s, $"{tableName}/{key}:en-UK");
+ Assert.That (s, Is.EqualTo ("Wakey, wakey, eggs and bakey"), $"{tableName}/{key}:en-UK");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-ES" });
- Assert.AreEqual ("Buenos días", s, $"{tableName}/{key}:es-ES");
+ Assert.That (s, Is.EqualTo ("Buenos días"), $"{tableName}/{key}:es-ES");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-AR" });
- Assert.AreEqual ("Buen día", s, $"{tableName}/{key}:es-AR");
+ Assert.That (s, Is.EqualTo ("Buen día"), $"{tableName}/{key}:es-AR");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es" });
- Assert.AreEqual ("Buenas", s, $"{tableName}/{key}:es");
+ Assert.That (s, Is.EqualTo ("Buenas"), $"{tableName}/{key}:es");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-MX" });
- Assert.AreEqual ("Buenas", s, $"{tableName}/{key}:es-MX");
+ Assert.That (s, Is.EqualTo ("Buenas"), $"{tableName}/{key}:es-MX");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-AR", "es-ES" });
- Assert.AreEqual ("Buen día", s, $"{tableName}/{key}:es-AR;es-ES");
+ Assert.That (s, Is.EqualTo ("Buen día"), $"{tableName}/{key}:es-AR;es-ES");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-ES", "es-AR" });
- Assert.AreEqual ("Buenos días", s, $"{tableName}/{key}:es-ES;es-AR");
+ Assert.That (s, Is.EqualTo ("Buenos días"), $"{tableName}/{key}:es-ES;es-AR");
}
foreach (var tn in new string [] { "Base", "AnythingElse" }) {
tableName = tn;
key = "GoodMorning";
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { });
- Assert.AreEqual (defaultValue, s, $"{tableName}/{key}:[]");
+ Assert.That (s, Is.EqualTo (defaultValue), $"{tableName}/{key}:[]");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "en-CA" });
- Assert.AreEqual (defaultValue, s, $"{tableName}/{key}:en-CA");
+ Assert.That (s, Is.EqualTo (defaultValue), $"{tableName}/{key}:en-CA");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "en-US" });
- Assert.AreEqual (defaultValue, s, $"{tableName}/{key}:en-US");
+ Assert.That (s, Is.EqualTo (defaultValue), $"{tableName}/{key}:en-US");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "en-AU" });
- Assert.AreEqual (defaultValue, s, $"{tableName}/{key}:en-AU");
+ Assert.That (s, Is.EqualTo (defaultValue), $"{tableName}/{key}:en-AU");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "en-UK" });
- Assert.AreEqual (defaultValue, s, $"{tableName}/{key}:en-UK");
+ Assert.That (s, Is.EqualTo (defaultValue), $"{tableName}/{key}:en-UK");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-ES" });
- Assert.AreEqual (defaultValue, s, $"{tableName}/{key}:es-ES");
+ Assert.That (s, Is.EqualTo (defaultValue), $"{tableName}/{key}:es-ES");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-AR" });
- Assert.AreEqual (defaultValue, s, $"{tableName}/{key}:es-AR");
+ Assert.That (s, Is.EqualTo (defaultValue), $"{tableName}/{key}:es-AR");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es" });
- Assert.AreEqual (defaultValue, s, $"{tableName}/{key}:es");
+ Assert.That (s, Is.EqualTo (defaultValue), $"{tableName}/{key}:es");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-MX" });
- Assert.AreEqual (defaultValue, s, $"{tableName}/{key}:es-MX");
+ Assert.That (s, Is.EqualTo (defaultValue), $"{tableName}/{key}:es-MX");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-AR", "es-ES" });
- Assert.AreEqual (defaultValue, s, $"{tableName}/{key}:es-AR;es-ES");
+ Assert.That (s, Is.EqualTo (defaultValue), $"{tableName}/{key}:es-AR;es-ES");
s = main.GetLocalizedString (key, defaultValue, tableName, new string [] { "es-ES", "es-AR" });
- Assert.AreEqual (defaultValue, s, $"{tableName}/{key}:es-ES;es-AR");
+ Assert.That (s, Is.EqualTo (defaultValue), $"{tableName}/{key}:es-ES;es-AR");
}
});
}
@@ -564,13 +562,13 @@ public void TestIsArchitectureLoadable ()
bool loadable_x86_64 = CFBundle.IsArchitectureLoadable (CFBundle.Architecture.X86_64);
// Due to Rosetta, both x64 and arm64 executables are loadable on Apple Silicon.
if (isX64Executable || isArm64Executable)
- Assert.IsTrue (loadable_x86_64, "x86_64 Expected => true");
+ Assert.That (loadable_x86_64, Is.True, "x86_64 Expected => true");
else
- Assert.IsFalse (loadable_x86_64, "x86_64 Expected => false");
+ Assert.That (loadable_x86_64, Is.False, "x86_64 Expected => false");
bool loadable_arm64 = CFBundle.IsArchitectureLoadable (CFBundle.Architecture.ARM64);
if (isArm64Executable)
- Assert.IsTrue (loadable_arm64, "arm64 Expected => true");
+ Assert.That (loadable_arm64, Is.True, "arm64 Expected => true");
// Due to Rosetta, we can't determine whether ARM64 is loadable or not if we're an X64 executable ourselves.
}
@@ -581,10 +579,10 @@ public void TestIsExecutableLoadable ()
var main = CFBundle.GetMain ();
var loadableBundle = CFBundle.IsExecutableLoadable (main);
- Assert.IsTrue (loadableBundle, "loadableBundle");
+ Assert.That (loadableBundle, Is.True, "loadableBundle");
var loadableBundleUrl = CFBundle.IsExecutableLoadable (main.ExecutableUrl);
- Assert.IsTrue (loadableBundleUrl, "loadableBundleUrl");
+ Assert.That (loadableBundleUrl, Is.True, "loadableBundleUrl");
}
#endif
}
diff --git a/tests/monotouch-test/CoreFoundation/CFNotificationCenterTest.cs b/tests/monotouch-test/CoreFoundation/CFNotificationCenterTest.cs
index 67128cb914a1..6e03b3989858 100644
--- a/tests/monotouch-test/CoreFoundation/CFNotificationCenterTest.cs
+++ b/tests/monotouch-test/CoreFoundation/CFNotificationCenterTest.cs
@@ -32,22 +32,22 @@ public void TestObservers ()
});
});
d.PostNotification ("hello", target, null, deliverImmediately: true);
- Assert.AreEqual (1, count);
+ Assert.That (count, Is.EqualTo (1));
d.PostNotification ("hello", target, null, deliverImmediately: true);
- Assert.AreEqual (2, count);
- Assert.AreEqual (1, count2);
+ Assert.That (count, Is.EqualTo (2));
+ Assert.That (count2, Is.EqualTo (1));
// Remove the first observer, count should not be updated
d.RemoveObserver (o1);
d.PostNotification ("hello", target, null);
- Assert.AreEqual (2, count);
- Assert.AreEqual (2, count2);
+ Assert.That (count, Is.EqualTo (2));
+ Assert.That (count2, Is.EqualTo (2));
// Remove the last observer, there should be no change in count
d.RemoveObserver (o2);
d.PostNotification ("hello", target, null);
- Assert.AreEqual (2, count);
- Assert.AreEqual (2, count2);
+ Assert.That (count, Is.EqualTo (2));
+ Assert.That (count2, Is.EqualTo (2));
// Test removing all observers
count = 0;
@@ -58,15 +58,15 @@ public void TestObservers ()
o2 = d.AddObserver ("hello", target, (y, ee) => { count++; });
d.RemoveEveryObserver ();
d.PostNotification ("hello", target, null);
- Assert.AreEqual (0, count);
+ Assert.That (count, Is.EqualTo (0));
// Test removing from a callback
count = 0;
o2 = d.AddObserver ("hello", target, (y, ee) => { count++; d.RemoveObserver (o2); });
d.PostNotification ("hello", target, null);
- Assert.AreEqual (1, count);
+ Assert.That (count, Is.EqualTo (1));
d.PostNotification ("hello", target, null);
- Assert.AreEqual (1, count);
+ Assert.That (count, Is.EqualTo (1));
}
[Test]
@@ -85,7 +85,7 @@ public void TestNullNameAndObserver ()
NSNotificationCenter.DefaultCenter.PostNotificationName ("MornNotification", null);
d.RemoveObserver (token);
- Assert.IsTrue (mornNotification.WaitOne (TimeSpan.FromSeconds (10)), "Didn't get a notification after waiting 10 seconds.");
+ Assert.That (mornNotification.WaitOne (TimeSpan.FromSeconds (10)), Is.True, "Didn't get a notification after waiting 10 seconds.");
}
[Test]
@@ -103,22 +103,22 @@ public void TestObservers2 ()
});
});
d.PostNotification ("hello", null, null, deliverImmediately: true);
- Assert.AreEqual (1, count);
+ Assert.That (count, Is.EqualTo (1));
NSNotificationCenter.DefaultCenter.PostNotificationName ("hello", null);
- Assert.AreEqual (2, count);
- Assert.AreEqual (1, count2);
+ Assert.That (count, Is.EqualTo (2));
+ Assert.That (count2, Is.EqualTo (1));
// Remove the first observer, count should not be updated
d.RemoveObserver (o1);
d.PostNotification ("hello", null, null);
- Assert.AreEqual (2, count);
- Assert.AreEqual (2, count2);
+ Assert.That (count, Is.EqualTo (2));
+ Assert.That (count2, Is.EqualTo (2));
// Remove the last observer, there should be no change in count
d.RemoveObserver (o2);
NSNotificationCenter.DefaultCenter.PostNotificationName ("hello", null);
- Assert.AreEqual (2, count);
- Assert.AreEqual (2, count2);
+ Assert.That (count, Is.EqualTo (2));
+ Assert.That (count2, Is.EqualTo (2));
// Test removing all observers
count = 0;
@@ -128,15 +128,15 @@ public void TestObservers2 ()
o2 = d.AddObserver (null, null, (y, ee) => { count++; });
d.RemoveEveryObserver ();
NSNotificationCenter.DefaultCenter.PostNotificationName ("hello", null);
- Assert.AreEqual (0, count);
+ Assert.That (count, Is.EqualTo (0));
// Test removing from a callback
count = 0;
o2 = d.AddObserver (null, null, (y, ee) => { count++; d.RemoveObserver (o2); });
d.PostNotification ("hello", null, null);
- Assert.AreEqual (1, count);
+ Assert.That (count, Is.EqualTo (1));
NSNotificationCenter.DefaultCenter.PostNotificationName ("hello", null);
- Assert.AreEqual (1, count);
+ Assert.That (count, Is.EqualTo (1));
}
}
}
diff --git a/tests/monotouch-test/CoreFoundation/CFSocketDataEventArgsTests.cs b/tests/monotouch-test/CoreFoundation/CFSocketDataEventArgsTests.cs
index c316e5c2d415..cae8344ad8b4 100644
--- a/tests/monotouch-test/CoreFoundation/CFSocketDataEventArgsTests.cs
+++ b/tests/monotouch-test/CoreFoundation/CFSocketDataEventArgsTests.cs
@@ -31,12 +31,12 @@ public void Constructor_WithByteArray_SetsPropertiesCorrectly ()
var args = new CFSocket.CFSocketDataEventArgs (remoteEndPoint, testData);
// Assert
- Assert.AreSame (remoteEndPoint, args.RemoteEndPoint);
+ Assert.That (args.RemoteEndPoint, Is.SameAs (remoteEndPoint));
var retrievedData = args.Data;
- Assert.IsNotNull (retrievedData);
- Assert.AreEqual (testData.Length, retrievedData.Length);
+ Assert.That (retrievedData, Is.Not.Null);
+ Assert.That (retrievedData.Length, Is.EqualTo (testData.Length));
for (int i = 0; i < testData.Length; i++) {
- Assert.AreEqual (testData [i], retrievedData [i]);
+ Assert.That (retrievedData [i], Is.EqualTo (testData [i]));
}
}
@@ -50,8 +50,8 @@ public void Constructor_WithNullRemoteEndPoint_AcceptsNull ()
// Since RemoteEndPoint uses nullable reference types, null should be accepted
Assert.DoesNotThrow (() => {
var args = new CFSocket.CFSocketDataEventArgs (null, testData);
- Assert.IsNull (args.RemoteEndPoint);
- Assert.AreSame (testData, args.Data);
+ Assert.That (args.RemoteEndPoint, Is.Null);
+ Assert.That (args.Data, Is.SameAs (testData));
});
}
@@ -65,10 +65,10 @@ public void Constructor_WithNullByteArray_AcceptsNull ()
// Since data uses nullable reference types, null should be accepted
Assert.DoesNotThrow (() => {
var args = new CFSocket.CFSocketDataEventArgs (remoteEndPoint, (byte []) null);
- Assert.AreSame (remoteEndPoint, args.RemoteEndPoint);
+ Assert.That (args.RemoteEndPoint, Is.SameAs (remoteEndPoint));
// Data property should return empty array when null
- Assert.IsNotNull (args.Data);
- Assert.AreEqual (0, args.Data.Length);
+ Assert.That (args.Data, Is.Not.Null);
+ Assert.That (args.Data.Length, Is.EqualTo (0));
});
}
@@ -83,8 +83,8 @@ public void Data_WithEmptyByteArray_ReturnsEmptyArray ()
var args = new CFSocket.CFSocketDataEventArgs (remoteEndPoint, emptyData);
// Assert
- Assert.AreSame (emptyData, args.Data);
- Assert.AreEqual (0, args.Data.Length);
+ Assert.That (args.Data, Is.SameAs (emptyData));
+ Assert.That (args.Data.Length, Is.EqualTo (0));
}
[Test]
@@ -96,7 +96,7 @@ public void Data_WithEmptyCFData_ReturnsEmptyArray ()
var remoteEndPoint = new IPEndPoint (IPAddress.Loopback, 8080);
var args = new CFSocket.CFSocketDataEventArgs (remoteEndPoint, (byte []) null);
- Assert.AreEqual (0, args.Data.Length);
+ Assert.That (args.Data.Length, Is.EqualTo (0));
}
[Test]
@@ -114,13 +114,13 @@ public void Data_AccessedMultipleTimes_ReturnsSameInstance ()
var data2 = args1.Data;
// Assert
- Assert.AreSame (data1, data2, "Data property should return the same instance when accessed multiple times with byte array");
+ Assert.That (data2, Is.SameAs (data1), "Data property should return the same instance when accessed multiple times with byte array");
// Test with null data (should return empty array consistently)
var args2 = new CFSocket.CFSocketDataEventArgs (remoteEndPoint, (byte []) null);
var emptyData1 = args2.Data;
var emptyData2 = args2.Data;
- Assert.AreSame (emptyData1, emptyData2, "Data property should return the same empty array instance when accessed multiple times with null data");
+ Assert.That (emptyData2, Is.SameAs (emptyData1), "Data property should return the same empty array instance when accessed multiple times with null data");
}
[Test]
@@ -135,9 +135,9 @@ public void RemoteEndPoint_IPv6Address_SetsCorrectly ()
var args = new CFSocket.CFSocketDataEventArgs (remoteEndPoint, testData);
// Assert
- Assert.AreSame (remoteEndPoint, args.RemoteEndPoint);
- Assert.AreEqual (ipv6Address, args.RemoteEndPoint.Address);
- Assert.AreEqual (9090, args.RemoteEndPoint.Port);
+ Assert.That (args.RemoteEndPoint, Is.SameAs (remoteEndPoint));
+ Assert.That (args.RemoteEndPoint.Address, Is.EqualTo (ipv6Address));
+ Assert.That (args.RemoteEndPoint.Port, Is.EqualTo (9090));
}
[Test]
@@ -154,7 +154,7 @@ public void RemoteEndPoint_DifferentPorts_SetsCorrectly ()
var args = new CFSocket.CFSocketDataEventArgs (remoteEndPoint, testData);
// Assert
- Assert.AreEqual (port, args.RemoteEndPoint.Port, $"Port {port} should be set correctly");
+ Assert.That (args.RemoteEndPoint.Port, Is.EqualTo (port), $"Port {port} should be set correctly");
}
}
@@ -169,7 +169,7 @@ public void InheritsFromEventArgs ()
var args = new CFSocket.CFSocketDataEventArgs (remoteEndPoint, testData);
// Assert
- Assert.IsInstanceOf (args, "CFSocketDataEventArgs should inherit from EventArgs");
+ Assert.That (args, Is.InstanceOf (), "CFSocketDataEventArgs should inherit from EventArgs");
}
[Test]
@@ -186,13 +186,13 @@ public void LargeDataArray_HandledCorrectly ()
var args = new CFSocket.CFSocketDataEventArgs (remoteEndPoint, largeData);
// Assert
- Assert.AreSame (largeData, args.Data);
- Assert.AreEqual (1024 * 1024, args.Data.Length);
+ Assert.That (args.Data, Is.SameAs (largeData));
+ Assert.That (args.Data.Length, Is.EqualTo (1024 * 1024));
// Verify a few sample bytes
- Assert.AreEqual (0, args.Data [0]);
- Assert.AreEqual (255, args.Data [255]);
- Assert.AreEqual (0, args.Data [256]);
+ Assert.That (args.Data [0], Is.EqualTo (0));
+ Assert.That (args.Data [255], Is.EqualTo (255));
+ Assert.That (args.Data [256], Is.EqualTo (0));
}
[Test]
@@ -208,12 +208,12 @@ public void CFData_LazyLoading_WorksCorrectly ()
// Act & Assert
// First access to Data should trigger the lazy loading (should return empty array)
var retrievedData = args.Data;
- Assert.IsNotNull (retrievedData);
- Assert.AreEqual (0, retrievedData.Length);
+ Assert.That (retrievedData, Is.Not.Null);
+ Assert.That (retrievedData.Length, Is.EqualTo (0));
// Subsequent accesses should return the same cached instance
var retrievedData2 = args.Data;
- Assert.AreSame (retrievedData, retrievedData2);
+ Assert.That (retrievedData2, Is.SameAs (retrievedData));
}
}
}
diff --git a/tests/monotouch-test/CoreFoundation/DispatchBlockTests.cs b/tests/monotouch-test/CoreFoundation/DispatchBlockTests.cs
index 80fb6b2ae5f5..8d9248d8e360 100644
--- a/tests/monotouch-test/CoreFoundation/DispatchBlockTests.cs
+++ b/tests/monotouch-test/CoreFoundation/DispatchBlockTests.cs
@@ -28,20 +28,20 @@ public void Invoke ()
var callback = new Action (() => called = true);
using (var db = new DispatchBlock (callback)) {
db.Invoke ();
- Assert.IsTrue (called, "Called");
+ Assert.That (called, Is.True, "Called");
}
}
[Test]
public void ExplicitActionConversionInvoke ()
{
- Assert.IsNull ((Action) ((DispatchBlock) null), "Null conversion");
+ Assert.That ((Action) ((DispatchBlock) null), Is.Null, "Null conversion");
var called = false;
var callback = new Action (() => called = true);
using (var db = new DispatchBlock (callback)) {
((Action) db) ();
- Assert.IsTrue (called, "Called");
+ Assert.That (called, Is.True, "Called");
}
}
@@ -58,7 +58,7 @@ public void NotifyAction ()
db.Notify (DispatchQueue.MainQueue, notification);
DispatchQueue.MainQueue.DispatchAsync (db);
TestRuntime.RunAsync (TimeSpan.FromSeconds (5), () => { }, () => notified);
- Assert.IsTrue (called, "Called");
+ Assert.That (called, Is.True, "Called");
}
}
@@ -76,7 +76,7 @@ public void NotifyDispatchBlock ()
db.Notify (DispatchQueue.MainQueue, notification_block);
DispatchQueue.MainQueue.DispatchAsync (db);
TestRuntime.RunAsync (TimeSpan.FromSeconds (5), () => { }, () => notified);
- Assert.IsTrue (called, "Called");
+ Assert.That (called, Is.True, "Called");
}
}
}
@@ -92,12 +92,12 @@ public void Wait_DispatchTime ()
using (var queue = new DispatchQueue ("Background")) {
queue.Activate ();
var rv = (int) db.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (0.1)));
- Assert.AreNotEqual (0, rv, "Timed Out");
+ Assert.That (rv, Is.Not.EqualTo (0), "Timed Out");
queue.DispatchAsync (db);
rv = (int) db.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (5)));
- Assert.AreEqual (0, rv, "Timed Out 2");
- Assert.IsTrue (called, "Called");
+ Assert.That (rv, Is.EqualTo (0), "Timed Out 2");
+ Assert.That (called, Is.True, "Called");
}
}
}
@@ -113,12 +113,12 @@ public void Wait_TimeSpan ()
using (var queue = new DispatchQueue ("Background")) {
queue.Activate ();
var rv = (int) db.Wait (TimeSpan.FromSeconds (0.1));
- Assert.AreNotEqual (0, rv, "Timed Out");
+ Assert.That (rv, Is.Not.EqualTo (0), "Timed Out");
queue.DispatchAsync (db);
rv = (int) db.Wait (TimeSpan.FromSeconds (5));
- Assert.AreEqual (0, rv, "Timed Out 2");
- Assert.IsTrue (called, "Called");
+ Assert.That (rv, Is.EqualTo (0), "Timed Out 2");
+ Assert.That (called, Is.True, "Called");
}
}
}
@@ -129,12 +129,12 @@ public void Cancellation ()
var called = false;
var callback = new Action (() => called = true);
using (var db = new DispatchBlock (callback)) {
- Assert.AreEqual ((nint) 0, db.TestCancel (), "TestCancel 1");
- Assert.IsFalse (db.Cancelled, "Cancelled 1");
+ Assert.That (db.TestCancel (), Is.EqualTo ((nint) 0), "TestCancel 1");
+ Assert.That (db.Cancelled, Is.False, "Cancelled 1");
db.Cancel ();
- Assert.AreNotEqual ((nint) 0, db.TestCancel (), "TestCancel 2");
- Assert.IsTrue (db.Cancelled, "Cancelled 2");
- Assert.IsFalse (called, "Called"); // The dispatch block was never submitted to a dispatch queue, so it shouldn't have executed.
+ Assert.That (db.TestCancel (), Is.Not.EqualTo ((nint) 0), "TestCancel 2");
+ Assert.That (db.Cancelled, Is.True, "Cancelled 2");
+ Assert.That (called, Is.False, "Called"); // The dispatch block was never submitted to a dispatch queue, so it shouldn't have executed.
}
}
@@ -163,8 +163,8 @@ public void Constructors ()
queue.Activate ();
queue.DispatchAsync (db);
var rv = (int) db.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (5)));
- Assert.AreEqual (0, rv, "Timed Out A");
- Assert.IsTrue (called, "Called A");
+ Assert.That (rv, Is.EqualTo (0), "Timed Out A");
+ Assert.That (called, Is.True, "Called A");
}
}
@@ -175,8 +175,8 @@ public void Constructors ()
queue.Activate ();
queue.DispatchAsync (db);
var rv = (int) db.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (5)));
- Assert.AreEqual (0, rv, "Timed Out " + flags);
- Assert.IsTrue (called, "Called " + flags);
+ Assert.That (rv, Is.EqualTo (0), "Timed Out " + flags);
+ Assert.That (called, Is.True, "Called " + flags);
}
}
@@ -187,8 +187,8 @@ public void Constructors ()
queue.Activate ();
queue.DispatchAsync (db);
var rv = (int) db.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (5)));
- Assert.AreEqual (0, rv, "Timed Out " + flags);
- Assert.IsTrue (called, "Called " + flags);
+ Assert.That (rv, Is.EqualTo (0), "Timed Out " + flags);
+ Assert.That (called, Is.True, "Called " + flags);
}
}
@@ -200,8 +200,8 @@ public void Constructors ()
queue.Activate ();
queue.DispatchAsync (db);
var rv = (int) db.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (5)));
- Assert.AreEqual (0, rv, "Timed Out " + flags);
- Assert.IsTrue (called, "Called " + flags);
+ Assert.That (rv, Is.EqualTo (0), "Timed Out " + flags);
+ Assert.That (called, Is.True, "Called " + flags);
}
}
@@ -212,8 +212,8 @@ public void Constructors ()
queue.Activate ();
queue.DispatchAsync (db);
var rv = (int) db.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (5)));
- Assert.AreEqual (0, rv, "Timed Out Background 8" + flags);
- Assert.IsTrue (called, "Called Background 8" + flags);
+ Assert.That (rv, Is.EqualTo (0), "Timed Out Background 8" + flags);
+ Assert.That (called, Is.True, "Called Background 8" + flags);
}
}
}
@@ -243,8 +243,8 @@ public void Create ()
queue.Activate ();
queue.DispatchAsync (db);
var rv = (int) db.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (5)));
- Assert.AreEqual (0, rv, "Timed Out A");
- Assert.IsTrue (called, "Called A");
+ Assert.That (rv, Is.EqualTo (0), "Timed Out A");
+ Assert.That (called, Is.True, "Called A");
}
}
@@ -255,8 +255,8 @@ public void Create ()
queue.Activate ();
queue.DispatchAsync (db);
var rv = (int) db.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (5)));
- Assert.AreEqual (0, rv, "Timed Out " + flags);
- Assert.IsTrue (called, "Called " + flags);
+ Assert.That (rv, Is.EqualTo (0), "Timed Out " + flags);
+ Assert.That (called, Is.True, "Called " + flags);
}
}
@@ -267,8 +267,8 @@ public void Create ()
queue.Activate ();
queue.DispatchAsync (db);
var rv = (int) db.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (5)));
- Assert.AreEqual (0, rv, "Timed Out " + flags);
- Assert.IsTrue (called, "Called " + flags);
+ Assert.That (rv, Is.EqualTo (0), "Timed Out " + flags);
+ Assert.That (called, Is.True, "Called " + flags);
}
}
@@ -280,8 +280,8 @@ public void Create ()
queue.Activate ();
queue.DispatchAsync (db);
var rv = (int) db.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (5)));
- Assert.AreEqual (0, rv, "Timed Out " + flags);
- Assert.IsTrue (called, "Called " + flags);
+ Assert.That (rv, Is.EqualTo (0), "Timed Out " + flags);
+ Assert.That (called, Is.True, "Called " + flags);
}
}
@@ -292,8 +292,8 @@ public void Create ()
queue.Activate ();
queue.DispatchAsync (db);
var rv = (int) db.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (5)));
- Assert.AreEqual (0, rv, "Timed Out Background 8" + flags);
- Assert.IsTrue (called, "Called Background 8" + flags);
+ Assert.That (rv, Is.EqualTo (0), "Timed Out Background 8" + flags);
+ Assert.That (called, Is.True, "Called Background 8" + flags);
}
}
@@ -305,8 +305,8 @@ public void Create ()
queue.Activate ();
queue.DispatchAsync (db2);
var rv = (int) db2.Wait (new DispatchTime (DispatchTime.Now, TimeSpan.FromSeconds (5)));
- Assert.AreEqual (0, rv, "Timed Out Background DB" + flags);
- Assert.IsTrue (called, "Called Background DB" + flags);
+ Assert.That (rv, Is.EqualTo (0), "Timed Out Background DB" + flags);
+ Assert.That (called, Is.True, "Called Background DB" + flags);
}
}
}
diff --git a/tests/monotouch-test/CoreFoundation/DispatchDataTest.cs b/tests/monotouch-test/CoreFoundation/DispatchDataTest.cs
index 4e32da2464a9..0e34b7d05ac8 100644
--- a/tests/monotouch-test/CoreFoundation/DispatchDataTest.cs
+++ b/tests/monotouch-test/CoreFoundation/DispatchDataTest.cs
@@ -20,7 +20,7 @@ public void FromByteBufferTest ()
{
using (var dd = DispatchData.FromByteBuffer (testData)) {
var ddString = Encoding.UTF8.GetString (dd.ToArray ());
- Assert.AreEqual (testString, ddString);
+ Assert.That (ddString, Is.EqualTo (testString));
}
}
@@ -31,7 +31,7 @@ public void FromReadOnlySpanTest ()
using (var dd = DispatchData.FromReadOnlySpan (readOnlySpan)) {
var data = dd.ToArray ();
var ddString = Encoding.UTF8.GetString (dd.ToArray ());
- Assert.AreEqual (testString, ddString);
+ Assert.That (ddString, Is.EqualTo (testString));
}
}
diff --git a/tests/monotouch-test/CoreFoundation/DispatchGroupTest.cs b/tests/monotouch-test/CoreFoundation/DispatchGroupTest.cs
index 771e42661424..cee8f872f752 100644
--- a/tests/monotouch-test/CoreFoundation/DispatchGroupTest.cs
+++ b/tests/monotouch-test/CoreFoundation/DispatchGroupTest.cs
@@ -25,7 +25,7 @@ public void WaitTest ()
Console.WriteLine ("Inside dispatch");
});
- Assert.IsTrue (dg.Wait (DispatchTime.Forever));
+ Assert.That (dg.Wait (DispatchTime.Forever), Is.True);
dq.Dispose ();
}
}
@@ -35,9 +35,9 @@ public void EnterLeaveTest ()
{
using (var dg = DispatchGroup.Create ()) {
dg.Enter ();
- Assert.IsFalse (dg.Wait (new DispatchTime (1000 * 1000 * 1000)), "#1");
+ Assert.That (dg.Wait (new DispatchTime (1000 * 1000 * 1000)), Is.False, "#1");
dg.Leave ();
- Assert.IsTrue (dg.Wait (DispatchTime.Forever), "#2");
+ Assert.That (dg.Wait (DispatchTime.Forever), Is.True, "#2");
}
}
@@ -53,7 +53,7 @@ public void NotifyWithDispatchBlock ()
using (var block = new DispatchBlock (callback)) {
dg.Notify (DispatchQueue.MainQueue, block);
TestRuntime.RunAsync (TimeSpan.FromSeconds (5), () => { }, () => called);
- Assert.IsTrue (called, "Called");
+ Assert.That (called, Is.True, "Called");
}
}
}
@@ -66,7 +66,7 @@ public void NotifyWithAction ()
var callback = new Action (() => called = true);
dg.Notify (DispatchQueue.MainQueue, callback);
TestRuntime.RunAsync (TimeSpan.FromSeconds (5), () => { }, () => called);
- Assert.IsTrue (called, "Called");
+ Assert.That (called, Is.True, "Called");
}
}
}
diff --git a/tests/monotouch-test/CoreFoundation/DispatchQueueTest.cs b/tests/monotouch-test/CoreFoundation/DispatchQueueTest.cs
index 0565463f4668..9bacda8c29f5 100644
--- a/tests/monotouch-test/CoreFoundation/DispatchQueueTest.cs
+++ b/tests/monotouch-test/CoreFoundation/DispatchQueueTest.cs
@@ -30,21 +30,21 @@ public void CtorWithAttributes ()
using (var queue = new DispatchQueue ("1", new DispatchQueue.Attributes {
AutoreleaseFrequency = DispatchQueue.AutoreleaseFrequency.Inherit,
})) {
- Assert.AreNotEqual (IntPtr.Zero, queue.Handle, "Handle 1");
+ Assert.That (queue.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle 1");
}
using (var queue = new DispatchQueue ("2", new DispatchQueue.Attributes {
IsInitiallyInactive = true,
})) {
queue.Activate (); // must activate the queue before it can be released according to Apple's documentation
- Assert.AreNotEqual (IntPtr.Zero, queue.Handle, "Handle 2");
+ Assert.That (queue.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle 2");
}
using (var queue = new DispatchQueue ("3", new DispatchQueue.Attributes {
QualityOfService = DispatchQualityOfService.Utility,
})) {
- Assert.AreNotEqual (IntPtr.Zero, queue.Handle, "Handle 3");
- Assert.AreEqual (DispatchQualityOfService.Utility, queue.QualityOfService, "QualityOfService 3");
+ Assert.That (queue.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle 3");
+ Assert.That (queue.QualityOfService, Is.EqualTo (DispatchQualityOfService.Utility), "QualityOfService 3");
}
using (var target_queue = new DispatchQueue ("4 - target")) {
@@ -53,9 +53,9 @@ public void CtorWithAttributes ()
AutoreleaseFrequency = DispatchQueue.AutoreleaseFrequency.WorkItem,
RelativePriority = -1,
}, target_queue)) {
- Assert.AreNotEqual (IntPtr.Zero, queue.Handle, "Handle 4");
- Assert.AreEqual (DispatchQualityOfService.Background, queue.GetQualityOfService (out var relative_priority), "QualityOfService 4");
- Assert.AreEqual (-1, relative_priority, "RelativePriority 4");
+ Assert.That (queue.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle 4");
+ Assert.That (queue.GetQualityOfService (out var relative_priority), Is.EqualTo (DispatchQualityOfService.Background), "QualityOfService 4");
+ Assert.That (relative_priority, Is.EqualTo (-1), "RelativePriority 4");
}
}
}
@@ -66,7 +66,7 @@ public void Specific ()
using (var queue = new DispatchQueue ("Specific")) {
var key = (IntPtr) 0x31415926;
queue.SetSpecific (key, "hello world");
- Assert.AreEqual ("hello world", queue.GetSpecific (key), "Key");
+ Assert.That (queue.GetSpecific (key), Is.EqualTo ("hello world"), "Key");
}
}
@@ -80,12 +80,12 @@ public void DispatchSync ()
var called = false;
var callback = new Action (() => called = true);
queue.DispatchSync (callback);
- Assert.IsTrue (called, "Called");
+ Assert.That (called, Is.True, "Called");
called = false;
using (var dg = new DispatchBlock (callback))
queue.DispatchSync (dg);
- Assert.IsTrue (called, "Called DispatchBlock");
+ Assert.That (called, Is.True, "Called DispatchBlock");
}
}
@@ -99,12 +99,12 @@ public void DispatchBarrierSync ()
var called = false;
var callback = new Action (() => called = true);
queue.DispatchBarrierSync (callback);
- Assert.IsTrue (called, "Called");
+ Assert.That (called, Is.True, "Called");
called = false;
using (var dg = new DispatchBlock (callback))
queue.DispatchBarrierSync (dg);
- Assert.IsTrue (called, "Called DispatchBlock");
+ Assert.That (called, Is.True, "Called DispatchBlock");
}
}
@@ -120,7 +120,7 @@ public void DispatchAsync ()
var callback = new Action (() => called.SetResult (true));
queue.DispatchAsync (callback);
TestRuntime.RunAsync (TimeSpan.FromSeconds (5), called.Task);
- Assert.IsTrue (called.Task.Result, "Called");
+ Assert.That (called.Task.Result, Is.True, "Called");
}
{
var called = new TaskCompletionSource ();
@@ -129,7 +129,7 @@ public void DispatchAsync ()
queue.DispatchAsync (dg);
dg.Wait (TimeSpan.FromSeconds (5));
}
- Assert.IsTrue (called.Task.Result, "Called DispatchBlock");
+ Assert.That (called.Task.Result, Is.True, "Called DispatchBlock");
}
}
}
@@ -146,7 +146,7 @@ public void DispatchBarrierAsync ()
var callback = new Action (() => called.SetResult (true));
queue.DispatchBarrierAsync (callback);
TestRuntime.RunAsync (TimeSpan.FromSeconds (5), called.Task);
- Assert.IsTrue (called.Task.Result, "Called");
+ Assert.That (called.Task.Result, Is.True, "Called");
}
{
var called = new TaskCompletionSource ();
@@ -155,7 +155,7 @@ public void DispatchBarrierAsync ()
queue.DispatchBarrierAsync (dg);
dg.Wait (TimeSpan.FromSeconds (5));
}
- Assert.IsTrue (called.Task.Result, "Called DispatchBlock");
+ Assert.That (called.Task.Result, Is.True, "Called DispatchBlock");
}
}
}
@@ -163,7 +163,7 @@ public void DispatchBarrierAsync ()
[Test]
public void MainQueue ()
{
- Assert.AreEqual (DispatchQueue.CurrentQueue, DispatchQueue.MainQueue, "MainQueue");
+ Assert.That (DispatchQueue.MainQueue, Is.EqualTo (DispatchQueue.CurrentQueue), "MainQueue");
}
}
}
diff --git a/tests/monotouch-test/CoreFoundation/DispatchTests.cs b/tests/monotouch-test/CoreFoundation/DispatchTests.cs
index 8165af96b641..957a1ed98ffe 100644
--- a/tests/monotouch-test/CoreFoundation/DispatchTests.cs
+++ b/tests/monotouch-test/CoreFoundation/DispatchTests.cs
@@ -72,9 +72,9 @@ public void MainQueueDispatch ()
while (hit == false) {
NSRunLoop.Current.RunUntil (NSDate.FromTimeIntervalSinceNow (0.5));
}
- Assert.IsNotNull (ex, "main ex");
+ Assert.That (ex, Is.Not.Null, "main ex");
Assert.That (ex.GetType (), Is.SameAs (typeof (NullReferenceException)), "no thread check hit");
- Assert.IsNotNull (queue_ex, "queue ex");
+ Assert.That (queue_ex, Is.Not.Null, "queue ex");
Assert.That (queue_ex.GetType (), Is.SameAs (typeof (UIKitThreadAccessException)), "thread check hit");
Assert.That (uiThread, Is.EqualTo (mainQthread), "mainq thread is equal to uithread");
Assert.That (queueThread, Is.Not.EqualTo (mainQthread), "queueThread is not the same as the UI thread");
@@ -129,9 +129,9 @@ public void MainQueueDispatchQualityOfService ()
while (hit == false) {
NSRunLoop.Current.RunUntil (NSDate.FromTimeIntervalSinceNow (0.5));
}
- Assert.IsNotNull (ex, "main ex");
+ Assert.That (ex, Is.Not.Null, "main ex");
Assert.That (ex.GetType (), Is.SameAs (typeof (NullReferenceException)), "no thread check hit");
- Assert.IsNotNull (queue_ex, "queue ex");
+ Assert.That (queue_ex, Is.Not.Null, "queue ex");
Assert.That (queue_ex.GetType (), Is.SameAs (typeof (UIKitThreadAccessException)), "thread check hit");
Assert.That (uiThread, Is.EqualTo (mainQthread), "mainq thread is equal to uithread");
Assert.That (queueThread, Is.Not.EqualTo (mainQthread), "queueThread is not the same as the UI thread");
@@ -206,9 +206,9 @@ public void Main ()
public void GetGlobalQueue_Priority ()
{
// values changes in OS versions (and even in arch) but we only want to make sure we get a valid string so the prefix is enough
- Assert.True (DispatchQueue.GetGlobalQueue (DispatchQueuePriority.Default).Label.StartsWith ("com.apple.root."), "Default");
- Assert.True (DispatchQueue.GetGlobalQueue (DispatchQueuePriority.Low).Label.StartsWith ("com.apple.root."), "Low");
- Assert.True (DispatchQueue.GetGlobalQueue (DispatchQueuePriority.High).Label.StartsWith ("com.apple.root."), "High");
+ Assert.That (DispatchQueue.GetGlobalQueue (DispatchQueuePriority.Default).Label.StartsWith ("com.apple.root."), Is.True, "Default");
+ Assert.That (DispatchQueue.GetGlobalQueue (DispatchQueuePriority.Low).Label.StartsWith ("com.apple.root."), Is.True, "Low");
+ Assert.That (DispatchQueue.GetGlobalQueue (DispatchQueuePriority.High).Label.StartsWith ("com.apple.root."), Is.True, "High");
}
[Test]
@@ -217,9 +217,9 @@ public void GetGlobalQueue_QualityOfService ()
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
// values changes in OS versions (and even in arch) but we only want to make sure we get a valid string so the prefix is enough
- Assert.True (DispatchQueue.GetGlobalQueue (DispatchQualityOfService.Default).Label.StartsWith ("com.apple.root."), "Default");
- Assert.True (DispatchQueue.GetGlobalQueue (DispatchQualityOfService.Utility).Label.StartsWith ("com.apple.root."), "Low");
- Assert.True (DispatchQueue.GetGlobalQueue (DispatchQualityOfService.UserInitiated).Label.StartsWith ("com.apple.root."), "High");
+ Assert.That (DispatchQueue.GetGlobalQueue (DispatchQualityOfService.Default).Label.StartsWith ("com.apple.root."), Is.True, "Default");
+ Assert.That (DispatchQueue.GetGlobalQueue (DispatchQualityOfService.Utility).Label.StartsWith ("com.apple.root."), Is.True, "Low");
+ Assert.That (DispatchQueue.GetGlobalQueue (DispatchQualityOfService.UserInitiated).Label.StartsWith ("com.apple.root."), Is.True, "High");
}
[Test]
@@ -287,9 +287,9 @@ public void EverAfter ()
while (hit == false) {
NSRunLoop.Current.RunUntil (NSDate.FromTimeIntervalSinceNow (0.5));
}
- Assert.IsNotNull (ex, "main ex");
+ Assert.That (ex, Is.Not.Null, "main ex");
Assert.That (ex.GetType (), Is.SameAs (typeof (NullReferenceException)), "no thread check hit");
- Assert.IsNotNull (queue_ex, "queue ex");
+ Assert.That (queue_ex, Is.Not.Null, "queue ex");
Assert.That (queue_ex.GetType (), Is.SameAs (typeof (UIKitThreadAccessException)), "thread check hit");
Assert.That (uiThread, Is.EqualTo (mainQthread), "mainq thread is equal to uithread");
Assert.That (queueThread, Is.Not.EqualTo (mainQthread), "queueThread is not the same as the UI thread");
@@ -343,9 +343,9 @@ public void EverAfterQualityOfService ()
while (hit == false) {
NSRunLoop.Current.RunUntil (NSDate.FromTimeIntervalSinceNow (0.5));
}
- Assert.IsNotNull (ex, "main ex");
+ Assert.That (ex, Is.Not.Null, "main ex");
Assert.That (ex.GetType (), Is.SameAs (typeof (NullReferenceException)), "no thread check hit");
- Assert.IsNotNull (queue_ex, "queue ex");
+ Assert.That (queue_ex, Is.Not.Null, "queue ex");
Assert.That (queue_ex.GetType (), Is.SameAs (typeof (UIKitThreadAccessException)), "thread check hit");
Assert.That (uiThread, Is.EqualTo (mainQthread), "mainq thread is equal to uithread");
Assert.That (queueThread, Is.Not.EqualTo (mainQthread), "queueThread is not the same as the UI thread");
diff --git a/tests/monotouch-test/CoreFoundation/MutableString.cs b/tests/monotouch-test/CoreFoundation/MutableString.cs
index 5883b9e37b69..658fb35abb80 100644
--- a/tests/monotouch-test/CoreFoundation/MutableString.cs
+++ b/tests/monotouch-test/CoreFoundation/MutableString.cs
@@ -93,10 +93,10 @@ public void AppendString_RtL ()
public void TransformNoRangeEnum ()
{
using (var s = new CFMutableString ("Bonjour à tous!")) {
- Assert.True (s.Transform (CFStringTransform.ToXmlHex, false), "Transform-1");
+ Assert.That (s.Transform (CFStringTransform.ToXmlHex, false), Is.True, "Transform-1");
Assert.That (s.ToString (), Is.EqualTo ("Bonjour à tous!"), "ToString-1");
- Assert.True (s.Transform (CFStringTransform.ToXmlHex, true), "Transform-2");
+ Assert.That (s.Transform (CFStringTransform.ToXmlHex, true), Is.True, "Transform-2");
Assert.That (s.ToString (), Is.EqualTo ("Bonjour à tous!"), "ToString-2");
}
}
@@ -120,11 +120,11 @@ public void TransformRangeEnum ()
{
var r = new CFRange (0, 15);
using (var s = new CFMutableString ("Bonjour à tous!")) {
- Assert.True (s.Transform (ref r, CFStringTransform.ToXmlHex, false), "Transform-1");
+ Assert.That (s.Transform (ref r, CFStringTransform.ToXmlHex, false), Is.True, "Transform-1");
Assert.That (s.ToString (), Is.EqualTo ("Bonjour à tous!"), "ToString-1");
Assert.That (r.Length, Is.EqualTo (20), "Length-1");
- Assert.True (s.Transform (ref r, CFStringTransform.ToXmlHex, true), "Transform-2");
+ Assert.That (s.Transform (ref r, CFStringTransform.ToXmlHex, true), Is.True, "Transform-2");
Assert.That (s.ToString (), Is.EqualTo ("Bonjour à tous!"), "ToString-2");
Assert.That (r.Length, Is.EqualTo (15), "Length-2");
}
@@ -134,10 +134,10 @@ public void TransformRangeEnum ()
public void TransformICU ()
{
using (var s = new CFMutableString ("hello world")) {
- Assert.True (s.Transform ("Title", false), "Transform-1");
+ Assert.That (s.Transform ("Title", false), Is.True, "Transform-1");
Assert.That (s.ToString (), Is.EqualTo ("Hello World"), "ToString-1");
- Assert.True (s.Transform ((NSString) "Title", true), "Transform-2");
+ Assert.That (s.Transform ((NSString) "Title", true), Is.True, "Transform-2");
Assert.That (s.ToString (), Is.EqualTo ("hello world"), "ToString-2");
}
}
diff --git a/tests/monotouch-test/CoreFoundation/NativeObjectTest.cs b/tests/monotouch-test/CoreFoundation/NativeObjectTest.cs
index 42df872e372c..26e382a7bfbd 100644
--- a/tests/monotouch-test/CoreFoundation/NativeObjectTest.cs
+++ b/tests/monotouch-test/CoreFoundation/NativeObjectTest.cs
@@ -116,13 +116,13 @@ public void Equals ()
{
// overriden Equals with weird behavior to confirm it can't be anything else
using (var x = new FakeNativeObject ((IntPtr) 42, true)) {
- Assert.False (x.Equals (x), "self");
- Assert.True (x.Equals (null), "null");
+ Assert.That (x.Equals (x), Is.False, "self");
+ Assert.That (x.Equals (null), Is.True, "null");
}
// check that equality is based on handle only (and not System.Object.Equals)
using (var n1 = new NativeObjectPoker ((IntPtr) 42))
using (var n2 = new NativeObjectPoker ((IntPtr) 42))
- Assert.True (n1.Equals (n2), "1");
+ Assert.That (n1.Equals (n2), Is.True, "1");
}
[Test]
@@ -135,8 +135,8 @@ public void GetHashCodeValue ()
// check that only the handle is used to compute the hash code of the selector
// which means DisposableObject base implementation (not System.Object) is used
using (var n = new NativeObjectPoker ((IntPtr) 42)) {
- Assert.AreNotEqual (n.GetHashCode (), RuntimeHelpers.GetHashCode (n), "GetHashCode-old");
- Assert.AreEqual (n.GetHashCode (), n.Handle.GetHashCode (), "GetHashCode-net");
+ Assert.That (RuntimeHelpers.GetHashCode (n), Is.Not.EqualTo (n.GetHashCode ()), "GetHashCode-old");
+ Assert.That (n.Handle.GetHashCode (), Is.EqualTo (n.GetHashCode ()), "GetHashCode-net");
}
}
}
diff --git a/tests/monotouch-test/CoreFoundation/NetworkTest.cs b/tests/monotouch-test/CoreFoundation/NetworkTest.cs
index a02509ac2c32..42c18d52d3fc 100644
--- a/tests/monotouch-test/CoreFoundation/NetworkTest.cs
+++ b/tests/monotouch-test/CoreFoundation/NetworkTest.cs
@@ -31,7 +31,7 @@ public class NetworkTest {
public void WebProxy ()
{
IWebProxy proxy = PlatformCFNetwork.GetDefaultProxy ();
- Assert.True (proxy.IsBypassed (uri), "IsBypassed");
+ Assert.That (proxy.IsBypassed (uri), Is.True, "IsBypassed");
Assert.That (proxy.GetProxy (uri), Is.SameAs (uri), "GetProxy");
}
@@ -41,13 +41,13 @@ public void GetProxiesForUri ()
var proxies = PlatformCFNetwork.GetProxiesForUri (uri, settings);
Assert.That (proxies.Length, Is.EqualTo (1), "single");
var p = proxies [0];
- Assert.Null (p.AutoConfigurationJavaScript, "AutoConfigurationJavaScript");
- Assert.Null (p.AutoConfigurationUrl, "AutoConfigurationUrl");
- Assert.Null (p.HostName, "HostName");
+ Assert.That (p.AutoConfigurationJavaScript, Is.Null, "AutoConfigurationJavaScript");
+ Assert.That (p.AutoConfigurationUrl, Is.Null, "AutoConfigurationUrl");
+ Assert.That (p.HostName, Is.Null, "HostName");
Assert.That (p.Port, Is.EqualTo (0), "Port");
- Assert.Null (p.Password, "Password");
+ Assert.That (p.Password, Is.Null, "Password");
Assert.That (p.ProxyType, Is.EqualTo (CFProxyType.None), "Type");
- Assert.Null (p.Username, "Username");
+ Assert.That (p.Username, Is.Null, "Username");
}
[Test]
diff --git a/tests/monotouch-test/CoreFoundation/NotificationCenterTest.cs b/tests/monotouch-test/CoreFoundation/NotificationCenterTest.cs
index 32842b0f7a71..e9c90453931b 100644
--- a/tests/monotouch-test/CoreFoundation/NotificationCenterTest.cs
+++ b/tests/monotouch-test/CoreFoundation/NotificationCenterTest.cs
@@ -16,8 +16,8 @@ public class NotificationCenterTest {
[Test]
public void Static ()
{
- Assert.NotNull (CFNotificationCenter.Darwin, "Darwin");
- Assert.NotNull (CFNotificationCenter.Local, "Local");
+ Assert.That (CFNotificationCenter.Darwin, Is.Not.Null, "Darwin");
+ Assert.That (CFNotificationCenter.Local, Is.Not.Null, "Local");
}
}
}
diff --git a/tests/monotouch-test/CoreFoundation/PropertyListTests.cs b/tests/monotouch-test/CoreFoundation/PropertyListTests.cs
index 2de0479afe5c..3013bde7e755 100644
--- a/tests/monotouch-test/CoreFoundation/PropertyListTests.cs
+++ b/tests/monotouch-test/CoreFoundation/PropertyListTests.cs
@@ -32,12 +32,12 @@ public void CreateFromData ()
";
var rv = CFPropertyList.FromData (NSData.FromString (plist));
- Assert.IsNull (rv.Error, "Error 1");
- Assert.IsNotNull (rv.PropertyList, "PropertyList 1");
- Assert.AreEqual (CFPropertyListFormat.XmlFormat1, rv.Format, "Format 1");
- Assert.IsTrue (rv.PropertyList.IsValid (CFPropertyListFormat.BinaryFormat1), "IsValid Binary 1");
- Assert.IsTrue (rv.PropertyList.IsValid (CFPropertyListFormat.OpenStep), "IsValid OpenStep 1");
- Assert.IsTrue (rv.PropertyList.IsValid (CFPropertyListFormat.XmlFormat1), "IsValid Xml 1");
+ Assert.That (rv.Error, Is.Null, "Error 1");
+ Assert.That (rv.PropertyList, Is.Not.Null, "PropertyList 1");
+ Assert.That (rv.Format, Is.EqualTo (CFPropertyListFormat.XmlFormat1), "Format 1");
+ Assert.That (rv.PropertyList.IsValid (CFPropertyListFormat.BinaryFormat1), Is.True, "IsValid Binary 1");
+ Assert.That (rv.PropertyList.IsValid (CFPropertyListFormat.OpenStep), Is.True, "IsValid OpenStep 1");
+ Assert.That (rv.PropertyList.IsValid (CFPropertyListFormat.XmlFormat1), Is.True, "IsValid Xml 1");
}
[Test]
@@ -46,16 +46,16 @@ public void Constructors ()
using (var dummy = CreateDummy ()) {
var rc = CFGetRetainCount (dummy.Handle);
using (var clone = Runtime.GetINativeObject (dummy.Handle, false)) {
- Assert.AreEqual (clone.Handle, dummy.Handle, "Handle 1");
- Assert.AreEqual (rc + 1, CFGetRetainCount (clone.Handle), "RC 1");
+ Assert.That (dummy.Handle, Is.EqualTo (clone.Handle), "Handle 1");
+ Assert.That (CFGetRetainCount (clone.Handle), Is.EqualTo (rc + 1), "RC 1");
}
}
using (var dummy = CreateDummy ()) {
var rc = CFGetRetainCount (dummy.Handle);
using (var clone = Runtime.GetINativeObject (dummy.Handle, false)) {
- Assert.AreEqual (clone.Handle, dummy.Handle, "Handle 2");
- Assert.AreEqual (rc + 1, CFGetRetainCount (clone.Handle), "RC 2");
+ Assert.That (dummy.Handle, Is.EqualTo (clone.Handle), "Handle 2");
+ Assert.That (CFGetRetainCount (clone.Handle), Is.EqualTo (rc + 1), "RC 2");
}
}
@@ -63,8 +63,8 @@ public void Constructors ()
CFRetain (dummy.Handle);
var rc = CFGetRetainCount (dummy.Handle);
using (var clone = Runtime.GetINativeObject (dummy.Handle, true)) {
- Assert.AreEqual (clone.Handle, dummy.Handle, "Handle 3");
- Assert.AreEqual (rc, CFGetRetainCount (clone.Handle), "RC 3");
+ Assert.That (dummy.Handle, Is.EqualTo (clone.Handle), "Handle 3");
+ Assert.That (CFGetRetainCount (clone.Handle), Is.EqualTo (rc), "RC 3");
}
}
}
@@ -74,8 +74,8 @@ public void DeepCopy ()
{
using (var dummy = CreateDummy ()) {
using (var clone = dummy.DeepCopy ()) {
- Assert.AreNotEqual (dummy.Handle, clone.Handle, "Handle");
- Assert.AreEqual (dummy.Value.ToString (), clone.Value.ToString (), "Value comparison");
+ Assert.That (clone.Handle, Is.Not.EqualTo (dummy.Handle), "Handle");
+ Assert.That (clone.Value.ToString (), Is.EqualTo (dummy.Value.ToString ()), "Value comparison");
}
}
}
@@ -85,8 +85,8 @@ public void AsData ()
{
using (var dummy = CreateDummy ()) {
var data = dummy.AsData (CFPropertyListFormat.XmlFormat1);
- Assert.IsNull (data.Error, "Error");
- Assert.IsNotNull (data.Data, "Data");
+ Assert.That (data.Error, Is.Null, "Error");
+ Assert.That (data.Data, Is.Not.Null, "Data");
Assert.That (new StreamReader (data.Data.AsStream ()).ReadToEnd (), Does.StartWith ("SomeStringArrayValue")) {
var value = dummy.Value;
- Assert.AreEqual (typeof (NSMutableArray), value.GetType (), "Array Value Type");
+ Assert.That (value.GetType (), Is.EqualTo (typeof (NSMutableArray)), "Array Value Type");
var arr = (NSArray) value;
- Assert.AreEqual ((nuint) 1, arr.Count, "Array Count");
- Assert.AreEqual ("SomeStringArrayValue", arr.GetItem (0).ToString (), "Array First Value");
+ Assert.That (arr.Count, Is.EqualTo ((nuint) 1), "Array Count");
+ Assert.That (arr.GetItem (0).ToString (), Is.EqualTo ("SomeStringArrayValue"), "Array First Value");
}
using (var dummy = CreateDummy ("U29tZURhdGFWYWx1ZQ==")) {
var value = dummy.Value;
- Assert.AreEqual (typeof (NSMutableData), value.GetType (), "Data Value Type");
- Assert.AreEqual ("SomeDataValue", new StreamReader (((NSData) value).AsStream ()).ReadToEnd (), "Data Value");
+ Assert.That (value.GetType (), Is.EqualTo (typeof (NSMutableData)), "Data Value Type");
+ Assert.That (new StreamReader (((NSData) value).AsStream ()).ReadToEnd (), Is.EqualTo ("SomeDataValue"), "Data Value");
}
using (var dummy = CreateDummy ("SomeKeySomeStringValue")) {
var value = dummy.Value;
- Assert.AreEqual (typeof (NSMutableDictionary), value.GetType (), "Dictionary Value Type");
+ Assert.That (value.GetType (), Is.EqualTo (typeof (NSMutableDictionary)), "Dictionary Value Type");
var dict = (NSDictionary) value;
- Assert.AreEqual ((nuint) 1, dict.Count, "Dictionary Count");
- Assert.AreEqual ("SomeKey", dict.Keys [0].ToString (), "Dictionary Key Value");
- Assert.AreEqual ("SomeStringValue", dict ["SomeKey"].ToString (), "Dictionary Entry Value");
+ Assert.That (dict.Count, Is.EqualTo ((nuint) 1), "Dictionary Count");
+ Assert.That (dict.Keys [0].ToString (), Is.EqualTo ("SomeKey"), "Dictionary Key Value");
+ Assert.That (dict ["SomeKey"].ToString (), Is.EqualTo ("SomeStringValue"), "Dictionary Entry Value");
}
using (var dummy = CreateDummy ("SomeStringValue")) {
var value = dummy.Value;
- Assert.AreEqual (typeof (NSMutableString), value.GetType (), "String Value Type");
- Assert.AreEqual ("SomeStringValue", ((NSString) value).ToString (), "String Value");
+ Assert.That (value.GetType (), Is.EqualTo (typeof (NSMutableString)), "String Value Type");
+ Assert.That (((NSString) value).ToString (), Is.EqualTo ("SomeStringValue"), "String Value");
}
using (var dummy = CreateDummy ("2018-08-01T01:00:00Z")) {
var value = dummy.Value;
- Assert.AreEqual (typeof (NSDate), value.GetType (), "Date Value Type");
+ Assert.That (value.GetType (), Is.EqualTo (typeof (NSDate)), "Date Value Type");
var date = (NSDate) value;
- Assert.AreEqual (554778000.0, date.SecondsSinceReferenceDate, "Date Value");
+ Assert.That (date.SecondsSinceReferenceDate, Is.EqualTo (554778000.0), "Date Value");
}
using (var dummy = CreateDummy ("42")) {
var value = dummy.Value;
- Assert.AreEqual (typeof (NSNumber), value.GetType (), "Int Value Type");
- Assert.AreEqual (42, ((NSNumber) value).Int32Value, "Int Value");
+ Assert.That (value.GetType (), Is.EqualTo (typeof (NSNumber)), "Int Value Type");
+ Assert.That (((NSNumber) value).Int32Value, Is.EqualTo (42), "Int Value");
}
using (var dummy = CreateDummy ($"{long.MaxValue}")) {
var value = dummy.Value;
- Assert.AreEqual (typeof (NSNumber), value.GetType (), "Long Value Type");
- Assert.AreEqual (long.MaxValue, ((NSNumber) value).Int64Value, "Long Value");
+ Assert.That (value.GetType (), Is.EqualTo (typeof (NSNumber)), "Long Value Type");
+ Assert.That (((NSNumber) value).Int64Value, Is.EqualTo (long.MaxValue), "Long Value");
}
using (var dummy = CreateDummy ($"3.1415926")) {
var value = dummy.Value;
- Assert.AreEqual (typeof (NSNumber), value.GetType (), "Real Value Type");
- Assert.AreEqual (3.1415926, ((NSNumber) value).FloatValue, 0.001, "Real PI Value");
+ Assert.That (value.GetType (), Is.EqualTo (typeof (NSNumber)), "Real Value Type");
+ Assert.That (((NSNumber) value).FloatValue, Is.EqualTo (3.1415926).Within (0.001), "Real PI Value");
}
using (var dummy = CreateDummy ($"")) {
var value = dummy.Value;
- Assert.AreEqual (typeof (bool), value.GetType (), "Bool True Value Type");
- Assert.AreEqual (true, (bool) value, "Bool True Value");
+ Assert.That (value.GetType (), Is.EqualTo (typeof (bool)), "Bool True Value Type");
+ Assert.That ((bool) value, Is.EqualTo (true), "Bool True Value");
}
using (var dummy = CreateDummy ($"")) {
var value = dummy.Value;
- Assert.AreEqual (typeof (bool), value.GetType (), "Bool True Value Type");
- Assert.AreEqual (false, (bool) value, "Bool True Value");
+ Assert.That (value.GetType (), Is.EqualTo (typeof (bool)), "Bool True Value Type");
+ Assert.That ((bool) value, Is.EqualTo (false), "Bool True Value");
}
}
@@ -180,7 +180,7 @@ CFPropertyList CreateDummy (string data = "SomeKeySomeS
{data}
";
var dummy = CFPropertyList.FromData (NSData.FromString (plist));
- Assert.IsNull (dummy.Error, "Dummy Error");
+ Assert.That (dummy.Error, Is.Null, "Dummy Error");
return dummy.PropertyList;
}
}
diff --git a/tests/monotouch-test/CoreFoundation/ProxyTest.cs b/tests/monotouch-test/CoreFoundation/ProxyTest.cs
index 3dc46ece6d40..3bd156d05b2e 100644
--- a/tests/monotouch-test/CoreFoundation/ProxyTest.cs
+++ b/tests/monotouch-test/CoreFoundation/ProxyTest.cs
@@ -102,10 +102,10 @@ public void TestPACParsingScript ()
var script = File.ReadAllText (pacPath);
var targetUri = NetworkResources.XamarinUri;
var proxies = global::CoreFoundation.CFNetwork.ExecuteProxyAutoConfigurationScript (script, targetUri, out error);
- Assert.IsNull (error, "Null error");
- Assert.AreEqual (1, proxies.Length, "Length");
+ Assert.That (error, Is.Null, "Null error");
+ Assert.That (proxies.Length, Is.EqualTo (1), "Length");
// assert the data of the proxy, although we are really testing the js used
- Assert.AreEqual (8080, proxies [0].Port, "Port");
+ Assert.That (proxies [0].Port, Is.EqualTo (8080), "Port");
}
[Test]
@@ -116,10 +116,10 @@ public void TestPACParsingScriptNoProxy ()
var script = File.ReadAllText (pacPath);
var targetUri = NetworkResources.MicrosoftUri;
var proxies = global::CoreFoundation.CFNetwork.ExecuteProxyAutoConfigurationScript (script, targetUri, out error);
- Assert.IsNull (error, "Null error");
- Assert.IsNotNull (proxies, "Not null proxies");
- Assert.AreEqual (1, proxies.Length, "Proxies length");
- Assert.AreEqual (CFProxyType.None, proxies [0].ProxyType);
+ Assert.That (error, Is.Null, "Null error");
+ Assert.That (proxies, Is.Not.Null, "Not null proxies");
+ Assert.That (proxies.Length, Is.EqualTo (1), "Proxies length");
+ Assert.That (proxies [0].ProxyType, Is.EqualTo (CFProxyType.None));
}
[Test]
@@ -129,8 +129,8 @@ public void TestPACParsingScriptError ()
var script = "Not VALID js";
var targetUri = NetworkResources.MicrosoftUri;
var proxies = global::CoreFoundation.CFNetwork.ExecuteProxyAutoConfigurationScript (script, targetUri, out error);
- Assert.IsNotNull (error, "Not null error");
- Assert.IsNull (proxies, "Null proxies");
+ Assert.That (error, Is.Not.Null, "Not null error");
+ Assert.That (proxies, Is.Null, "Null proxies");
}
[Test]
@@ -160,12 +160,12 @@ public void TestPACParsingAsync ()
done = true;
}
}, () => done);
- Assert.IsNull (cbClient, "Null client");
- Assert.IsNull (error, "Null error");
- Assert.IsNotNull (proxies, "Not null proxies");
- Assert.AreEqual (1, proxies.Length, "Length");
+ Assert.That (cbClient, Is.Null, "Null client");
+ Assert.That (error, Is.Null, "Null error");
+ Assert.That (proxies, Is.Not.Null, "Not null proxies");
+ Assert.That (proxies.Length, Is.EqualTo (1), "Length");
// assert the data of the proxy, although we are really testing the js used
- Assert.AreEqual (8080, proxies [0].Port, "Port");
+ Assert.That (proxies [0].Port, Is.EqualTo (8080), "Port");
}
[Test]
@@ -197,11 +197,11 @@ public void TestPACParsingAsyncNoProxy ()
done = true;
}
}, () => done);
- Assert.IsNull (cbClient, "Null client");
- Assert.IsNull (error, "Null error");
- Assert.IsNotNull (proxies, "Not null proxies");
- Assert.AreEqual (1, proxies.Length, "Proxies length");
- Assert.AreEqual (CFProxyType.None, proxies [0].ProxyType);
+ Assert.That (cbClient, Is.Null, "Null client");
+ Assert.That (error, Is.Null, "Null error");
+ Assert.That (proxies, Is.Not.Null, "Not null proxies");
+ Assert.That (proxies.Length, Is.EqualTo (1), "Proxies length");
+ Assert.That (proxies [0].ProxyType, Is.EqualTo (CFProxyType.None));
}
[Test]
@@ -211,10 +211,10 @@ public void TestPACParsingUrl ()
var pacUri = new Uri ($"http://localhost:{port}/example.pac");
var targetUri = NetworkResources.XamarinUri;
var proxies = global::CoreFoundation.CFNetwork.ExecuteProxyAutoConfigurationUrl (pacUri, targetUri, out error);
- Assert.IsNull (error, "Null error");
- Assert.AreEqual (1, proxies.Length, "Length");
+ Assert.That (error, Is.Null, "Null error");
+ Assert.That (proxies.Length, Is.EqualTo (1), "Length");
// assert the data of the proxy, although we are really testing the js used
- Assert.AreEqual (8080, proxies [0].Port, "Port");
+ Assert.That (proxies [0].Port, Is.EqualTo (8080), "Port");
}
[Test]
@@ -224,10 +224,10 @@ public void TestPacParsingUrlNoProxy ()
var pacUri = new Uri ($"http://localhost:{port}/example.pac");
var targetUri = NetworkResources.MicrosoftUri;
var proxies = global::CoreFoundation.CFNetwork.ExecuteProxyAutoConfigurationUrl (pacUri, targetUri, out error);
- Assert.IsNull (error, "Null error");
- Assert.IsNotNull (proxies, "Not null proxies");
- Assert.AreEqual (1, proxies.Length, "Proxies length");
- Assert.AreEqual (CFProxyType.None, proxies [0].ProxyType);
+ Assert.That (error, Is.Null, "Null error");
+ Assert.That (proxies, Is.Not.Null, "Not null proxies");
+ Assert.That (proxies.Length, Is.EqualTo (1), "Proxies length");
+ Assert.That (proxies [0].ProxyType, Is.EqualTo (CFProxyType.None));
}
[Test]
@@ -255,12 +255,12 @@ public void TestPACParsingUrlAsync ()
done = true;
}
}, () => done);
- Assert.IsNull (cbClient, "Null client");
- Assert.IsNull (error, "Null error");
- Assert.IsNotNull (proxies, "Not null proxies");
- Assert.AreEqual (1, proxies.Length, "Length");
+ Assert.That (cbClient, Is.Null, "Null client");
+ Assert.That (error, Is.Null, "Null error");
+ Assert.That (proxies, Is.Not.Null, "Not null proxies");
+ Assert.That (proxies.Length, Is.EqualTo (1), "Length");
// assert the data of the proxy, although we are really testing the js used
- Assert.AreEqual (8080, proxies [0].Port, "Port");
+ Assert.That (proxies [0].Port, Is.EqualTo (8080), "Port");
}
[Test]
@@ -289,11 +289,11 @@ public void TestPACParsingUrlAsyncNoProxy ()
done = true;
}
}, () => done);
- Assert.IsNull (cbClient, "Null client");
- Assert.IsNull (error, "Null error");
- Assert.IsNotNull (proxies, "Not null proxies");
- Assert.AreEqual (1, proxies.Length, "Proxies length");
- Assert.AreEqual (CFProxyType.None, proxies [0].ProxyType);
+ Assert.That (cbClient, Is.Null, "Null client");
+ Assert.That (error, Is.Null, "Null error");
+ Assert.That (proxies, Is.Not.Null, "Not null proxies");
+ Assert.That (proxies.Length, Is.EqualTo (1), "Proxies length");
+ Assert.That (proxies [0].ProxyType, Is.EqualTo (CFProxyType.None));
}
#endif
}
diff --git a/tests/monotouch-test/CoreFoundation/SocketTest.cs b/tests/monotouch-test/CoreFoundation/SocketTest.cs
index 055a17b56f56..2e4a7c6cbb90 100644
--- a/tests/monotouch-test/CoreFoundation/SocketTest.cs
+++ b/tests/monotouch-test/CoreFoundation/SocketTest.cs
@@ -30,9 +30,9 @@ public void RetainCount ()
receiver.DataEvent += (o, a) => {
var data = a.Data;
- Assert.AreEqual (dataToSend.Length, data.Length);
+ Assert.That (data.Length, Is.EqualTo (dataToSend.Length));
for (int i = 0; i < data.Length; ++i)
- Assert.AreEqual (dataToSend [i], data [i]);
+ Assert.That (data [i], Is.EqualTo (dataToSend [i]));
received.Set ();
};
@@ -79,9 +79,9 @@ public void Collected ()
receiver.SetAddress (IPAddress.Loopback, 0);
receiver.DataEvent += (o, a) => {
var data = a.Data;
- Assert.AreEqual (dataToSend.Length, data.Length);
+ Assert.That (data.Length, Is.EqualTo (dataToSend.Length));
for (int i = 0; i < data.Length; ++i)
- Assert.AreEqual (dataToSend [i], data [i]);
+ Assert.That (data [i], Is.EqualTo (dataToSend [i]));
received.Set ();
};
@@ -106,8 +106,8 @@ public void Collected ()
};
thread.Start ();
- Assert.IsTrue (thread.Join (TimeSpan.FromSeconds (socketCount * 2)), "Completed");
- Assert.IsNull (ex, "No exceptions");
+ Assert.That (thread.Join (TimeSpan.FromSeconds (socketCount * 2)), Is.True, "Completed");
+ Assert.That (ex, Is.Null, "No exceptions");
GC.Collect ();
GC.WaitForPendingFinalizers ();
GC.Collect ();
diff --git a/tests/monotouch-test/CoreFoundation/StringTest.cs b/tests/monotouch-test/CoreFoundation/StringTest.cs
index 6a10688c42f2..885152896f7c 100644
--- a/tests/monotouch-test/CoreFoundation/StringTest.cs
+++ b/tests/monotouch-test/CoreFoundation/StringTest.cs
@@ -34,7 +34,7 @@ public void Index ()
using var nativeStr = new CFString (str);
var array = str.ToCharArray ();
for (int i = 0; i < array.Length; i++) {
- Assert.AreEqual (str [i], nativeStr [i], $"{str [i]} != {nativeStr [i]}");
+ Assert.That (nativeStr [i], Is.EqualTo (str [i]), $"{str [i]} != {nativeStr [i]}");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/AffineTransformTest.cs b/tests/monotouch-test/CoreGraphics/AffineTransformTest.cs
index e16da0416ac7..fc01d11ddb80 100644
--- a/tests/monotouch-test/CoreGraphics/AffineTransformTest.cs
+++ b/tests/monotouch-test/CoreGraphics/AffineTransformTest.cs
@@ -19,20 +19,20 @@ public class AffineTransformTest {
public void Ctor ()
{
var transform = new CGAffineTransform ();
- Assert.AreEqual ((nfloat) 0, transform.A);
- Assert.AreEqual ((nfloat) 0, transform.B);
- Assert.AreEqual ((nfloat) 0, transform.C);
- Assert.AreEqual ((nfloat) 0, transform.D);
- Assert.AreEqual ((nfloat) 0, transform.Tx);
- Assert.AreEqual ((nfloat) 0, transform.Ty);
+ Assert.That (transform.A, Is.EqualTo ((nfloat) 0));
+ Assert.That (transform.B, Is.EqualTo ((nfloat) 0));
+ Assert.That (transform.C, Is.EqualTo ((nfloat) 0));
+ Assert.That (transform.D, Is.EqualTo ((nfloat) 0));
+ Assert.That (transform.Tx, Is.EqualTo ((nfloat) 0));
+ Assert.That (transform.Ty, Is.EqualTo ((nfloat) 0));
transform = new CGAffineTransform (1, 2, 3, 4, 5, 6);
- Assert.AreEqual ((nfloat) 1, transform.A);
- Assert.AreEqual ((nfloat) 2, transform.B);
- Assert.AreEqual ((nfloat) 3, transform.C);
- Assert.AreEqual ((nfloat) 4, transform.D);
- Assert.AreEqual ((nfloat) 5, transform.Tx);
- Assert.AreEqual ((nfloat) 6, transform.Ty);
+ Assert.That (transform.A, Is.EqualTo ((nfloat) 1));
+ Assert.That (transform.B, Is.EqualTo ((nfloat) 2));
+ Assert.That (transform.C, Is.EqualTo ((nfloat) 3));
+ Assert.That (transform.D, Is.EqualTo ((nfloat) 4));
+ Assert.That (transform.Tx, Is.EqualTo ((nfloat) 5));
+ Assert.That (transform.Ty, Is.EqualTo ((nfloat) 6));
}
[Test]
@@ -40,14 +40,14 @@ public void MakeIdentity ()
{
var transform = CGAffineTransform.MakeIdentity ();
- Assert.AreEqual ((nfloat) 1, transform.A, "A");
- Assert.AreEqual ((nfloat) 0, transform.B, "B");
- Assert.AreEqual ((nfloat) 0, transform.C, "C");
- Assert.AreEqual ((nfloat) 1, transform.D, "D");
- Assert.AreEqual ((nfloat) 0, transform.Tx, "Tx");
- Assert.AreEqual ((nfloat) 0, transform.Ty, "Ty");
+ Assert.That (transform.A, Is.EqualTo ((nfloat) 1), "A");
+ Assert.That (transform.B, Is.EqualTo ((nfloat) 0), "B");
+ Assert.That (transform.C, Is.EqualTo ((nfloat) 0), "C");
+ Assert.That (transform.D, Is.EqualTo ((nfloat) 1), "D");
+ Assert.That (transform.Tx, Is.EqualTo ((nfloat) 0), "Tx");
+ Assert.That (transform.Ty, Is.EqualTo ((nfloat) 0), "Ty");
- Assert.IsTrue (transform.IsIdentity, "identity");
+ Assert.That (transform.IsIdentity, Is.True, "identity");
}
[Test]
@@ -55,10 +55,10 @@ public void MakeRotation ()
{
var transform = CGAffineTransform.MakeRotation ((nfloat) Math.PI);
- Assert.AreEqual ((nfloat) (-1), transform.A, "A");
+ Assert.That (transform.A, Is.EqualTo ((nfloat) (-1)), "A");
Assert.That ((double) 0, Is.EqualTo ((double) transform.B).Within (0.0000001), "B");
Assert.That ((double) 0, Is.EqualTo ((double) transform.C).Within (0.0000001), "C");
- Assert.AreEqual ((nfloat) (-1), transform.D, "D");
+ Assert.That (transform.D, Is.EqualTo ((nfloat) (-1)), "D");
Assert.That ((double) 0, Is.EqualTo ((double) transform.Tx).Within (0.0000001), "Tx");
Assert.That ((double) 0, Is.EqualTo ((double) transform.Ty).Within (0.0000001), "Ty");
}
@@ -67,12 +67,12 @@ public void MakeRotation ()
public void MakeScale ()
{
var transform = CGAffineTransform.MakeScale (314, 413);
- Assert.AreEqual ((nfloat) 314, transform.A);
- Assert.AreEqual ((nfloat) 0, transform.B);
- Assert.AreEqual ((nfloat) 0, transform.C);
- Assert.AreEqual ((nfloat) 413, transform.D);
- Assert.AreEqual ((nfloat) 0, transform.Tx);
- Assert.AreEqual ((nfloat) 0, transform.Ty);
+ Assert.That (transform.A, Is.EqualTo ((nfloat) 314));
+ Assert.That (transform.B, Is.EqualTo ((nfloat) 0));
+ Assert.That (transform.C, Is.EqualTo ((nfloat) 0));
+ Assert.That (transform.D, Is.EqualTo ((nfloat) 413));
+ Assert.That (transform.Tx, Is.EqualTo ((nfloat) 0));
+ Assert.That (transform.Ty, Is.EqualTo ((nfloat) 0));
}
[Test]
@@ -80,12 +80,12 @@ public void MakeTranslation ()
{
var transform = CGAffineTransform.MakeTranslation (12, 23);
- Assert.AreEqual ((nfloat) 1, transform.A, "A");
- Assert.AreEqual ((nfloat) 0, transform.B, "B");
- Assert.AreEqual ((nfloat) 0, transform.C, "C");
- Assert.AreEqual ((nfloat) 1, transform.D, "D");
- Assert.AreEqual ((nfloat) 12, transform.Tx, "Tx");
- Assert.AreEqual ((nfloat) 23, transform.Ty, "Ty");
+ Assert.That (transform.A, Is.EqualTo ((nfloat) 1), "A");
+ Assert.That (transform.B, Is.EqualTo ((nfloat) 0), "B");
+ Assert.That (transform.C, Is.EqualTo ((nfloat) 0), "C");
+ Assert.That (transform.D, Is.EqualTo ((nfloat) 1), "D");
+ Assert.That (transform.Tx, Is.EqualTo ((nfloat) 12), "Tx");
+ Assert.That (transform.Ty, Is.EqualTo ((nfloat) 23), "Ty");
}
[Test]
@@ -95,12 +95,12 @@ public void Multiply ()
var transform = new CGAffineTransform (9, 8, 7, 6, 5, 4);
transform.Multiply (a);
- Assert.AreEqual ((nfloat) 33, transform.A, "A");
- Assert.AreEqual ((nfloat) 50, transform.B, "B");
- Assert.AreEqual ((nfloat) 25, transform.C, "C");
- Assert.AreEqual ((nfloat) 38, transform.D, "D");
- Assert.AreEqual ((nfloat) 22, transform.Tx, "Tx");
- Assert.AreEqual ((nfloat) 32, transform.Ty, "Ty");
+ Assert.That (transform.A, Is.EqualTo ((nfloat) 33), "A");
+ Assert.That (transform.B, Is.EqualTo ((nfloat) 50), "B");
+ Assert.That (transform.C, Is.EqualTo ((nfloat) 25), "C");
+ Assert.That (transform.D, Is.EqualTo ((nfloat) 38), "D");
+ Assert.That (transform.Tx, Is.EqualTo ((nfloat) 22), "Tx");
+ Assert.That (transform.Ty, Is.EqualTo ((nfloat) 32), "Ty");
}
[Test]
@@ -110,12 +110,12 @@ public void StaticMultiply ()
var b = new CGAffineTransform (9, 8, 7, 6, 5, 4);
var transform = CGAffineTransform.Multiply (a, b);
- Assert.AreEqual ((nfloat) 23, transform.A, "A");
- Assert.AreEqual ((nfloat) 20, transform.B, "B");
- Assert.AreEqual ((nfloat) 55, transform.C, "C");
- Assert.AreEqual ((nfloat) 48, transform.D, "D");
- Assert.AreEqual ((nfloat) 92, transform.Tx, "Tx");
- Assert.AreEqual ((nfloat) 80, transform.Ty, "Ty");
+ Assert.That (transform.A, Is.EqualTo ((nfloat) 23), "A");
+ Assert.That (transform.B, Is.EqualTo ((nfloat) 20), "B");
+ Assert.That (transform.C, Is.EqualTo ((nfloat) 55), "C");
+ Assert.That (transform.D, Is.EqualTo ((nfloat) 48), "D");
+ Assert.That (transform.Tx, Is.EqualTo ((nfloat) 92), "Tx");
+ Assert.That (transform.Ty, Is.EqualTo ((nfloat) 80), "Ty");
}
[Test]
public void Scale ()
@@ -124,23 +124,23 @@ public void Scale ()
// t' = t * [ sx 0 0 sy 0 0 ]
transform1.Scale (3, 4); // MatrixOrder.Append by default
- Assert.AreEqual ((nfloat) 3, transform1.A);
- Assert.AreEqual ((nfloat) 0, transform1.B);
- Assert.AreEqual ((nfloat) 0, transform1.C);
- Assert.AreEqual ((nfloat) 4, transform1.D);
- Assert.AreEqual ((nfloat) 3, transform1.Tx);
- Assert.AreEqual ((nfloat) 8, transform1.Ty);
+ Assert.That (transform1.A, Is.EqualTo ((nfloat) 3));
+ Assert.That (transform1.B, Is.EqualTo ((nfloat) 0));
+ Assert.That (transform1.C, Is.EqualTo ((nfloat) 0));
+ Assert.That (transform1.D, Is.EqualTo ((nfloat) 4));
+ Assert.That (transform1.Tx, Is.EqualTo ((nfloat) 3));
+ Assert.That (transform1.Ty, Is.EqualTo ((nfloat) 8));
var transform2 = CGAffineTransform.MakeTranslation (1, 2);
// t' = [ sx 0 0 sy 0 0 ] * t – Swift equivalent
transform2.Scale (3, 4, MatrixOrder.Prepend);
- Assert.AreEqual ((nfloat) 3, transform2.A);
- Assert.AreEqual ((nfloat) 0, transform2.B);
- Assert.AreEqual ((nfloat) 0, transform2.C);
- Assert.AreEqual ((nfloat) 4, transform2.D);
- Assert.AreEqual ((nfloat) 1, transform2.Tx);
- Assert.AreEqual ((nfloat) 2, transform2.Ty);
+ Assert.That (transform2.A, Is.EqualTo ((nfloat) 3));
+ Assert.That (transform2.B, Is.EqualTo ((nfloat) 0));
+ Assert.That (transform2.C, Is.EqualTo ((nfloat) 0));
+ Assert.That (transform2.D, Is.EqualTo ((nfloat) 4));
+ Assert.That (transform2.Tx, Is.EqualTo ((nfloat) 1));
+ Assert.That (transform2.Ty, Is.EqualTo ((nfloat) 2));
}
[Test]
@@ -149,12 +149,12 @@ public void StaticScale ()
var transformM = CGAffineTransform.Scale (CGAffineTransform.MakeTranslation (0, 200), 1, -1);
var transformN = CGAffineTransformScale (CGAffineTransform.MakeTranslation (0, 200), 1, -1);
- Assert.IsTrue (transformM == transformN, "1");
+ Assert.That (transformM == transformN, Is.True, "1");
transformM = CGAffineTransform.Scale (CGAffineTransform.MakeTranslation (1, 2), -3, -4);
transformN = CGAffineTransformScale (CGAffineTransform.MakeTranslation (1, 2), -3, -4);
- Assert.IsTrue (transformM == transformN, "2");
+ Assert.That (transformM == transformN, Is.True, "2");
}
[DllImport (global::ObjCRuntime.Constants.CoreGraphicsLibrary)]
@@ -166,32 +166,32 @@ public void Translate ()
var transform = CGAffineTransform.MakeIdentity ();
transform.Translate (1, -1); // MatrixOrder.Append by default
- Assert.AreEqual ((nfloat) 1, transform.A, "A");
- Assert.AreEqual ((nfloat) 0, transform.B, "B");
- Assert.AreEqual ((nfloat) 0, transform.C, "C");
- Assert.AreEqual ((nfloat) 1, transform.D, "D");
- Assert.AreEqual ((nfloat) 1, transform.Tx, "Tx");
- Assert.AreEqual ((nfloat) (-1), transform.Ty, "Ty");
+ Assert.That (transform.A, Is.EqualTo ((nfloat) 1), "A");
+ Assert.That (transform.B, Is.EqualTo ((nfloat) 0), "B");
+ Assert.That (transform.C, Is.EqualTo ((nfloat) 0), "C");
+ Assert.That (transform.D, Is.EqualTo ((nfloat) 1), "D");
+ Assert.That (transform.Tx, Is.EqualTo ((nfloat) 1), "Tx");
+ Assert.That (transform.Ty, Is.EqualTo ((nfloat) (-1)), "Ty");
transform = new CGAffineTransform (1, 2, 3, 4, 5, 6);
transform.Translate (2, -3);
- Assert.AreEqual ((nfloat) 1, transform.A, "A");
- Assert.AreEqual ((nfloat) 2, transform.B, "B");
- Assert.AreEqual ((nfloat) 3, transform.C, "C");
- Assert.AreEqual ((nfloat) 4, transform.D, "D");
- Assert.AreEqual ((nfloat) 7, transform.Tx, "Tx");
- Assert.AreEqual ((nfloat) 3, transform.Ty, "Ty");
+ Assert.That (transform.A, Is.EqualTo ((nfloat) 1), "A");
+ Assert.That (transform.B, Is.EqualTo ((nfloat) 2), "B");
+ Assert.That (transform.C, Is.EqualTo ((nfloat) 3), "C");
+ Assert.That (transform.D, Is.EqualTo ((nfloat) 4), "D");
+ Assert.That (transform.Tx, Is.EqualTo ((nfloat) 7), "Tx");
+ Assert.That (transform.Ty, Is.EqualTo ((nfloat) 3), "Ty");
transform = new CGAffineTransform (1, 2, 3, 4, 5, 6);
transform.Translate (2, -3, MatrixOrder.Prepend);
- Assert.AreEqual ((nfloat) 1, transform.A, "A");
- Assert.AreEqual ((nfloat) 2, transform.B, "B");
- Assert.AreEqual ((nfloat) 3, transform.C, "C");
- Assert.AreEqual ((nfloat) 4, transform.D, "D");
- Assert.AreEqual ((nfloat) (-2), transform.Tx, "Tx");
- Assert.AreEqual ((nfloat) (-2), transform.Ty, "Ty");
+ Assert.That (transform.A, Is.EqualTo ((nfloat) 1), "A");
+ Assert.That (transform.B, Is.EqualTo ((nfloat) 2), "B");
+ Assert.That (transform.C, Is.EqualTo ((nfloat) 3), "C");
+ Assert.That (transform.D, Is.EqualTo ((nfloat) 4), "D");
+ Assert.That (transform.Tx, Is.EqualTo ((nfloat) (-2)), "Tx");
+ Assert.That (transform.Ty, Is.EqualTo ((nfloat) (-2)), "Ty");
}
[Test]
@@ -201,25 +201,25 @@ public void StaticTranslate ()
var transformM = CGAffineTransform.Translate (origin, 1, -1);
var transformN = CGAffineTransformTranslate (origin, 1, -1);
- Assert.AreEqual ((nfloat) 1, transformM.A, "A");
- Assert.AreEqual ((nfloat) 0, transformM.B, "B");
- Assert.AreEqual ((nfloat) 0, transformM.C, "C");
- Assert.AreEqual ((nfloat) 1, transformM.D, "D");
- Assert.AreEqual ((nfloat) 1, transformM.Tx, "Tx");
- Assert.AreEqual ((nfloat) (-1), transformM.Ty, "Ty");
- Assert.IsTrue (transformN == transformM);
+ Assert.That (transformM.A, Is.EqualTo ((nfloat) 1), "A");
+ Assert.That (transformM.B, Is.EqualTo ((nfloat) 0), "B");
+ Assert.That (transformM.C, Is.EqualTo ((nfloat) 0), "C");
+ Assert.That (transformM.D, Is.EqualTo ((nfloat) 1), "D");
+ Assert.That (transformM.Tx, Is.EqualTo ((nfloat) 1), "Tx");
+ Assert.That (transformM.Ty, Is.EqualTo ((nfloat) (-1)), "Ty");
+ Assert.That (transformN == transformM, Is.True);
origin = new CGAffineTransform (1, 2, 3, 4, 5, 6);
transformM = CGAffineTransform.Translate (origin, 2, -3);
transformN = CGAffineTransformTranslate (origin, 2, -3);
- Assert.AreEqual ((nfloat) 1, transformM.A, "A");
- Assert.AreEqual ((nfloat) 2, transformM.B, "B");
- Assert.AreEqual ((nfloat) 3, transformM.C, "C");
- Assert.AreEqual ((nfloat) 4, transformM.D, "D");
- Assert.AreEqual ((nfloat) (-2), transformM.Tx, "Tx");
- Assert.AreEqual ((nfloat) (-2), transformM.Ty, "Ty");
- Assert.IsTrue (transformN == transformM);
+ Assert.That (transformM.A, Is.EqualTo ((nfloat) 1), "A");
+ Assert.That (transformM.B, Is.EqualTo ((nfloat) 2), "B");
+ Assert.That (transformM.C, Is.EqualTo ((nfloat) 3), "C");
+ Assert.That (transformM.D, Is.EqualTo ((nfloat) 4), "D");
+ Assert.That (transformM.Tx, Is.EqualTo ((nfloat) (-2)), "Tx");
+ Assert.That (transformM.Ty, Is.EqualTo ((nfloat) (-2)), "Ty");
+ Assert.That (transformN == transformM, Is.True);
}
[DllImport (global::ObjCRuntime.Constants.CoreGraphicsLibrary)]
@@ -276,8 +276,8 @@ public void StaticRotate ()
[Test]
public void IsIdentity ()
{
- Assert.IsTrue (CGAffineTransform.MakeIdentity ().IsIdentity, "MakeIdentity");
- Assert.IsFalse (new CGAffineTransform (1, 2, 3, 4, 5, 6).IsIdentity, "123456");
+ Assert.That (CGAffineTransform.MakeIdentity ().IsIdentity, Is.True, "MakeIdentity");
+ Assert.That (new CGAffineTransform (1, 2, 3, 4, 5, 6).IsIdentity, Is.False, "123456");
}
[Test]
@@ -286,8 +286,8 @@ public void TransformPoint ()
var transform = new CGAffineTransform (1, 2, 3, 4, 5, 6);
var point = transform.TransformPoint (new CGPoint (4, 5));
- Assert.AreEqual ((nfloat) 24, point.X, "X");
- Assert.AreEqual ((nfloat) 34, point.Y, "Y");
+ Assert.That (point.X, Is.EqualTo ((nfloat) 24), "X");
+ Assert.That (point.Y, Is.EqualTo ((nfloat) 34), "Y");
}
[Test]
@@ -296,10 +296,10 @@ public void TransformRect ()
var transform = new CGAffineTransform (1, 2, 3, 4, 5, 6);
var rect = transform.TransformRect (new CGRect (4, 5, 6, 7));
- Assert.AreEqual ((nfloat) 24, rect.X, "X");
- Assert.AreEqual ((nfloat) 34, rect.Y, "Y");
- Assert.AreEqual ((nfloat) 27, rect.Width, "Width");
- Assert.AreEqual ((nfloat) 40, rect.Height, "Height");
+ Assert.That (rect.X, Is.EqualTo ((nfloat) 24), "X");
+ Assert.That (rect.Y, Is.EqualTo ((nfloat) 34), "Y");
+ Assert.That (rect.Width, Is.EqualTo ((nfloat) 27), "Width");
+ Assert.That (rect.Height, Is.EqualTo ((nfloat) 40), "Height");
}
[Test]
@@ -307,12 +307,12 @@ public void Invert ()
{
var transform = new CGAffineTransform (1, 2, 3, 4, 5, 6).Invert ();
- Assert.AreEqual ((nfloat) (-2), transform.A, "A");
- Assert.AreEqual ((nfloat) 1, transform.B, "B");
- Assert.AreEqual ((nfloat) 1.5, transform.C, "C");
- Assert.AreEqual ((nfloat) (-0.5), transform.D, "D");
- Assert.AreEqual ((nfloat) 1.0, transform.Tx, "Tx");
- Assert.AreEqual ((nfloat) (-2.0), transform.Ty, "Ty");
+ Assert.That (transform.A, Is.EqualTo ((nfloat) (-2)), "A");
+ Assert.That (transform.B, Is.EqualTo ((nfloat) 1), "B");
+ Assert.That (transform.C, Is.EqualTo ((nfloat) 1.5), "C");
+ Assert.That (transform.D, Is.EqualTo ((nfloat) (-0.5)), "D");
+ Assert.That (transform.Tx, Is.EqualTo ((nfloat) 1.0), "Tx");
+ Assert.That (transform.Ty, Is.EqualTo ((nfloat) (-2.0)), "Ty");
}
[Test]
@@ -321,10 +321,10 @@ public void Decompose ()
TestRuntime.AssertXcodeVersion (14, 0);
var components = new CGAffineTransform (1, 2, 3, 4, 5, 6).Decompose ();
- Assert.AreNotEqual (0.0, components.Scale);
- Assert.AreNotEqual (0.0, components.HorizontalShear);
- Assert.AreNotEqual (0.0, components.Rotation);
- Assert.AreNotEqual (new CGVector ((nfloat) 0, (nfloat) 0), components.Translation);
+ Assert.That (components.Scale, Is.Not.EqualTo (0.0));
+ Assert.That (components.HorizontalShear, Is.Not.EqualTo (0.0));
+ Assert.That (components.Rotation, Is.Not.EqualTo (0.0));
+ Assert.That (components.Translation, Is.Not.EqualTo (new CGVector ((nfloat) 0, (nfloat) 0)));
}
[Test]
@@ -339,12 +339,12 @@ public void MakeWithComponents ()
Translation = new CGVector ((nfloat) 5.0, (nfloat) 6.0),
};
var transform = CGAffineTransform.MakeWithComponents (components);
- Assert.AreNotEqual (0.0, transform.A);
- Assert.AreNotEqual (0.0, transform.B);
- Assert.AreNotEqual (0.0, transform.C);
- Assert.AreNotEqual (0.0, transform.D);
- Assert.AreNotEqual (0.0, transform.Tx);
- Assert.AreNotEqual (0.0, transform.Ty);
+ Assert.That (transform.A, Is.Not.EqualTo (0.0));
+ Assert.That (transform.B, Is.Not.EqualTo (0.0));
+ Assert.That (transform.C, Is.Not.EqualTo (0.0));
+ Assert.That (transform.D, Is.Not.EqualTo (0.0));
+ Assert.That (transform.Tx, Is.Not.EqualTo (0.0));
+ Assert.That (transform.Ty, Is.Not.EqualTo (0.0));
}
[Test]
@@ -354,26 +354,26 @@ public void NSValueRoundtrip ()
// looks simplistic but that NSValue logic is implemented by "us" on macOS
using (var nsv = NSValue.FromCGAffineTransform (transform)) {
var tback = nsv.CGAffineTransformValue;
- Assert.AreEqual ((nfloat) 1, tback.A, "A");
- Assert.AreEqual ((nfloat) 2, tback.B, "B");
- Assert.AreEqual ((nfloat) 3, tback.C, "C");
- Assert.AreEqual ((nfloat) 4, tback.D, "D");
- Assert.AreEqual ((nfloat) 5, tback.Tx, "Tx");
- Assert.AreEqual ((nfloat) 6, tback.Ty, "Ty");
+ Assert.That (tback.A, Is.EqualTo ((nfloat) 1), "A");
+ Assert.That (tback.B, Is.EqualTo ((nfloat) 2), "B");
+ Assert.That (tback.C, Is.EqualTo ((nfloat) 3), "C");
+ Assert.That (tback.D, Is.EqualTo ((nfloat) 4), "D");
+ Assert.That (tback.Tx, Is.EqualTo ((nfloat) 5), "Tx");
+ Assert.That (tback.Ty, Is.EqualTo ((nfloat) 6), "Ty");
}
}
[Test]
public unsafe void SizeOfTest ()
{
- Assert.AreEqual (sizeof (CGAffineTransform), Marshal.SizeOf ());
+ Assert.That (Marshal.SizeOf (), Is.EqualTo (sizeof (CGAffineTransform)));
}
[Test]
public void ToStringTest ()
{
var transform = new CGAffineTransform ((nfloat) 1, (nfloat) 2, (nfloat) 3, (nfloat) 4, (nfloat) 5, (nfloat) 6);
- Assert.AreEqual ("[1, 2, 3, 4, 5, 6]", transform.ToString (), "ToString");
+ Assert.That (transform.ToString (), Is.EqualTo ("[1, 2, 3, 4, 5, 6]"), "ToString");
}
}
diff --git a/tests/monotouch-test/CoreGraphics/BitmapContextTest.cs b/tests/monotouch-test/CoreGraphics/BitmapContextTest.cs
index 65808abd2093..b82d8e942434 100644
--- a/tests/monotouch-test/CoreGraphics/BitmapContextTest.cs
+++ b/tests/monotouch-test/CoreGraphics/BitmapContextTest.cs
@@ -91,7 +91,7 @@ public void Ctor_CGColorSpace_Null ()
// OTOH a null colorspace is possible with the valid parameters, e.g. bug #25600, so we can't throw a ANE blindly
using (var context = new CGBitmapContext (null, 16, 32, 8, 0, null, CGImageAlphaInfo.Only)) {
Assert.That (context.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle");
- Assert.Null (context.ColorSpace, "ColorSpace");
+ Assert.That (context.ColorSpace, Is.Null, "ColorSpace");
}
}
@@ -102,9 +102,9 @@ public void ToImage ()
using (CGColorSpace space = CGColorSpace.CreateDeviceRGB ()) {
CGBitmapContext c = new CGBitmapContext (data, 10, 10, 8, 40, space, CGImageAlphaInfo.PremultipliedLast);
using (var img = c.ToImage ())
- Assert.NotNull (img, "ToImage");
+ Assert.That (img, Is.Not.Null, "ToImage");
c.Dispose (); // Handle is now 0x0
- Assert.Null (c.ToImage (), "ToImage/Disposed");
+ Assert.That (c.ToImage (), Is.Null, "ToImage/Disposed");
}
}
@@ -118,7 +118,7 @@ public void CreateAdaptive_1 ()
using (var pool = new NSAutoreleasePool ()) {
using var context = CGBitmapContext.Create (width, height, (NSDictionary?) null, null, null, null, null);
- Assert.NotNull (context, "Context#1");
+ Assert.That (context, Is.Not.Null, "Context#1");
}
}
@@ -177,10 +177,10 @@ public void CreateAdaptive_2 ()
calledOnError = true;
});
- Assert.NotNull (context, "Context#2");
+ Assert.That (context, Is.Not.Null, "Context#2");
using var img = context.ToImage ();
- Assert.NotNull (img, "ToImage");
+ Assert.That (img, Is.Not.Null, "ToImage");
}
Assert.That (calledOnResolve, Is.True, "calledOnResolve#2");
@@ -252,10 +252,10 @@ public void CreateAdaptive_3 ()
calledOnError = true;
});
- Assert.NotNull (context, "Context#3");
+ Assert.That (context, Is.Not.Null, "Context#3");
using var img = context.ToImage ();
- Assert.NotNull (img, "ToImage");
+ Assert.That (img, Is.Not.Null, "ToImage");
}
Assert.That (calledOnResolve, Is.True, "calledOnResolve#3");
@@ -328,10 +328,10 @@ public void CreateAdaptive_4 ()
calledOnError = true;
})) {
- Assert.NotNull (context, "Context#4");
+ Assert.That (context, Is.Not.Null, "Context#4");
using var img = context.ToImage ();
- Assert.NotNull (img, "ToImage");
+ Assert.That (img, Is.Not.Null, "ToImage");
}
Assert.That (calledOnResolve, Is.True, "calledOnResolve#4");
diff --git a/tests/monotouch-test/CoreGraphics/CGBitmapInfoTest.cs b/tests/monotouch-test/CoreGraphics/CGBitmapInfoTest.cs
index beb200179142..9ed174008732 100644
--- a/tests/monotouch-test/CoreGraphics/CGBitmapInfoTest.cs
+++ b/tests/monotouch-test/CoreGraphics/CGBitmapInfoTest.cs
@@ -11,10 +11,10 @@ public class CGBitmapInfoTest {
[Test]
public void Extensions ()
{
- Assert.AreEqual (CGImageAlphaInfo.PremultipliedLast, ((CGBitmapInfo) CGImageAlphaInfo.PremultipliedLast).GetAlphaInfo (), "GetAlphaInfo");
- Assert.AreEqual (CGImageComponentInfo.Float, ((CGBitmapInfo) CGImageComponentInfo.Float).GetComponentInfo (), "CGImageComponentInfo");
- Assert.AreEqual (CGImageByteOrderInfo.ByteOrder32Little, ((CGBitmapInfo) CGImageByteOrderInfo.ByteOrder32Little).GetByteOrderInfo (), "CGImageByteOrderInfo");
- Assert.AreEqual (CGImagePixelFormatInfo.Rgb101010, ((CGBitmapInfo) CGImagePixelFormatInfo.Rgb101010).GetPixelFormatInfo (), "CGImagePixelFormatInfo");
+ Assert.That (((CGBitmapInfo) CGImageAlphaInfo.PremultipliedLast).GetAlphaInfo (), Is.EqualTo (CGImageAlphaInfo.PremultipliedLast), "GetAlphaInfo");
+ Assert.That (((CGBitmapInfo) CGImageComponentInfo.Float).GetComponentInfo (), Is.EqualTo (CGImageComponentInfo.Float), "CGImageComponentInfo");
+ Assert.That (((CGBitmapInfo) CGImageByteOrderInfo.ByteOrder32Little).GetByteOrderInfo (), Is.EqualTo (CGImageByteOrderInfo.ByteOrder32Little), "CGImageByteOrderInfo");
+ Assert.That (((CGBitmapInfo) CGImagePixelFormatInfo.Rgb101010).GetPixelFormatInfo (), Is.EqualTo (CGImagePixelFormatInfo.Rgb101010), "CGImagePixelFormatInfo");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/CGBitmapParametersTest.cs b/tests/monotouch-test/CoreGraphics/CGBitmapParametersTest.cs
index 8cb40d127e82..12b01a981e7b 100644
--- a/tests/monotouch-test/CoreGraphics/CGBitmapParametersTest.cs
+++ b/tests/monotouch-test/CoreGraphics/CGBitmapParametersTest.cs
@@ -16,17 +16,17 @@ public void DefaultValuesTest ()
{
Assert.Multiple (() => {
var p = new CGBitmapParameters ();
- Assert.AreEqual ((nuint) 0u, p.Width, "Width");
- Assert.AreEqual ((nuint) 0u, p.Height, "Height");
- Assert.AreEqual ((nuint) 0u, p.BytesPerPixel, "BytesPerPixel");
- Assert.AreEqual ((nuint) 0u, p.AlignedBytesPerRow, "AlignedBytesPerRow");
- Assert.AreEqual (default (CGComponent), p.Component, "Component");
- Assert.AreEqual (default (CGBitmapLayout), p.Layout, "Layout");
- Assert.AreEqual (default (CGImagePixelFormatInfo), p.Format, "Format");
- Assert.AreEqual (IntPtr.Zero, p.ColorSpaceHandle, "ColorSpaceHandle");
- Assert.AreEqual (false, p.HasPremultipliedAlpha, "HasPremultipliedAlpha");
- Assert.AreEqual ((CFByteOrder) 0, p.ByteOrder, "ByteOrder");
- Assert.AreEqual (0f, p.EdrTargetHeadroom, "EdrTargetHeadroom");
+ Assert.That (p.Width, Is.EqualTo ((nuint) 0u), "Width");
+ Assert.That (p.Height, Is.EqualTo ((nuint) 0u), "Height");
+ Assert.That (p.BytesPerPixel, Is.EqualTo ((nuint) 0u), "BytesPerPixel");
+ Assert.That (p.AlignedBytesPerRow, Is.EqualTo ((nuint) 0u), "AlignedBytesPerRow");
+ Assert.That (p.Component, Is.EqualTo (default (CGComponent)), "Component");
+ Assert.That (p.Layout, Is.EqualTo (default (CGBitmapLayout)), "Layout");
+ Assert.That (p.Format, Is.EqualTo (default (CGImagePixelFormatInfo)), "Format");
+ Assert.That (p.ColorSpaceHandle, Is.EqualTo (IntPtr.Zero), "ColorSpaceHandle");
+ Assert.That (p.HasPremultipliedAlpha, Is.EqualTo (false), "HasPremultipliedAlpha");
+ Assert.That (p.ByteOrder, Is.EqualTo ((CFByteOrder) 0), "ByteOrder");
+ Assert.That (p.EdrTargetHeadroom, Is.EqualTo (0f), "EdrTargetHeadroom");
});
}
@@ -47,17 +47,17 @@ public void PropertySetGetTest ()
p.ByteOrder = CFByteOrder.LittleEndian;
p.EdrTargetHeadroom = 1.5f;
- Assert.AreEqual ((nuint) 123u, p.Width, "Width");
- Assert.AreEqual ((nuint) 456u, p.Height, "Height");
- Assert.AreEqual ((nuint) 4u, p.BytesPerPixel, "BytesPerPixel");
- Assert.AreEqual ((nuint) 512u, p.AlignedBytesPerRow, "AlignedBytesPerRow");
- Assert.AreEqual ((CGComponent) 1, p.Component, "Component");
- Assert.AreEqual ((CGBitmapLayout) 2, p.Layout, "Layout");
- Assert.AreEqual ((CGImagePixelFormatInfo) 3, p.Format, "Format");
- Assert.AreEqual (new IntPtr (0xDEADBEEF), p.ColorSpaceHandle, "ColorSpaceHandle");
- Assert.IsTrue (p.HasPremultipliedAlpha, "HasPremultipliedAlpha");
- Assert.AreEqual (CFByteOrder.LittleEndian, p.ByteOrder, "ByteOrder");
- Assert.AreEqual (1.5f, p.EdrTargetHeadroom, "EdrTargetHeadroom");
+ Assert.That (p.Width, Is.EqualTo ((nuint) 123u), "Width");
+ Assert.That (p.Height, Is.EqualTo ((nuint) 456u), "Height");
+ Assert.That (p.BytesPerPixel, Is.EqualTo ((nuint) 4u), "BytesPerPixel");
+ Assert.That (p.AlignedBytesPerRow, Is.EqualTo ((nuint) 512u), "AlignedBytesPerRow");
+ Assert.That (p.Component, Is.EqualTo ((CGComponent) 1), "Component");
+ Assert.That (p.Layout, Is.EqualTo ((CGBitmapLayout) 2), "Layout");
+ Assert.That (p.Format, Is.EqualTo ((CGImagePixelFormatInfo) 3), "Format");
+ Assert.That (p.ColorSpaceHandle, Is.EqualTo (new IntPtr (0xDEADBEEF)), "ColorSpaceHandle");
+ Assert.That (p.HasPremultipliedAlpha, Is.True, "HasPremultipliedAlpha");
+ Assert.That (p.ByteOrder, Is.EqualTo (CFByteOrder.LittleEndian), "ByteOrder");
+ Assert.That (p.EdrTargetHeadroom, Is.EqualTo (1.5f), "EdrTargetHeadroom");
});
}
@@ -66,7 +66,7 @@ public void HasPremultipliedAlphaFalseTest ()
{
var p = new CGBitmapParameters ();
p.HasPremultipliedAlpha = false;
- Assert.IsFalse (p.HasPremultipliedAlpha, "HasPremultipliedAlpha");
+ Assert.That (p.HasPremultipliedAlpha, Is.False, "HasPremultipliedAlpha");
}
[Test]
@@ -74,9 +74,9 @@ public void ByteOrderTest ()
{
var p = new CGBitmapParameters ();
p.ByteOrder = CFByteOrder.BigEndian;
- Assert.AreEqual (CFByteOrder.BigEndian, p.ByteOrder, "ByteOrder");
+ Assert.That (p.ByteOrder, Is.EqualTo (CFByteOrder.BigEndian), "ByteOrder");
p.ByteOrder = CFByteOrder.LittleEndian;
- Assert.AreEqual (CFByteOrder.LittleEndian, p.ByteOrder, "ByteOrder");
+ Assert.That (p.ByteOrder, Is.EqualTo (CFByteOrder.LittleEndian), "ByteOrder");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/CGContentInfoTest.cs b/tests/monotouch-test/CoreGraphics/CGContentInfoTest.cs
index 0e0416e93e00..67c68886c8cc 100644
--- a/tests/monotouch-test/CoreGraphics/CGContentInfoTest.cs
+++ b/tests/monotouch-test/CoreGraphics/CGContentInfoTest.cs
@@ -15,11 +15,11 @@ public class CGContentInfoTest {
public void DefaultValuesTest ()
{
var c = new CGContentInfo ();
- Assert.AreEqual (default (CGComponent), c.DeepestImageComponent, "DeepestImageComponent");
- Assert.AreEqual (default (CGColorModel), c.ContentColorModels, "ContentColorModels");
- Assert.IsFalse (c.HasWideGamut, "HasWideGamut");
- Assert.IsFalse (c.HasTransparency, "HasTransparency");
- Assert.AreEqual (0f, c.LargestContentHeadroom, "LargestContentHeadroom");
+ Assert.That (c.DeepestImageComponent, Is.EqualTo (default (CGComponent)), "DeepestImageComponent");
+ Assert.That (c.ContentColorModels, Is.EqualTo (default (CGColorModel)), "ContentColorModels");
+ Assert.That (c.HasWideGamut, Is.False, "HasWideGamut");
+ Assert.That (c.HasTransparency, Is.False, "HasTransparency");
+ Assert.That (c.LargestContentHeadroom, Is.EqualTo (0f), "LargestContentHeadroom");
}
[Test]
@@ -32,11 +32,11 @@ public void PropertySetGetTest ()
c.HasTransparency = true;
c.LargestContentHeadroom = 1.25f;
- Assert.AreEqual ((CGComponent) 2, c.DeepestImageComponent, "DeepestImageComponent");
- Assert.AreEqual ((CGColorModel) 3, c.ContentColorModels, "ContentColorModels");
- Assert.IsTrue (c.HasWideGamut, "HasWideGamut");
- Assert.IsTrue (c.HasTransparency, "HasTransparency");
- Assert.AreEqual (1.25f, c.LargestContentHeadroom, "LargestContentHeadroom");
+ Assert.That (c.DeepestImageComponent, Is.EqualTo ((CGComponent) 2), "DeepestImageComponent");
+ Assert.That (c.ContentColorModels, Is.EqualTo ((CGColorModel) 3), "ContentColorModels");
+ Assert.That (c.HasWideGamut, Is.True, "HasWideGamut");
+ Assert.That (c.HasTransparency, Is.True, "HasTransparency");
+ Assert.That (c.LargestContentHeadroom, Is.EqualTo (1.25f), "LargestContentHeadroom");
}
[Test]
@@ -44,7 +44,7 @@ public void HasWideGamutFalseTest ()
{
var c = new CGContentInfo ();
c.HasWideGamut = false;
- Assert.IsFalse (c.HasWideGamut, "HasWideGamut");
+ Assert.That (c.HasWideGamut, Is.False, "HasWideGamut");
}
[Test]
@@ -52,7 +52,7 @@ public void HasTransparencyFalseTest ()
{
var c = new CGContentInfo ();
c.HasTransparency = false;
- Assert.IsFalse (c.HasTransparency, "HasTransparency");
+ Assert.That (c.HasTransparency, Is.False, "HasTransparency");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/CGContentToneMappingInfoTest.cs b/tests/monotouch-test/CoreGraphics/CGContentToneMappingInfoTest.cs
index c98155dea2b0..b02af632abfc 100644
--- a/tests/monotouch-test/CoreGraphics/CGContentToneMappingInfoTest.cs
+++ b/tests/monotouch-test/CoreGraphics/CGContentToneMappingInfoTest.cs
@@ -17,9 +17,9 @@ public void DefaultValuesTest ()
TestRuntime.AssertXcodeVersion (16, 0);
var t = new CGContentToneMappingInfo ();
- Assert.AreEqual (CGToneMapping.Default, t.Method, "Method");
- Assert.IsNull (t.Options, "Options");
- Assert.IsNull (t.ToneMappingOptions, "ToneMappingOptions");
+ Assert.That (t.Method, Is.EqualTo (CGToneMapping.Default), "Method");
+ Assert.That (t.Options, Is.Null, "Options");
+ Assert.That (t.ToneMappingOptions, Is.Null, "ToneMappingOptions");
}
[Test]
@@ -29,37 +29,37 @@ public void PropertySetGetTest ()
var t = new CGContentToneMappingInfo ();
t.Method = CGToneMapping.ImageSpecificLumaScaling;
- Assert.AreEqual (CGToneMapping.ImageSpecificLumaScaling, t.Method, "Method#1");
+ Assert.That (t.Method, Is.EqualTo (CGToneMapping.ImageSpecificLumaScaling), "Method#1");
t.Method = CGToneMapping.Default;
- Assert.AreEqual (CGToneMapping.Default, t.Method, "Method#2");
+ Assert.That (t.Method, Is.EqualTo (CGToneMapping.Default), "Method#2");
using var dict = new NSDictionary ();
t.Options = dict;
- Assert.AreSame (dict, t.Options, "Options#1");
+ Assert.That (t.Options, Is.SameAs (dict), "Options#1");
var toneMappingOptions = t.ToneMappingOptions!;
- Assert.AreSame (dict, toneMappingOptions.Dictionary, "ToneMappingOptions#1");
+ Assert.That (toneMappingOptions.Dictionary, Is.SameAs (dict), "ToneMappingOptions#1");
- Assert.IsFalse (toneMappingOptions.Use100nitsHlgOotf.HasValue, "ToneMappingOptions.Use100nitsHlgOotf #1");
- Assert.IsFalse (toneMappingOptions.UseBT1886ForCoreVideoGamma.HasValue, "ToneMappingOptions.UseBT1886ForCoreVideoGamma #1");
- Assert.IsFalse (toneMappingOptions.SkipBoostToHdr.HasValue, "ToneMappingOptions.SkipBoostToHdr #1");
- Assert.IsFalse (toneMappingOptions.ExrToneMappingGammaDefog.HasValue, "ToneMappingOptions.ExrToneMappingGammaDefog #1");
- Assert.IsFalse (toneMappingOptions.ExrToneMappingGammaExposure.HasValue, "ToneMappingOptions.ExrToneMappingGammaExposure #1");
- Assert.IsFalse (toneMappingOptions.ExrToneMappingGammaKneeLow.HasValue, "ToneMappingOptions.ExrToneMappingGammaKneeLow #1");
- Assert.IsFalse (toneMappingOptions.ExrToneMappingGammaKneeHigh.HasValue, "ToneMappingOptions.ExrToneMappingGammaKneeHigh #1");
+ Assert.That (toneMappingOptions.Use100nitsHlgOotf.HasValue, Is.False, "ToneMappingOptions.Use100nitsHlgOotf #1");
+ Assert.That (toneMappingOptions.UseBT1886ForCoreVideoGamma.HasValue, Is.False, "ToneMappingOptions.UseBT1886ForCoreVideoGamma #1");
+ Assert.That (toneMappingOptions.SkipBoostToHdr.HasValue, Is.False, "ToneMappingOptions.SkipBoostToHdr #1");
+ Assert.That (toneMappingOptions.ExrToneMappingGammaDefog.HasValue, Is.False, "ToneMappingOptions.ExrToneMappingGammaDefog #1");
+ Assert.That (toneMappingOptions.ExrToneMappingGammaExposure.HasValue, Is.False, "ToneMappingOptions.ExrToneMappingGammaExposure #1");
+ Assert.That (toneMappingOptions.ExrToneMappingGammaKneeLow.HasValue, Is.False, "ToneMappingOptions.ExrToneMappingGammaKneeLow #1");
+ Assert.That (toneMappingOptions.ExrToneMappingGammaKneeHigh.HasValue, Is.False, "ToneMappingOptions.ExrToneMappingGammaKneeHigh #1");
using var mutableDict = new NSMutableDictionary ();
t.Options = mutableDict;
- Assert.AreSame (mutableDict, t.Options, "Options#2");
+ Assert.That (t.Options, Is.SameAs (mutableDict), "Options#2");
toneMappingOptions = t.ToneMappingOptions!;
- Assert.AreSame (mutableDict, toneMappingOptions.Dictionary, "ToneMappingOptions#2");
+ Assert.That (toneMappingOptions.Dictionary, Is.SameAs (mutableDict), "ToneMappingOptions#2");
- Assert.IsFalse (toneMappingOptions.Use100nitsHlgOotf.HasValue, "ToneMappingOptions.Use100nitsHlgOotf #2");
- Assert.IsFalse (toneMappingOptions.UseBT1886ForCoreVideoGamma.HasValue, "ToneMappingOptions.UseBT1886ForCoreVideoGamma #2");
- Assert.IsFalse (toneMappingOptions.SkipBoostToHdr.HasValue, "ToneMappingOptions.SkipBoostToHdr #2");
- Assert.IsFalse (toneMappingOptions.ExrToneMappingGammaDefog.HasValue, "ToneMappingOptions.ExrToneMappingGammaDefog #2");
- Assert.IsFalse (toneMappingOptions.ExrToneMappingGammaExposure.HasValue, "ToneMappingOptions.ExrToneMappingGammaExposure #2");
- Assert.IsFalse (toneMappingOptions.ExrToneMappingGammaKneeLow.HasValue, "ToneMappingOptions.ExrToneMappingGammaKneeLow #2");
- Assert.IsFalse (toneMappingOptions.ExrToneMappingGammaKneeHigh.HasValue, "ToneMappingOptions.ExrToneMappingGammaKneeHigh #2");
+ Assert.That (toneMappingOptions.Use100nitsHlgOotf.HasValue, Is.False, "ToneMappingOptions.Use100nitsHlgOotf #2");
+ Assert.That (toneMappingOptions.UseBT1886ForCoreVideoGamma.HasValue, Is.False, "ToneMappingOptions.UseBT1886ForCoreVideoGamma #2");
+ Assert.That (toneMappingOptions.SkipBoostToHdr.HasValue, Is.False, "ToneMappingOptions.SkipBoostToHdr #2");
+ Assert.That (toneMappingOptions.ExrToneMappingGammaDefog.HasValue, Is.False, "ToneMappingOptions.ExrToneMappingGammaDefog #2");
+ Assert.That (toneMappingOptions.ExrToneMappingGammaExposure.HasValue, Is.False, "ToneMappingOptions.ExrToneMappingGammaExposure #2");
+ Assert.That (toneMappingOptions.ExrToneMappingGammaKneeLow.HasValue, Is.False, "ToneMappingOptions.ExrToneMappingGammaKneeLow #2");
+ Assert.That (toneMappingOptions.ExrToneMappingGammaKneeHigh.HasValue, Is.False, "ToneMappingOptions.ExrToneMappingGammaKneeHigh #2");
toneMappingOptions.Use100nitsHlgOotf = false;
toneMappingOptions.UseBT1886ForCoreVideoGamma = true;
@@ -69,13 +69,13 @@ public void PropertySetGetTest ()
toneMappingOptions.ExrToneMappingGammaKneeLow = 0.0f;
toneMappingOptions.ExrToneMappingGammaKneeHigh = null;
- Assert.IsFalse (toneMappingOptions.Use100nitsHlgOotf.Value, "ToneMappingOptions.Use100nitsHlgOotf #3");
- Assert.IsTrue (toneMappingOptions.UseBT1886ForCoreVideoGamma.Value, "ToneMappingOptions.UseBT1886ForCoreVideoGamma #3");
- Assert.IsFalse (toneMappingOptions.SkipBoostToHdr.HasValue, "ToneMappingOptions.SkipBoostToHdr #3");
- Assert.AreEqual (1.0f, toneMappingOptions.ExrToneMappingGammaDefog.Value, "ToneMappingOptions.ExrToneMappingGammaDefog #3");
- Assert.AreEqual (-1.0f, toneMappingOptions.ExrToneMappingGammaExposure.Value, "ToneMappingOptions.ExrToneMappingGammaExposure #3");
- Assert.AreEqual (0.0f, toneMappingOptions.ExrToneMappingGammaKneeLow.Value, "ToneMappingOptions.ExrToneMappingGammaKneeLow #3");
- Assert.IsFalse (toneMappingOptions.ExrToneMappingGammaKneeHigh.HasValue, "ToneMappingOptions.ExrToneMappingGammaKneeHigh #3");
+ Assert.That (toneMappingOptions.Use100nitsHlgOotf.Value, Is.False, "ToneMappingOptions.Use100nitsHlgOotf #3");
+ Assert.That (toneMappingOptions.UseBT1886ForCoreVideoGamma.Value, Is.True, "ToneMappingOptions.UseBT1886ForCoreVideoGamma #3");
+ Assert.That (toneMappingOptions.SkipBoostToHdr.HasValue, Is.False, "ToneMappingOptions.SkipBoostToHdr #3");
+ Assert.That (toneMappingOptions.ExrToneMappingGammaDefog.Value, Is.EqualTo (1.0f), "ToneMappingOptions.ExrToneMappingGammaDefog #3");
+ Assert.That (toneMappingOptions.ExrToneMappingGammaExposure.Value, Is.EqualTo (-1.0f), "ToneMappingOptions.ExrToneMappingGammaExposure #3");
+ Assert.That (toneMappingOptions.ExrToneMappingGammaKneeLow.Value, Is.EqualTo (0.0f), "ToneMappingOptions.ExrToneMappingGammaKneeLow #3");
+ Assert.That (toneMappingOptions.ExrToneMappingGammaKneeHigh.HasValue, Is.False, "ToneMappingOptions.ExrToneMappingGammaKneeHigh #3");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/CGEventTests.cs b/tests/monotouch-test/CoreGraphics/CGEventTests.cs
index a1ba48dee301..796905b533b3 100644
--- a/tests/monotouch-test/CoreGraphics/CGEventTests.cs
+++ b/tests/monotouch-test/CoreGraphics/CGEventTests.cs
@@ -28,7 +28,7 @@ public void CreateTap ()
{
tapCalled = false;
using var tapPort = CGEvent.CreateTap (CGEventTapLocation.AnnotatedSession, CGEventTapPlacement.HeadInsert, CGEventTapOptions.Default, CGEventMask.KeyDown, callBack, IntPtr.Zero);
- Assert.IsFalse (tapCalled, "tap was mistakenly called.");
+ Assert.That (tapCalled, Is.False, "tap was mistakenly called.");
}
[Test]
@@ -37,7 +37,7 @@ public void CreateTapPSN ()
tapCalled = false;
var psn = (IntPtr) 2; // kCurrentProcess
using var tapPort = CGEvent.CreateTap (psn, CGEventTapPlacement.HeadInsert, CGEventTapOptions.Default, CGEventMask.KeyDown, callBack, IntPtr.Zero);
- Assert.IsFalse (tapCalled, "tap was mistakenly called.");
+ Assert.That (tapCalled, Is.False, "tap was mistakenly called.");
}
#endif
@@ -46,15 +46,15 @@ public void CreateTapPSN ()
public void Constructor_CGEventSourceStateID_0 ()
{
var ex = Assert.Throws (() => new CGEvent (null, CGScrollEventUnit.Pixel), "ArgumentException");
- Assert.AreEqual ("At least one wheel must be provided", ex.Message, "Message");
+ Assert.That (ex.Message, Is.EqualTo ("At least one wheel must be provided"), "Message");
}
[Test]
public void Constructor_CGEventSourceStateID_1 ()
{
using var evt = new CGEvent (null, CGScrollEventUnit.Pixel, 0);
- Assert.AreEqual (CGEventType.ScrollWheel, evt.EventType, "EventType");
- Assert.AreEqual (0, evt.Timestamp, "Timestamp");
+ Assert.That (evt.EventType, Is.EqualTo (CGEventType.ScrollWheel), "EventType");
+ Assert.That (evt.Timestamp, Is.EqualTo (0), "Timestamp");
// There doesn't seem to be any way to validate any creation
// arguments, except using CGEvent.ToData which returns an opaque
// byte array. Unfortunately the byte array changes randomly
@@ -66,8 +66,8 @@ public void Constructor_CGEventSourceStateID_1 ()
public void Constructor_CGEventSourceStateID_2 ()
{
using var evt = new CGEvent (null, CGScrollEventUnit.Pixel, 0, 3);
- Assert.AreEqual (CGEventType.ScrollWheel, evt.EventType, "EventType");
- Assert.AreEqual (0, evt.Timestamp, "Timestamp");
+ Assert.That (evt.EventType, Is.EqualTo (CGEventType.ScrollWheel), "EventType");
+ Assert.That (evt.Timestamp, Is.EqualTo (0), "Timestamp");
// There doesn't seem to be any way to validate any creation
// arguments, except using CGEvent.ToData which returns an opaque
// byte array. Unfortunately the byte array changes randomly
@@ -79,8 +79,8 @@ public void Constructor_CGEventSourceStateID_2 ()
public void Constructor_CGEventSourceStateID_3 ()
{
using var evt = new CGEvent (null, CGScrollEventUnit.Pixel, 0, 3, 9);
- Assert.AreEqual (CGEventType.ScrollWheel, evt.EventType, "EventType");
- Assert.AreEqual (0, evt.Timestamp, "Timestamp");
+ Assert.That (evt.EventType, Is.EqualTo (CGEventType.ScrollWheel), "EventType");
+ Assert.That (evt.Timestamp, Is.EqualTo (0), "Timestamp");
// There doesn't seem to be any way to validate any creation
// arguments, except using CGEvent.ToData which returns an opaque
// byte array. Unfortunately the byte array changes randomly
@@ -92,7 +92,7 @@ public void Constructor_CGEventSourceStateID_3 ()
public void Constructor_CGEventSourceStateID_4 ()
{
var ex = Assert.Throws (() => new CGEvent (null, CGScrollEventUnit.Pixel, 0, 3, 9, 42), "ArgumentException");
- Assert.AreEqual ("Only one to three wheels are supported on this constructor", ex.Message, "Message");
+ Assert.That (ex.Message, Is.EqualTo ("Only one to three wheels are supported on this constructor"), "Message");
}
public void PostToPid ()
@@ -107,7 +107,7 @@ public void PostToPid ()
public void PostToPSN ()
{
var pid = Process.GetCurrentProcess ().Id;
- Assert.AreEqual (0, GetProcessForPID (pid, out var psn), "GetProcessForPID");
+ Assert.That (GetProcessForPID (pid, out var psn), Is.EqualTo (0), "GetProcessForPID");
using var evt = new CGEvent (null, (ushort) 1, true);
unsafe {
IntPtr* psnPtr = &psn;
@@ -124,7 +124,7 @@ public void ToData ()
{
using var evt = new CGEvent (null, CGScrollEventUnit.Pixel, 0);
using var data = evt.ToData ();
- Assert.NotNull (data, "data");
+ Assert.That (data, Is.Not.Null, "data");
Assert.That (data.Length, Is.GreaterThan ((nuint) 0), "Length");
}
#endif // __MACOS__ || __MACCATALYST__
diff --git a/tests/monotouch-test/CoreGraphics/CGImageMetadataTests.cs b/tests/monotouch-test/CoreGraphics/CGImageMetadataTests.cs
index 6801d4d497c8..1c0ca4ba3929 100644
--- a/tests/monotouch-test/CoreGraphics/CGImageMetadataTests.cs
+++ b/tests/monotouch-test/CoreGraphics/CGImageMetadataTests.cs
@@ -34,8 +34,8 @@ public void EnumerateMetadata ()
tags.Add (tag);
return true;
});
- Assert.AreEqual (2, keys.Count, "key count mismatch");
- Assert.AreEqual (2, tags.Count, "tag count mistmatch");
+ Assert.That (keys.Count, Is.EqualTo (2), "key count mismatch");
+ Assert.That (tags.Count, Is.EqualTo (2), "tag count mistmatch");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/CGImageTest.cs b/tests/monotouch-test/CoreGraphics/CGImageTest.cs
index d09372141921..6ff4a085bdd0 100644
--- a/tests/monotouch-test/CoreGraphics/CGImageTest.cs
+++ b/tests/monotouch-test/CoreGraphics/CGImageTest.cs
@@ -34,7 +34,7 @@ public void FromPNG ()
#else
using (var ui = new UIImage (img, 1.0f, UIImageOrientation.Up)) {
#endif
- Assert.IsNotNull (ui.CGImage, "CGImage");
+ Assert.That (ui.CGImage, Is.Not.Null, "CGImage");
if (TestRuntime.CheckXcodeVersion (7, 0))
Assert.That (img.UTType.ToString (), Is.EqualTo ("public.png"), "UTType");
}
@@ -50,18 +50,18 @@ public void ContentHeadroom ()
using var provider = new CGDataProvider (new byte [(int) frame.Width * (int) frame.Height * 4]);
using var colorSpace = CGColorSpace.CreateWithName (CGColorSpaceNames.Itur_2100_PQ);
using var img = new CGImage (0.0f, (int) frame.Width, (int) frame.Height, 8, 32, 4 * (int) frame.Width, colorSpace, CGBitmapFlags.ByteOrderDefault | CGBitmapFlags.Last, provider, null, false, CGColorRenderingIntent.Default);
- Assert.IsNotNull (img, "Image");
- Assert.AreEqual (4.92610836f, img.ContentHeadroom, "ContentHeadroom A");
- Assert.IsTrue (img.ShouldToneMap, "ShouldToneMap A");
- Assert.IsFalse (img.ContainsImageSpecificToneMappingMetadata, "ContainsImageSpecificToneMappingMetadata A");
+ Assert.That (img, Is.Not.Null, "Image");
+ Assert.That (img.ContentHeadroom, Is.EqualTo (4.92610836f), "ContentHeadroom A");
+ Assert.That (img.ShouldToneMap, Is.True, "ShouldToneMap A");
+ Assert.That (img.ContainsImageSpecificToneMappingMetadata, Is.False, "ContainsImageSpecificToneMappingMetadata A");
using var copy = img.Copy (3.0f);
- Assert.IsNotNull (copy, "Copy");
- Assert.AreEqual (3.0f, copy.ContentHeadroom, "ContentHeadroom B");
- Assert.IsTrue (copy.ShouldToneMap, "ShouldToneMap B");
- Assert.IsFalse (copy.ContainsImageSpecificToneMappingMetadata, "ContainsImageSpecificToneMappingMetadata B");
+ Assert.That (copy, Is.Not.Null, "Copy");
+ Assert.That (copy.ContentHeadroom, Is.EqualTo (3.0f), "ContentHeadroom B");
+ Assert.That (copy.ShouldToneMap, Is.True, "ShouldToneMap B");
+ Assert.That (copy.ContainsImageSpecificToneMappingMetadata, Is.False, "ContainsImageSpecificToneMappingMetadata B");
- Assert.AreEqual (4.92610836f, CGImage.DefaultHdrImageContentHeadroom, "DefaultHdrImageContentHeadroom");
+ Assert.That (CGImage.DefaultHdrImageContentHeadroom, Is.EqualTo (4.92610836f), "DefaultHdrImageContentHeadroom");
if (TestRuntime.CheckXcodeVersion (26, 0)) {
Assert.That (copy.CalculatedContentHeadroom, Is.EqualTo (0.0f), "CalculatedContentHeadroom B");
diff --git a/tests/monotouch-test/CoreGraphics/CGPointDictionaryTests.cs b/tests/monotouch-test/CoreGraphics/CGPointDictionaryTests.cs
index e669514f2c37..1f81dd8fc7b0 100644
--- a/tests/monotouch-test/CoreGraphics/CGPointDictionaryTests.cs
+++ b/tests/monotouch-test/CoreGraphics/CGPointDictionaryTests.cs
@@ -22,19 +22,19 @@ public void PropertiesTest ()
var point = new CGPoint ((nfloat) 1, (nfloat) 2);
using var dict = point.ToDictionary ();
var strongDict = new CGPointDictionary (dict);
- Assert.AreEqual (point.X, strongDict.X, "X");
- Assert.AreEqual (point.Y, strongDict.Y, "Y");
+ Assert.That (strongDict.X, Is.EqualTo (point.X), "X");
+ Assert.That (strongDict.Y, Is.EqualTo (point.Y), "Y");
var point2 = strongDict.ToPoint ();
- Assert.AreEqual (point, point2, "Point");
+ Assert.That (point2, Is.EqualTo (point), "Point");
strongDict = new CGPointDictionary ();
strongDict.X = 3;
- Assert.AreEqual ((nfloat) 3, strongDict.X, "X 2");
+ Assert.That (strongDict.X, Is.EqualTo ((nfloat) 3), "X 2");
strongDict.Y = 4;
- Assert.AreEqual ((nfloat) 4, strongDict.Y, "Y 2");
+ Assert.That (strongDict.Y, Is.EqualTo ((nfloat) 4), "Y 2");
point2 = strongDict.ToPoint ();
- Assert.AreEqual (new CGPoint (3, 4), point2, "Point 2");
+ Assert.That (point2, Is.EqualTo (new CGPoint (3, 4)), "Point 2");
});
}
@@ -42,18 +42,18 @@ public void PropertiesTest ()
public void Default ()
{
var strongDict = new CGPointDictionary ();
- Assert.IsNull (strongDict.X, "X");
- Assert.IsNull (strongDict.Y, "Y");
+ Assert.That (strongDict.X, Is.Null, "X");
+ Assert.That (strongDict.Y, Is.Null, "Y");
var point = strongDict.ToPoint ();
- Assert.AreEqual (default (CGPoint), point, "Point");
+ Assert.That (point, Is.EqualTo (default (CGPoint)), "Point");
}
[Test]
public void ToStringTest1 ()
{
var strongDict = new CGPointDictionary ();
- Assert.AreEqual ("CoreGraphics.CGPointDictionary", strongDict.ToString (), "A");
- Assert.AreEqual ("{\n}", strongDict.Dictionary.ToString (), "B");
+ Assert.That (strongDict.ToString (), Is.EqualTo ("CoreGraphics.CGPointDictionary"), "A");
+ Assert.That (strongDict.Dictionary.ToString (), Is.EqualTo ("{\n}"), "B");
}
[Test]
@@ -62,7 +62,7 @@ public void ToStringTest2 ()
var strongDict = new CGPointDictionary ();
strongDict.X = 3;
strongDict.Y = 4;
- Assert.AreEqual ("CoreGraphics.CGPointDictionary", strongDict.ToString (), "A");
- Assert.AreEqual ("{\n X = 3;\n Y = 4;\n}", strongDict.Dictionary.ToString (), "B");
+ Assert.That (strongDict.ToString (), Is.EqualTo ("CoreGraphics.CGPointDictionary"), "A");
+ Assert.That (strongDict.Dictionary.ToString (), Is.EqualTo ("{\n X = 3;\n Y = 4;\n}"), "B");
}
}
diff --git a/tests/monotouch-test/CoreGraphics/CGRectDictionaryTests.cs b/tests/monotouch-test/CoreGraphics/CGRectDictionaryTests.cs
index 12ac9255d660..022e248213cb 100644
--- a/tests/monotouch-test/CoreGraphics/CGRectDictionaryTests.cs
+++ b/tests/monotouch-test/CoreGraphics/CGRectDictionaryTests.cs
@@ -22,25 +22,25 @@ public void PropertiesTest ()
var rect = new CGRect (1, 2, 3, 4);
using var dict = rect.ToDictionary ();
var strongDict = new CGRectDictionary (dict);
- Assert.AreEqual (rect.X, strongDict.X, "X");
- Assert.AreEqual (rect.Y, strongDict.Y, "Y");
- Assert.AreEqual (rect.Height, strongDict.Height, "Height");
- Assert.AreEqual (rect.Width, strongDict.Width, "Width");
+ Assert.That (strongDict.X, Is.EqualTo (rect.X), "X");
+ Assert.That (strongDict.Y, Is.EqualTo (rect.Y), "Y");
+ Assert.That (strongDict.Height, Is.EqualTo (rect.Height), "Height");
+ Assert.That (strongDict.Width, Is.EqualTo (rect.Width), "Width");
var rect2 = strongDict.ToRect ();
- Assert.AreEqual (rect, rect2, "Rect");
+ Assert.That (rect2, Is.EqualTo (rect), "Rect");
strongDict = new CGRectDictionary ();
strongDict.X = 3;
- Assert.AreEqual ((nfloat) 3, strongDict.X, "X 2");
+ Assert.That (strongDict.X, Is.EqualTo ((nfloat) 3), "X 2");
strongDict.Y = 4;
- Assert.AreEqual ((nfloat) 4, strongDict.Y, "Y 2");
+ Assert.That (strongDict.Y, Is.EqualTo ((nfloat) 4), "Y 2");
strongDict.Width = 5;
- Assert.AreEqual ((nfloat) 5, strongDict.Width, "Width 2");
+ Assert.That (strongDict.Width, Is.EqualTo ((nfloat) 5), "Width 2");
strongDict.Height = 6;
- Assert.AreEqual ((nfloat) 6, strongDict.Height, "Height 2");
+ Assert.That (strongDict.Height, Is.EqualTo ((nfloat) 6), "Height 2");
rect2 = strongDict.ToRect ();
- Assert.AreEqual (new CGRect (3, 4, 5, 6), rect2, "Rect 2");
+ Assert.That (rect2, Is.EqualTo (new CGRect (3, 4, 5, 6)), "Rect 2");
});
}
@@ -49,12 +49,12 @@ public void Default ()
{
Assert.Multiple (() => {
var strongDict = new CGRectDictionary ();
- Assert.IsNull (strongDict.X, "X");
- Assert.IsNull (strongDict.Y, "Y");
- Assert.IsNull (strongDict.Width, "Width");
- Assert.IsNull (strongDict.Height, "Height");
+ Assert.That (strongDict.X, Is.Null, "X");
+ Assert.That (strongDict.Y, Is.Null, "Y");
+ Assert.That (strongDict.Width, Is.Null, "Width");
+ Assert.That (strongDict.Height, Is.Null, "Height");
var rect = strongDict.ToRect ();
- Assert.AreEqual (default (CGRect), rect, "Rect");
+ Assert.That (rect, Is.EqualTo (default (CGRect)), "Rect");
});
}
@@ -62,8 +62,8 @@ public void Default ()
public void ToStringTest1 ()
{
var strongDict = new CGRectDictionary ();
- Assert.AreEqual ("CoreGraphics.CGRectDictionary", strongDict.ToString (), "A");
- Assert.AreEqual ("{\n}", strongDict.Dictionary.ToString (), "B");
+ Assert.That (strongDict.ToString (), Is.EqualTo ("CoreGraphics.CGRectDictionary"), "A");
+ Assert.That (strongDict.Dictionary.ToString (), Is.EqualTo ("{\n}"), "B");
}
[Test]
@@ -74,7 +74,7 @@ public void ToStringTest2 ()
strongDict.Y = 4;
strongDict.Width = 5;
strongDict.Height = 6;
- Assert.AreEqual ("CoreGraphics.CGRectDictionary", strongDict.ToString (), "A");
- Assert.AreEqual ("{\n Height = 6;\n Width = 5;\n X = 3;\n Y = 4;\n}", strongDict.Dictionary.ToString (), "B");
+ Assert.That (strongDict.ToString (), Is.EqualTo ("CoreGraphics.CGRectDictionary"), "A");
+ Assert.That (strongDict.Dictionary.ToString (), Is.EqualTo ("{\n Height = 6;\n Width = 5;\n X = 3;\n Y = 4;\n}"), "B");
}
}
diff --git a/tests/monotouch-test/CoreGraphics/CGSizeDictionaryTests.cs b/tests/monotouch-test/CoreGraphics/CGSizeDictionaryTests.cs
index ebb69d0e46c7..65ea93bf2e43 100644
--- a/tests/monotouch-test/CoreGraphics/CGSizeDictionaryTests.cs
+++ b/tests/monotouch-test/CoreGraphics/CGSizeDictionaryTests.cs
@@ -22,19 +22,19 @@ public void PropertiesTest ()
var size = new CGSize ((nfloat) 1, (nfloat) 2);
using var dict = size.ToDictionary ();
var strongDict = new CGSizeDictionary (dict);
- Assert.AreEqual (size.Width, strongDict.Width, "Width");
- Assert.AreEqual (size.Height, strongDict.Height, "Height");
+ Assert.That (strongDict.Width, Is.EqualTo (size.Width), "Width");
+ Assert.That (strongDict.Height, Is.EqualTo (size.Height), "Height");
var size2 = strongDict.ToSize ();
- Assert.AreEqual (size, size2, "Size");
+ Assert.That (size2, Is.EqualTo (size), "Size");
strongDict = new CGSizeDictionary ();
strongDict.Width = 3;
- Assert.AreEqual ((nfloat) 3, strongDict.Width, "Width 2");
+ Assert.That (strongDict.Width, Is.EqualTo ((nfloat) 3), "Width 2");
strongDict.Height = 4;
- Assert.AreEqual ((nfloat) 4, strongDict.Height, "Height 2");
+ Assert.That (strongDict.Height, Is.EqualTo ((nfloat) 4), "Height 2");
size2 = strongDict.ToSize ();
- Assert.AreEqual (new CGSize (3, 4), size2, "Size 2");
+ Assert.That (size2, Is.EqualTo (new CGSize (3, 4)), "Size 2");
});
}
@@ -43,10 +43,10 @@ public void Default ()
{
Assert.Multiple (() => {
var strongDict = new CGSizeDictionary ();
- Assert.IsNull (strongDict.Width, "Width");
- Assert.IsNull (strongDict.Height, "Height");
+ Assert.That (strongDict.Width, Is.Null, "Width");
+ Assert.That (strongDict.Height, Is.Null, "Height");
var size = strongDict.ToSize ();
- Assert.AreEqual (default (CGSize), size, "Size");
+ Assert.That (size, Is.EqualTo (default (CGSize)), "Size");
});
}
@@ -54,8 +54,8 @@ public void Default ()
public void ToStringTest1 ()
{
var strongDict = new CGSizeDictionary ();
- Assert.AreEqual ("CoreGraphics.CGSizeDictionary", strongDict.ToString (), "A");
- Assert.AreEqual ("{\n}", strongDict.Dictionary.ToString (), "B");
+ Assert.That (strongDict.ToString (), Is.EqualTo ("CoreGraphics.CGSizeDictionary"), "A");
+ Assert.That (strongDict.Dictionary.ToString (), Is.EqualTo ("{\n}"), "B");
}
[Test]
@@ -64,7 +64,7 @@ public void ToStringTest2 ()
var strongDict = new CGSizeDictionary ();
strongDict.Width = 3;
strongDict.Height = 4;
- Assert.AreEqual ("CoreGraphics.CGSizeDictionary", strongDict.ToString (), "A");
- Assert.AreEqual ("{\n Height = 4;\n Width = 3;\n}", strongDict.Dictionary.ToString (), "B");
+ Assert.That (strongDict.ToString (), Is.EqualTo ("CoreGraphics.CGSizeDictionary"), "A");
+ Assert.That (strongDict.Dictionary.ToString (), Is.EqualTo ("{\n Height = 4;\n Width = 3;\n}"), "B");
}
}
diff --git a/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs b/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs
index 95c7b3bb0852..4d92d1b1ba63 100644
--- a/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs
+++ b/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs
@@ -35,16 +35,16 @@ public void CreateDeviceGray ()
using (var cs = CGColorSpace.CreateDeviceGray ()) {
Assert.That (cs.Components, Is.EqualTo ((nint) 1), "1");
Assert.That (cs.Model, Is.EqualTo (CGColorSpaceModel.Monochrome), "Monochrome");
- Assert.Null (cs.GetBaseColorSpace (), "GetBaseColorSpace");
+ Assert.That (cs.GetBaseColorSpace (), Is.Null, "GetBaseColorSpace");
// not indexed so no color table
Assert.That (cs.GetColorTable ().Length, Is.EqualTo (0), "GetColorTable");
- Assert.Null (cs.GetIccProfile (), "GetIccProfile");
+ Assert.That (cs.GetIccProfile (), Is.Null, "GetIccProfile");
if (TestRuntime.CheckXcodeVersion (8, 0)) {
// kCGColorSpaceDeviceGray is not a public constant, e.g. from CGColorSpaceNames.*
Assert.That (cs.Name, Is.EqualTo ("kCGColorSpaceDeviceGray"), "Name");
- Assert.False (cs.IsWideGamutRgb, "IsWideGamutRgb");
- Assert.True (cs.SupportsOutput, "SupportsOutput");
- Assert.Null (cs.GetIccData (), "GetIccData");
+ Assert.That (cs.IsWideGamutRgb, Is.False, "IsWideGamutRgb");
+ Assert.That (cs.SupportsOutput, Is.True, "SupportsOutput");
+ Assert.That (cs.GetIccData (), Is.Null, "GetIccData");
}
}
}
@@ -55,16 +55,16 @@ public void CreateDeviceRGB ()
using (var cs = CGColorSpace.CreateDeviceRGB ()) {
Assert.That (cs.Components, Is.EqualTo ((nint) 3), "3");
Assert.That (cs.Model, Is.EqualTo (CGColorSpaceModel.RGB), "RGB");
- Assert.Null (cs.GetBaseColorSpace (), "GetBaseColorSpace");
+ Assert.That (cs.GetBaseColorSpace (), Is.Null, "GetBaseColorSpace");
// not indexed so no color table
Assert.That (cs.GetColorTable ().Length, Is.EqualTo (0), "GetColorTable");
- Assert.Null (cs.GetIccProfile (), "GetIccProfile");
+ Assert.That (cs.GetIccProfile (), Is.Null, "GetIccProfile");
if (TestRuntime.CheckXcodeVersion (8, 0)) {
// kCGColorSpaceDeviceRGB is not a public constant
Assert.That (cs.Name, Is.EqualTo ("kCGColorSpaceDeviceRGB"), "Name");
- Assert.False (cs.IsWideGamutRgb, "IsWideGamutRgb");
- Assert.True (cs.SupportsOutput, "SupportsOutput");
- Assert.Null (cs.GetIccData (), "GetIccData");
+ Assert.That (cs.IsWideGamutRgb, Is.False, "IsWideGamutRgb");
+ Assert.That (cs.SupportsOutput, Is.True, "SupportsOutput");
+ Assert.That (cs.GetIccData (), Is.Null, "GetIccData");
}
}
}
@@ -75,16 +75,16 @@ public void CreateDeviceCMYK ()
using (var cs = CGColorSpace.CreateDeviceCmyk ()) {
Assert.That (cs.Components, Is.EqualTo ((nint) 4), "4");
Assert.That (cs.Model, Is.EqualTo (CGColorSpaceModel.CMYK), "CMYK");
- Assert.Null (cs.GetBaseColorSpace (), "GetBaseColorSpace");
+ Assert.That (cs.GetBaseColorSpace (), Is.Null, "GetBaseColorSpace");
// not indexed so no color table
Assert.That (cs.GetColorTable ().Length, Is.EqualTo (0), "GetColorTable");
- Assert.Null (cs.GetIccProfile (), "GetIccProfile");
+ Assert.That (cs.GetIccProfile (), Is.Null, "GetIccProfile");
if (TestRuntime.CheckXcodeVersion (8, 0)) {
// kCGColorSpaceDeviceCMYK is not a public constant
Assert.That (cs.Name, Is.EqualTo ("kCGColorSpaceDeviceCMYK"), "Name");
- Assert.False (cs.IsWideGamutRgb, "IsWideGamutRgb");
- Assert.True (cs.SupportsOutput, "SupportsOutput");
- Assert.Null (cs.GetIccData (), "GetIccData");
+ Assert.That (cs.IsWideGamutRgb, Is.False, "IsWideGamutRgb");
+ Assert.That (cs.SupportsOutput, Is.True, "SupportsOutput");
+ Assert.That (cs.GetIccData (), Is.Null, "GetIccData");
}
}
}
@@ -107,16 +107,16 @@ public void CreateIndexed ()
Assert.That (base_cs.Model, Is.EqualTo (bcs.Model), "GetBaseColorSpace");
var new_table = cs.GetColorTable ();
Assert.That (table, Is.EqualTo (new_table), "GetColorTable");
- Assert.Null (cs.GetIccProfile (), "GetIccProfile");
+ Assert.That (cs.GetIccProfile (), Is.Null, "GetIccProfile");
if (TestRuntime.CheckXcodeVersion (8, 0)) {
- Assert.Null (cs.Name, "Name");
- Assert.False (cs.IsWideGamutRgb, "IsWideGamutRgb");
- Assert.False (cs.SupportsOutput, "SupportsOutput");
- Assert.Null (cs.GetIccData (), "GetIccData");
+ Assert.That (cs.Name, Is.Null, "Name");
+ Assert.That (cs.IsWideGamutRgb, Is.False, "IsWideGamutRgb");
+ Assert.That (cs.SupportsOutput, Is.False, "SupportsOutput");
+ Assert.That (cs.GetIccData (), Is.Null, "GetIccData");
}
if (TestRuntime.CheckXcodeVersion (12, 0))
- Assert.False (cs.UsesExtendedRange, "UsesExtendedRange");
+ Assert.That (cs.UsesExtendedRange, Is.False, "UsesExtendedRange");
}
}
@@ -129,7 +129,7 @@ public void CreateExtendedSrgb ()
using (var cs = CGColorSpace.CreateWithName (CGColorSpaceNames.ExtendedSrgb)) {
Assert.That (cs.Components, Is.EqualTo ((nint) 3), "3");
Assert.That (cs.Model, Is.EqualTo (CGColorSpaceModel.RGB), "RGB");
- Assert.Null (cs.GetBaseColorSpace (), "GetBaseColorSpace");
+ Assert.That (cs.GetBaseColorSpace (), Is.Null, "GetBaseColorSpace");
// not indexed so no color table
Assert.That (cs.GetColorTable ().Length, Is.EqualTo (0), "GetColorTable");
@@ -137,14 +137,14 @@ public void CreateExtendedSrgb ()
Assert.That (icc_profile.Length, Is.EqualTo ((nuint) 3144), "GetIccProfile");
Assert.That (cs.Name, Is.EqualTo (CGColorSpaceNames.ExtendedSrgb.ToString ()), "Name");
- Assert.True (cs.IsWideGamutRgb, "IsWideGamutRgb");
- Assert.True (cs.SupportsOutput, "SupportsOutput");
+ Assert.That (cs.IsWideGamutRgb, Is.True, "IsWideGamutRgb");
+ Assert.That (cs.SupportsOutput, Is.True, "SupportsOutput");
using (var icc_data = cs.GetIccData ())
Assert.That (icc_data.Length, Is.EqualTo ((nuint) 3144), "GetIccData");
if (TestRuntime.CheckXcodeVersion (12, 0))
- Assert.True (cs.UsesExtendedRange, "UsesExtendedRange");
+ Assert.That (cs.UsesExtendedRange, Is.True, "UsesExtendedRange");
}
}
@@ -159,13 +159,13 @@ public void Disposed ()
Assert.That (cs.Components, Is.EqualTo ((nint) 0), "0");
Assert.That (cs.Model, Is.EqualTo (CGColorSpaceModel.Unknown), "Unknown");
- Assert.Null (cs.GetBaseColorSpace (), "GetBaseColorSpace");
+ Assert.That (cs.GetBaseColorSpace (), Is.Null, "GetBaseColorSpace");
Assert.That (cs.GetColorTable ().Length, Is.EqualTo (0), "GetColorTable");
- Assert.Null (cs.GetIccProfile (), "GetIccProfile");
- Assert.Null (cs.Name, "Name");
- Assert.False (cs.IsWideGamutRgb, "IsWideGamutRgb");
- Assert.False (cs.SupportsOutput, "SupportsOutput");
- Assert.Null (cs.GetIccData (), "GetIccData");
+ Assert.That (cs.GetIccProfile (), Is.Null, "GetIccProfile");
+ Assert.That (cs.Name, Is.Null, "Name");
+ Assert.That (cs.IsWideGamutRgb, Is.False, "IsWideGamutRgb");
+ Assert.That (cs.SupportsOutput, Is.False, "SupportsOutput");
+ Assert.That (cs.GetIccData (), Is.Null, "GetIccData");
// IOW all safe to call with a `nil` handle
}
@@ -182,7 +182,7 @@ public void CreateICCProfile ()
}
using (var space = CGColorSpace.CreateIccProfile ((NSData) null)) {
- Assert.IsNull (space, "null data");
+ Assert.That (space, Is.Null, "null data");
}
}
@@ -190,7 +190,7 @@ void TestICC (CGColorSpace cs)
{
Assert.That (cs.Components, Is.EqualTo ((nint) 3), "Components");
Assert.That (cs.Model, Is.EqualTo (CGColorSpaceModel.RGB), "Model");
- Assert.Null (cs.GetBaseColorSpace (), "GetBaseColorSpace");
+ Assert.That (cs.GetBaseColorSpace (), Is.Null, "GetBaseColorSpace");
// not indexed so no color table
Assert.That (cs.GetColorTable ().Length, Is.EqualTo (0), "GetColorTable");
@@ -198,9 +198,9 @@ void TestICC (CGColorSpace cs)
Assert.That (icc_profile.Length, Is.EqualTo ((nuint) 3284), "GetIccProfile");
if (TestRuntime.CheckXcodeVersion (8, 0)) {
- Assert.Null (cs.Name, "Name");
- Assert.False (cs.IsWideGamutRgb, "IsWideGamutRgb");
- Assert.True (cs.SupportsOutput, "SupportsOutput");
+ Assert.That (cs.Name, Is.Null, "Name");
+ Assert.That (cs.IsWideGamutRgb, Is.False, "IsWideGamutRgb");
+ Assert.That (cs.SupportsOutput, Is.True, "SupportsOutput");
using (var icc_data = cs.GetIccData ())
Assert.That (icc_data.Length, Is.EqualTo ((nuint) 3284), "GetIccData");
}
@@ -233,7 +233,7 @@ public void CreateIccData ()
public void CreateIccData_Null_NSData ()
{
using (var space = CGColorSpace.CreateIccData ((NSData) null)) {
- Assert.IsNull (space, "null data");
+ Assert.That (space, Is.Null, "null data");
}
}
@@ -241,7 +241,7 @@ public void CreateIccData_Null_NSData ()
public void CreateIccData_Null_CGDataProvider ()
{
using (var space = CGColorSpace.CreateIccData ((CGDataProvider) null)) {
- Assert.IsNull (space, "null data provider");
+ Assert.That (space, Is.Null, "null data provider");
}
}
@@ -296,11 +296,11 @@ public void CalibratedGray ()
Assert.Throws (() => CGColorSpace.CreateCalibratedGray (whitepoint, new nfloat [4], gamma), "invalid blackpoint4");
using (var space = CGColorSpace.CreateCalibratedGray (whitepoint, blackpoint, gamma)) {
- Assert.IsNotNull (space, "all non-null");
+ Assert.That (space, Is.Not.Null, "all non-null");
}
using (var space = CGColorSpace.CreateCalibratedGray (whitepoint, null, gamma)) {
- Assert.IsNotNull (space, "null blackpoint");
+ Assert.That (space, Is.Not.Null, "null blackpoint");
}
}
@@ -325,23 +325,23 @@ public void CalibratedRGB ()
Assert.Throws (() => CGColorSpace.CreateCalibratedRGB (whitepoint, blackpoint, gamma, new nfloat [4]), "invalid matrix4");
using (var space = CGColorSpace.CreateCalibratedRGB (whitepoint, blackpoint, gamma, matrix)) {
- Assert.IsNotNull (space, "all non-null");
+ Assert.That (space, Is.Not.Null, "all non-null");
}
using (var space = CGColorSpace.CreateCalibratedRGB (whitepoint, null, gamma, matrix)) {
- Assert.IsNotNull (space, "null blackpoint");
+ Assert.That (space, Is.Not.Null, "null blackpoint");
}
using (var space = CGColorSpace.CreateCalibratedRGB (whitepoint, blackpoint, null, matrix)) {
- Assert.IsNotNull (space, "null gamma");
+ Assert.That (space, Is.Not.Null, "null gamma");
}
using (var space = CGColorSpace.CreateCalibratedRGB (whitepoint, blackpoint, gamma, null)) {
- Assert.IsNotNull (space, "all matrix-null");
+ Assert.That (space, Is.Not.Null, "all matrix-null");
}
using (var space = CGColorSpace.CreateCalibratedRGB (whitepoint, null, null, null)) {
- Assert.IsNotNull (space, "all null");
+ Assert.That (space, Is.Not.Null, "all null");
}
}
@@ -362,19 +362,19 @@ public void Lab ()
Assert.Throws (() => CGColorSpace.CreateLab (whitepoint, blackpoint, new nfloat [3]), "invalid range3");
using (var space = CGColorSpace.CreateLab (whitepoint, blackpoint, range)) {
- Assert.IsNotNull (space, "all non-null");
+ Assert.That (space, Is.Not.Null, "all non-null");
}
using (var space = CGColorSpace.CreateLab (whitepoint, null, range)) {
- Assert.IsNotNull (space, "null blackpoint");
+ Assert.That (space, Is.Not.Null, "null blackpoint");
}
using (var space = CGColorSpace.CreateLab (whitepoint, blackpoint, null)) {
- Assert.IsNotNull (space, "null gamma");
+ Assert.That (space, Is.Not.Null, "null gamma");
}
using (var space = CGColorSpace.CreateLab (whitepoint, null, null)) {
- Assert.IsNotNull (space, "all null");
+ Assert.That (space, Is.Not.Null, "all null");
}
}
@@ -383,9 +383,9 @@ public void IsHdr ()
{
TestRuntime.AssertXcodeVersion (11, 0);
using (var cs = CGColorSpace.CreateWithName (CGColorSpaceNames.GenericRgb))
- Assert.False (cs.IsHdr, "GenericRgb");
+ Assert.That (cs.IsHdr, Is.False, "GenericRgb");
using (var cs = CGColorSpace.CreateWithName (CGColorSpaceNames.DisplayP3_Hlg))
- Assert.True (cs.IsHdr, "DisplayP3_Hlg");
+ Assert.That (cs.IsHdr, Is.True, "DisplayP3_Hlg");
}
[Test]
@@ -393,9 +393,9 @@ public void CGColorSpaceUsesITUR_2100TFTest ()
{
TestRuntime.AssertXcodeVersion (12, TestRuntime.MinorXcode12APIMismatch);
using (var cs = CGColorSpace.CreateWithName (CGColorSpaceNames.DisplayP3_Hlg))
- Assert.True (cs.UsesItur2100TF, "DisplayP3_Hlg");
+ Assert.That (cs.UsesItur2100TF, Is.True, "DisplayP3_Hlg");
using (var cs = CGColorSpace.CreateWithName (CGColorSpaceNames.GenericRgb))
- Assert.False (cs.UsesItur2100TF, "GenericRgb");
+ Assert.That (cs.UsesItur2100TF, Is.False, "GenericRgb");
}
[Test]
@@ -404,7 +404,7 @@ public void CreateLinearizedTest ()
TestRuntime.AssertXcodeVersion (12, TestRuntime.MinorXcode12APIMismatch);
using (var cs = CGColorSpace.CreateWithName (CGColorSpaceNames.GenericRgb)) {
var csl = cs.CreateLinearized ();
- Assert.NotNull (csl, "not null");
+ Assert.That (csl, Is.Not.Null, "not null");
Assert.That ((nint) TestRuntime.CFGetRetainCount (csl.Handle), Is.EqualTo ((nint) 1).Or.EqualTo ((nint) 2));
}
}
@@ -415,7 +415,7 @@ public void CreateExtendedTest ()
TestRuntime.AssertXcodeVersion (12, TestRuntime.MinorXcode12APIMismatch);
using (var cs = CGColorSpace.CreateWithName (CGColorSpaceNames.GenericRgb)) {
var csl = cs.CreateExtended ();
- Assert.NotNull (csl, "not null");
+ Assert.That (csl, Is.Not.Null, "not null");
Assert.That ((nint) TestRuntime.CFGetRetainCount (csl.Handle), Is.EqualTo ((nint) 1).Or.EqualTo ((nint) 2));
}
}
@@ -426,7 +426,7 @@ public void CreateExtendedLinearizedTest ()
TestRuntime.AssertXcodeVersion (12, TestRuntime.MinorXcode12APIMismatch);
using (var cs = CGColorSpace.CreateWithName (CGColorSpaceNames.GenericRgb)) {
var csl = cs.CreateExtendedLinearized ();
- Assert.NotNull (csl, "not null");
+ Assert.That (csl, Is.Not.Null, "not null");
Assert.That ((nint) TestRuntime.CFGetRetainCount (csl.Handle), Is.EqualTo ((nint) 1).Or.EqualTo ((nint) 2));
}
}
@@ -436,7 +436,7 @@ public void CreateCopyWithStandardRange ()
{
TestRuntime.AssertXcodeVersion (14, 0);
using var cs = CGColorSpace.CreateWithName (CGColorSpaceNames.GenericRgb);
- Assert.NotNull (cs.CreateCopyWithStandardRange ());
+ Assert.That (cs.CreateCopyWithStandardRange (), Is.Not.Null);
}
[Test]
@@ -467,7 +467,7 @@ public void CopyBaseColorSpace ()
TestRuntime.AssertXcodeVersion (16, 0);
using (var cs = CGColorSpace.CreateDeviceRGB ()) {
using var cbcs = cs.CopyBaseColorSpace ();
- Assert.IsNull (cbcs, "CopyBaseColorSpace");
+ Assert.That (cbcs, Is.Null, "CopyBaseColorSpace");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/ColorTest.cs b/tests/monotouch-test/CoreGraphics/ColorTest.cs
index 106b110f30a4..86387c6aed4f 100644
--- a/tests/monotouch-test/CoreGraphics/ColorTest.cs
+++ b/tests/monotouch-test/CoreGraphics/ColorTest.cs
@@ -56,7 +56,7 @@ public void ColorSpace ()
{
using (var c = new CGColor (0.5f, 0.5f, 0.5f, 0.5f)) {
using (var spc = c.ColorSpace)
- Assert.IsNotNull (spc, "ColorSpace");
+ Assert.That (spc, Is.Not.Null, "ColorSpace");
}
}
@@ -98,7 +98,7 @@ public void GetAXName ()
{
TestRuntime.AssertXcodeVersion (12, TestRuntime.MinorXcode12APIMismatch);
using (var c = new CGColor (CGConstantColor.Black)) {
- Assert.IsNotNull (c.AXName, "AXName");
+ Assert.That (c.AXName, Is.Not.Null, "AXName");
}
}
@@ -107,14 +107,14 @@ public void CreateByMatchingToColorSpace ()
{
TestRuntime.AssertXcodeVersion (11, 0);
using (var c = CGColor.CreateByMatchingToColorSpace (null, CGColorRenderingIntent.Default, null, null)) {
- Assert.IsNull (c, "0");
+ Assert.That (c, Is.Null, "0");
}
using (var cs = CGColorSpace.CreateGenericRgbLinear ())
using (var c1 = CGColor.CreateSrgb (1, 2, 3, 4))
using (var c2 = CGColor.CreateByMatchingToColorSpace (cs, CGColorRenderingIntent.Default, c1, null)) {
- Assert.IsNotNull (c1, "1");
- Assert.IsNotNull (c2, "2");
+ Assert.That (c1, Is.Not.Null, "1");
+ Assert.That (c2, Is.Not.Null, "2");
}
}
@@ -124,12 +124,12 @@ public void ContentHeadroom ()
TestRuntime.AssertXcodeVersion (26, 0);
using (var color = CGColor.CreateWithContentHeadroom (0.5f, null, 0.3f, 0.4f, 0.5f, 0.6f)) {
- Assert.IsNull (color, "color #1");
+ Assert.That (color, Is.Null, "color #1");
}
using var headroomCapableColorspace = CGColorSpace.CreateWithName (CGColorSpaceNames.ExtendedSrgb);
using (var color = CGColor.CreateWithContentHeadroom (0.0f, headroomCapableColorspace, 0.3f, 0.4f, 0.5f, 0.6f)) {
- Assert.IsNotNull (color, "color #2");
+ Assert.That (color, Is.Not.Null, "color #2");
Assert.That (color.ContentHeadroom, Is.EqualTo (0.0f), "ContentHeadroom #2");
Assert.That (color.NumberOfComponents, Is.EqualTo ((nint) 4), "NumberOfComponents #2");
Assert.That (color.Components, Is.EqualTo (new nfloat [] { 0.3f, 0.4f, 0.5f, 0.6f }), "Components #2");
diff --git a/tests/monotouch-test/CoreGraphics/ContextTest.cs b/tests/monotouch-test/CoreGraphics/ContextTest.cs
index 1994a8ae2ef4..2a875a102881 100644
--- a/tests/monotouch-test/CoreGraphics/ContextTest.cs
+++ b/tests/monotouch-test/CoreGraphics/ContextTest.cs
@@ -61,17 +61,17 @@ public void EdrHeadroom ()
using var context = Create ();
if (TestRuntime.CheckXcodeVersion (26, 0)) {
- Assert.AreEqual (1.0f, context.GetEdrTargetHeadroom (), "a");
- Assert.IsFalse (context.SetEdrTargetHeadroom (2.0f), "b");
- Assert.AreEqual (1.0f, context.GetEdrTargetHeadroom (), "c");
- Assert.IsFalse (context.SetEdrTargetHeadroom (-2.0f), "d");
- Assert.AreEqual (1.0f, context.GetEdrTargetHeadroom (), "e");
+ Assert.That (context.GetEdrTargetHeadroom (), Is.EqualTo (1.0f), "a");
+ Assert.That (context.SetEdrTargetHeadroom (2.0f), Is.False, "b");
+ Assert.That (context.GetEdrTargetHeadroom (), Is.EqualTo (1.0f), "c");
+ Assert.That (context.SetEdrTargetHeadroom (-2.0f), Is.False, "d");
+ Assert.That (context.GetEdrTargetHeadroom (), Is.EqualTo (1.0f), "e");
} else {
- Assert.AreEqual (0.0f, context.GetEdrTargetHeadroom (), "a");
- Assert.IsTrue (context.SetEdrTargetHeadroom (2.0f), "b");
- Assert.AreEqual (2.0f, context.GetEdrTargetHeadroom (), "c");
- Assert.IsFalse (context.SetEdrTargetHeadroom (-2.0f), "d");
- Assert.AreEqual (2.0f, context.GetEdrTargetHeadroom (), "e");
+ Assert.That (context.GetEdrTargetHeadroom (), Is.EqualTo (0.0f), "a");
+ Assert.That (context.SetEdrTargetHeadroom (2.0f), Is.True, "b");
+ Assert.That (context.GetEdrTargetHeadroom (), Is.EqualTo (2.0f), "c");
+ Assert.That (context.SetEdrTargetHeadroom (-2.0f), Is.False, "d");
+ Assert.That (context.GetEdrTargetHeadroom (), Is.EqualTo (2.0f), "e");
}
}
@@ -86,15 +86,15 @@ public void DrawImageApplyingToneMapping ()
var mapping = new CGToneMappingOptions () { Use100nitsHlgOotf = true, ExrToneMappingGammaExposure = 3.14f };
using (var context = Create ()) {
- Assert.IsFalse (context.DrawImageApplyingToneMapping (new CGRect (0, 0, 10, 10), img, CGToneMapping.IturRecommended, (NSDictionary?) null), "DrawImageApplyingToneMapping A");
+ Assert.That (context.DrawImageApplyingToneMapping (new CGRect (0, 0, 10, 10), img, CGToneMapping.IturRecommended, (NSDictionary?) null), Is.False, "DrawImageApplyingToneMapping A");
}
using (var context = Create ()) {
- Assert.IsFalse (context.DrawImageApplyingToneMapping (new CGRect (0, 0, 10, 10), img, CGToneMapping.IturRecommended, mapping), "DrawImageApplyingToneMapping B");
+ Assert.That (context.DrawImageApplyingToneMapping (new CGRect (0, 0, 10, 10), img, CGToneMapping.IturRecommended, mapping), Is.False, "DrawImageApplyingToneMapping B");
}
using (var context = Create ()) {
- Assert.IsFalse (context.DrawImageApplyingToneMapping (new CGRect (0, 0, 10, 10), img, CGToneMapping.IturRecommended, mapping.Dictionary), "DrawImageApplyingToneMapping C");
+ Assert.That (context.DrawImageApplyingToneMapping (new CGRect (0, 0, 10, 10), img, CGToneMapping.IturRecommended, mapping.Dictionary), Is.False, "DrawImageApplyingToneMapping C");
}
}
diff --git a/tests/monotouch-test/CoreGraphics/DataProviderTest.cs b/tests/monotouch-test/CoreGraphics/DataProviderTest.cs
index 28bab218c9bc..fb8caa82e019 100644
--- a/tests/monotouch-test/CoreGraphics/DataProviderTest.cs
+++ b/tests/monotouch-test/CoreGraphics/DataProviderTest.cs
@@ -57,13 +57,13 @@ public void Create_ReleaseCallback ()
{
IntPtr memory = Marshal.AllocHGlobal (20);
using (var provider = new CGDataProvider (memory, 20, ((IntPtr mem) => {
- Assert.AreEqual (memory, mem, "mem");
+ Assert.That (mem, Is.EqualTo (memory), "mem");
Marshal.FreeHGlobal (mem);
memory = IntPtr.Zero;
}))) {
}
- Assert.AreEqual (IntPtr.Zero, memory, "mem freed");
+ Assert.That (memory, Is.EqualTo (IntPtr.Zero), "mem freed");
}
[Test]
diff --git a/tests/monotouch-test/CoreGraphics/FontTest.cs b/tests/monotouch-test/CoreGraphics/FontTest.cs
index 8073f7035bb8..ebdbaa2f1f4f 100644
--- a/tests/monotouch-test/CoreGraphics/FontTest.cs
+++ b/tests/monotouch-test/CoreGraphics/FontTest.cs
@@ -36,13 +36,13 @@ public void Nullable ()
[Test]
public void CreateFromProvider ()
{
- Assert.Null (CGFont.CreateFromProvider (null), "CreateFromProvider");
+ Assert.That (CGFont.CreateFromProvider (null), Is.Null, "CreateFromProvider");
}
[Test]
public void CreateWithFontName ()
{
- Assert.Null (CGFont.CreateWithFontName (null), "CreateWithFontName");
+ Assert.That (CGFont.CreateWithFontName (null), Is.Null, "CreateWithFontName");
}
[Test]
diff --git a/tests/monotouch-test/CoreGraphics/FunctionTest.cs b/tests/monotouch-test/CoreGraphics/FunctionTest.cs
index 5985a35a8539..21cad3fc4137 100644
--- a/tests/monotouch-test/CoreGraphics/FunctionTest.cs
+++ b/tests/monotouch-test/CoreGraphics/FunctionTest.cs
@@ -100,13 +100,13 @@ public void CoreGraphicsStrongDictionary ()
};
var retrievedRect = graphicsDict.Rect;
- Assert.IsTrue (rect == retrievedRect, "CoreGraphicsStrongDictionary CGRect");
+ Assert.That (rect == retrievedRect, Is.True, "CoreGraphicsStrongDictionary CGRect");
var retrievedSize = graphicsDict.Size;
- Assert.IsTrue (size == retrievedSize, "CoreGraphicsStrongDictionary CGSize");
+ Assert.That (size == retrievedSize, Is.True, "CoreGraphicsStrongDictionary CGSize");
var retrievedPoint = graphicsDict.Point;
- Assert.IsTrue (point == retrievedPoint, "CoreGraphicsStrongDictionary CGPoint");
+ Assert.That (point == retrievedPoint, Is.True, "CoreGraphicsStrongDictionary CGPoint");
}
class GraphicsDict : DictionaryContainer {
diff --git a/tests/monotouch-test/CoreGraphics/GeometryTest.cs b/tests/monotouch-test/CoreGraphics/GeometryTest.cs
index 24eb3c0520b3..400bd1b08394 100644
--- a/tests/monotouch-test/CoreGraphics/GeometryTest.cs
+++ b/tests/monotouch-test/CoreGraphics/GeometryTest.cs
@@ -31,27 +31,27 @@ public static CGRect GetRect (IntPtr indirect)
public void Infinite ()
{
var r = GetRect (Dlfcn.dlsym (Handle, "CGRectInfinite"));
- Assert.False (r.IsEmpty, "IsEmpty");
- Assert.False (r.IsNull (), "IsNull");
- Assert.True (r.IsInfinite (), "IsInfinite");
+ Assert.That (r.IsEmpty, Is.False, "IsEmpty");
+ Assert.That (r.IsNull (), Is.False, "IsNull");
+ Assert.That (r.IsInfinite (), Is.True, "IsInfinite");
}
[Test]
public void Null ()
{
var r = GetRect (Dlfcn.dlsym (Handle, "CGRectNull"));
- Assert.True (r.IsEmpty, "IsEmpty");
- Assert.True (r.IsNull (), "IsNull");
- Assert.False (r.IsInfinite (), "IsInfinite");
+ Assert.That (r.IsEmpty, Is.True, "IsEmpty");
+ Assert.That (r.IsNull (), Is.True, "IsNull");
+ Assert.That (r.IsInfinite (), Is.False, "IsInfinite");
}
[Test]
public void Zero ()
{
var r = GetRect (Dlfcn.dlsym (Handle, "CGRectZero"));
- Assert.True (r.IsEmpty, "IsEmpty");
- Assert.False (r.IsNull (), "IsNull");
- Assert.False (r.IsInfinite (), "IsInfinite");
+ Assert.That (r.IsEmpty, Is.True, "IsEmpty");
+ Assert.That (r.IsNull (), Is.False, "IsNull");
+ Assert.That (r.IsInfinite (), Is.False, "IsInfinite");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/GradientTest.cs b/tests/monotouch-test/CoreGraphics/GradientTest.cs
index ac6abb42f5cb..a563c5d2288a 100644
--- a/tests/monotouch-test/CoreGraphics/GradientTest.cs
+++ b/tests/monotouch-test/CoreGraphics/GradientTest.cs
@@ -105,14 +105,14 @@ public void CreateWithHeadroom ()
};
using var hdrCapableColorspace = CGColorSpace.CreateWithName (CGColorSpaceNames.DisplayP3_PQ);
- Assert.IsTrue (hdrCapableColorspace.IsHdr, "IsHdr");
+ Assert.That (hdrCapableColorspace.IsHdr, Is.True, "IsHdr");
using (var gradient = CGGradient.Create (0.5f, hdrCapableColorspace, colorComponents, locations)) {
- Assert.IsNotNull (gradient, "Gradient #1");
+ Assert.That (gradient, Is.Not.Null, "Gradient #1");
Assert.That (gradient.ContentHeadroom, Is.EqualTo (1.0f), "Gradient #1 - ContentHeadroom");
}
using (var gradient = CGGradient.Create (0.5f, null, colorComponents, locations)) {
- Assert.IsNull (gradient, "Gradient #2");
+ Assert.That (gradient, Is.Null, "Gradient #2");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/PDFContentStreamTest.cs b/tests/monotouch-test/CoreGraphics/PDFContentStreamTest.cs
index 4d51c1944ceb..8390a32c5a19 100644
--- a/tests/monotouch-test/CoreGraphics/PDFContentStreamTest.cs
+++ b/tests/monotouch-test/CoreGraphics/PDFContentStreamTest.cs
@@ -27,7 +27,7 @@ public void FromPage ()
Assert.That (streams.Length, Is.EqualTo (1), "GetStreams.Length");
Assert.That (streams [0].Handle, Is.Not.EqualTo (cs.Handle), "GetStreams");
- Assert.Null (cs.GetResource ("XObject", ""), "GetResource");
+ Assert.That (cs.GetResource ("XObject", ""), Is.Null, "GetResource");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/PDFDocumentTest.cs b/tests/monotouch-test/CoreGraphics/PDFDocumentTest.cs
index c0aab11187fb..fbeccad011cd 100644
--- a/tests/monotouch-test/CoreGraphics/PDFDocumentTest.cs
+++ b/tests/monotouch-test/CoreGraphics/PDFDocumentTest.cs
@@ -44,10 +44,10 @@ public void FromUrl ()
void CheckTamarin (CGPDFDocument pdf)
{
- Assert.True (pdf.AllowsCopying, "AllowsCopying");
- Assert.True (pdf.AllowsPrinting, "AllowsPrinting");
- Assert.False (pdf.IsEncrypted, "IsEncrypted");
- Assert.True (pdf.IsUnlocked, "IsUnlocked");
+ Assert.That (pdf.AllowsCopying, Is.True, "AllowsCopying");
+ Assert.That (pdf.AllowsPrinting, Is.True, "AllowsPrinting");
+ Assert.That (pdf.IsEncrypted, Is.False, "IsEncrypted");
+ Assert.That (pdf.IsUnlocked, Is.True, "IsUnlocked");
Assert.That (pdf.Pages, Is.EqualTo ((nint) 3), "Pages");
Assert.That (pdf.GetInfo ().Count, Is.EqualTo (7), "GetInfo");
diff --git a/tests/monotouch-test/CoreGraphics/PDFInfoTest.cs b/tests/monotouch-test/CoreGraphics/PDFInfoTest.cs
index 9d0f3b704957..0541e3131a6c 100644
--- a/tests/monotouch-test/CoreGraphics/PDFInfoTest.cs
+++ b/tests/monotouch-test/CoreGraphics/PDFInfoTest.cs
@@ -62,11 +62,11 @@ public void ToDictionaryWithPermissions ()
using (var url = new NSUrl (filename)) {
using (var ctx = new CGContextPDF (url, new CGRect (0, 0, 1000, 1000), info)) {
- Assert.IsNotNull (ctx, "1");
+ Assert.That (ctx, Is.Not.Null, "1");
}
using (var consumer = new CGDataConsumer (url)) {
using (var ctx = new CGContextPDF (consumer, new CGRect (0, 0, 1000, 1000), info)) {
- Assert.IsNotNull (ctx, "2");
+ Assert.That (ctx, Is.Not.Null, "2");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/PDFScannerTest.cs b/tests/monotouch-test/CoreGraphics/PDFScannerTest.cs
index def94c38556b..fde7a324c497 100644
--- a/tests/monotouch-test/CoreGraphics/PDFScannerTest.cs
+++ b/tests/monotouch-test/CoreGraphics/PDFScannerTest.cs
@@ -111,7 +111,7 @@ public void Tamarin ()
bt_count = 0;
do_checks = 7;
- Assert.True (scanner.Scan (), "Scan");
+ Assert.That (scanner.Scan (), Is.True, "Scan");
Assert.That (bt_count, Is.EqualTo (45), "new paragraph");
Assert.That (do_checks, Is.EqualTo (0), "found the image");
if (TestRuntime.CheckXcodeVersion (14, 0)) {
diff --git a/tests/monotouch-test/CoreGraphics/PathTest.cs b/tests/monotouch-test/CoreGraphics/PathTest.cs
index 6149a1d4dd18..2bb7be881fab 100644
--- a/tests/monotouch-test/CoreGraphics/PathTest.cs
+++ b/tests/monotouch-test/CoreGraphics/PathTest.cs
@@ -24,7 +24,7 @@ public void EllipseFromRect ()
var rect = new CGRect (0, 0, 15, 15);
var matrix = CGAffineTransform.MakeIdentity ();
using (CGPath p = CGPath.EllipseFromRect (rect, matrix)) {
- Assert.IsNotNull (p, "non-null");
+ Assert.That (p, Is.Not.Null, "non-null");
}
}
@@ -56,10 +56,10 @@ public void MoveToPoint ()
var matrix = CGAffineTransform.MakeIdentity ();
using (CGPath p1 = new CGPath ())
using (CGPath p2 = new CGPath ()) {
- Assert.IsTrue (p1.IsEmpty, "IsEmpty-1");
+ Assert.That (p1.IsEmpty, Is.True, "IsEmpty-1");
p1.MoveToPoint (0, 0);
p2.MoveToPoint (matrix, 0, 0);
- Assert.IsFalse (p1.IsEmpty, "IsEmpty-2");
+ Assert.That (p1.IsEmpty, Is.False, "IsEmpty-2");
Assert.That (p1, Is.EqualTo (p2), "CGPathEqualToPath");
}
}
@@ -70,12 +70,12 @@ public void AddLineToPoint ()
var matrix = CGAffineTransform.MakeIdentity ();
using (CGPath p1 = new CGPath ())
using (CGPath p2 = new CGPath ()) {
- Assert.IsTrue (p1.IsEmpty, "IsEmpty-1");
+ Assert.That (p1.IsEmpty, Is.True, "IsEmpty-1");
p1.MoveToPoint (0, 0);
p1.AddLineToPoint (1, 1);
p2.MoveToPoint (matrix, 0, 0);
p2.AddLineToPoint (matrix, 1, 1);
- Assert.IsFalse (p1.IsEmpty, "IsEmpty-2");
+ Assert.That (p1.IsEmpty, Is.False, "IsEmpty-2");
Assert.That (p1, Is.EqualTo (p2), "CGPathEqualToPath");
}
}
@@ -86,12 +86,12 @@ public void AddCurveToPoint ()
var matrix = CGAffineTransform.MakeIdentity ();
using (CGPath p1 = new CGPath ())
using (CGPath p2 = new CGPath ()) {
- Assert.IsTrue (p1.IsEmpty, "IsEmpty-1");
+ Assert.That (p1.IsEmpty, Is.True, "IsEmpty-1");
p1.MoveToPoint (0, 0);
p1.AddCurveToPoint (1, 2, 3, 4, 5, 6);
p2.MoveToPoint (0, 0);
p2.AddCurveToPoint (matrix, 1, 2, 3, 4, 5, 6);
- Assert.IsFalse (p1.IsEmpty, "IsEmpty-2");
+ Assert.That (p1.IsEmpty, Is.False, "IsEmpty-2");
Assert.That (p1, Is.EqualTo (p2), "CGPathEqualToPath");
}
}
@@ -102,13 +102,13 @@ public void AddQuadCurveToPoint ()
var matrix = CGAffineTransform.MakeIdentity ();
using (CGPath p1 = new CGPath ())
using (CGPath p2 = new CGPath ()) {
- Assert.IsTrue (p1.IsEmpty, "IsEmpty-1");
+ Assert.That (p1.IsEmpty, Is.True, "IsEmpty-1");
p1.MoveToPoint (0, 0);
p1.AddQuadCurveToPoint (1, 2, 3, 4);
p1.CloseSubpath ();
p2.MoveToPoint (0, 0);
p2.AddQuadCurveToPoint (matrix, 1, 2, 3, 4);
- Assert.IsFalse (p1.IsEmpty, "IsEmpty-2");
+ Assert.That (p1.IsEmpty, Is.False, "IsEmpty-2");
Assert.That (p1, Is.Not.EqualTo (p2), "CGPathEqualToPath-2");
p2.CloseSubpath ();
Assert.That (p1, Is.EqualTo (p2), "CGPathEqualToPath");
@@ -122,10 +122,10 @@ public void AddRect ()
var matrix = CGAffineTransform.MakeIdentity ();
using (CGPath p1 = new CGPath ())
using (CGPath p2 = new CGPath ()) {
- Assert.IsTrue (p1.IsEmpty, "IsEmpty-1");
+ Assert.That (p1.IsEmpty, Is.True, "IsEmpty-1");
p1.AddRect (rect);
p2.AddRect (matrix, rect);
- Assert.IsFalse (p1.IsEmpty, "IsEmpty-2");
+ Assert.That (p1.IsEmpty, Is.False, "IsEmpty-2");
Assert.That (p1, Is.EqualTo (p2), "CGPathEqualToPath");
}
}
@@ -137,10 +137,10 @@ public void AddRects ()
var matrix = CGAffineTransform.MakeIdentity ();
using (CGPath p1 = new CGPath ())
using (CGPath p2 = new CGPath ()) {
- Assert.IsTrue (p1.IsEmpty, "IsEmpty-1");
+ Assert.That (p1.IsEmpty, Is.True, "IsEmpty-1");
p1.AddRects (new [] { rect, rect }, 1);
p2.AddRects (matrix, new [] { rect }, 1);
- Assert.IsFalse (p1.IsEmpty, "IsEmpty-2");
+ Assert.That (p1.IsEmpty, Is.False, "IsEmpty-2");
Assert.That (p1, Is.EqualTo (p2), "CGPathEqualToPath");
}
}
@@ -151,10 +151,10 @@ public void AddLines ()
var matrix = CGAffineTransform.MakeIdentity ();
using (CGPath p1 = new CGPath ())
using (CGPath p2 = new CGPath ()) {
- Assert.IsTrue (p1.IsEmpty, "IsEmpty-1");
+ Assert.That (p1.IsEmpty, Is.True, "IsEmpty-1");
p1.AddLines (new [] { CGPoint.Empty });
p2.AddLines (matrix, new [] { CGPoint.Empty });
- Assert.IsFalse (p1.IsEmpty, "IsEmpty-2");
+ Assert.That (p1.IsEmpty, Is.False, "IsEmpty-2");
Assert.That (p1, Is.EqualTo (p2), "CGPathEqualToPath");
}
}
@@ -166,10 +166,10 @@ public void AddEllipseInRect ()
var matrix = CGAffineTransform.MakeIdentity ();
using (CGPath p1 = new CGPath ())
using (CGPath p2 = new CGPath ()) {
- Assert.IsTrue (p1.IsEmpty, "IsEmpty-1");
+ Assert.That (p1.IsEmpty, Is.True, "IsEmpty-1");
p1.AddEllipseInRect (rect);
p2.AddEllipseInRect (matrix, rect);
- Assert.IsFalse (p1.IsEmpty, "IsEmpty-2");
+ Assert.That (p1.IsEmpty, Is.False, "IsEmpty-2");
Assert.That (p1, Is.EqualTo (p2), "CGPathEqualToPath");
}
}
@@ -180,10 +180,10 @@ public void AddArc ()
var matrix = CGAffineTransform.MakeIdentity ();
using (CGPath p1 = new CGPath ())
using (CGPath p2 = new CGPath ()) {
- Assert.IsTrue (p1.IsEmpty, "IsEmpty-1");
+ Assert.That (p1.IsEmpty, Is.True, "IsEmpty-1");
p1.AddArc (0, 0, 10, 0, 90, true);
p2.AddArc (matrix, 0, 0, 10, 0, 90, true);
- Assert.IsFalse (p1.IsEmpty, "IsEmpty-2");
+ Assert.That (p1.IsEmpty, Is.False, "IsEmpty-2");
Assert.That (p1, Is.EqualTo (p2), "CGPathEqualToPath");
}
}
@@ -194,12 +194,12 @@ public void AddArcToPoint ()
var matrix = CGAffineTransform.MakeIdentity ();
using (CGPath p1 = new CGPath ())
using (CGPath p2 = new CGPath ()) {
- Assert.IsTrue (p1.IsEmpty, "IsEmpty-1");
+ Assert.That (p1.IsEmpty, Is.True, "IsEmpty-1");
p1.MoveToPoint (0, 0);
p1.AddArcToPoint (0, 0, 10, 0, 90);
p2.MoveToPoint (0, 0);
p2.AddArcToPoint (matrix, 0, 0, 10, 0, 90);
- Assert.IsFalse (p1.IsEmpty, "IsEmpty-2");
+ Assert.That (p1.IsEmpty, Is.False, "IsEmpty-2");
Assert.That (p1, Is.EqualTo (p2), "CGPathEqualToPath");
}
}
@@ -210,12 +210,12 @@ public void AddRelativeArc ()
var matrix = CGAffineTransform.MakeIdentity ();
using (CGPath p1 = new CGPath ())
using (CGPath p2 = new CGPath ()) {
- Assert.IsTrue (p1.IsEmpty, "IsEmpty-1");
+ Assert.That (p1.IsEmpty, Is.True, "IsEmpty-1");
p1.MoveToPoint (0, 0);
p1.AddRelativeArc (0, 0, 10, 0, 90);
p2.MoveToPoint (0, 0);
p2.AddRelativeArc (matrix, 0, 0, 10, 0, 90);
- Assert.IsFalse (p1.IsEmpty, "IsEmpty-2");
+ Assert.That (p1.IsEmpty, Is.False, "IsEmpty-2");
Assert.That (p1, Is.EqualTo (p2), "CGPathEqualToPath");
}
}
@@ -227,7 +227,7 @@ public void AddPath ()
using (CGPath p2 = new CGPath ()) {
p1.MoveToPoint (0, 0);
p2.AddPath (p1);
- Assert.IsFalse (p2.IsEmpty, "IsEmpty");
+ Assert.That (p2.IsEmpty, Is.False, "IsEmpty");
}
}
@@ -238,8 +238,8 @@ public void Normalizing ()
using (CGPath p1 = new CGPath ()) {
p1.MoveToPoint (0, 0);
p1.AddLineToPoint (1, 1);
- Assert.IsNotNull (p1.CreateByNormalizing (false));
- Assert.IsNotNull (p1.CreateByNormalizing (true));
+ Assert.That (p1.CreateByNormalizing (false), Is.Not.Null);
+ Assert.That (p1.CreateByNormalizing (true), Is.Not.Null);
}
}
@@ -253,8 +253,8 @@ public void Union ()
using (CGPath p2 = new CGPath ()) {
p2.MoveToPoint (2, 2);
p2.AddLineToPoint (0, 0);
- Assert.IsNotNull (p1.CreateByUnioningPath (p2, false));
- Assert.IsNotNull (p1.CreateByUnioningPath (p2, true));
+ Assert.That (p1.CreateByUnioningPath (p2, false), Is.Not.Null);
+ Assert.That (p1.CreateByUnioningPath (p2, true), Is.Not.Null);
}
}
}
@@ -269,8 +269,8 @@ public void Intersecting ()
using (CGPath p2 = new CGPath ()) {
p2.MoveToPoint (2, 2);
p2.AddLineToPoint (0, 0);
- Assert.IsNotNull (p1.CreateByIntersectingPath (p2, false));
- Assert.IsNotNull (p1.CreateByIntersectingPath (p2, true));
+ Assert.That (p1.CreateByIntersectingPath (p2, false), Is.Not.Null);
+ Assert.That (p1.CreateByIntersectingPath (p2, true), Is.Not.Null);
}
}
}
@@ -285,8 +285,8 @@ public void Subtracting ()
using (CGPath p2 = new CGPath ()) {
p2.MoveToPoint (2, 2);
p2.AddLineToPoint (0, 0);
- Assert.IsNotNull (p1.CreateBySubtractingPath (p2, false));
- Assert.IsNotNull (p1.CreateBySubtractingPath (p2, true));
+ Assert.That (p1.CreateBySubtractingPath (p2, false), Is.Not.Null);
+ Assert.That (p1.CreateBySubtractingPath (p2, true), Is.Not.Null);
}
}
}
@@ -301,8 +301,8 @@ public void SymmetricDifference ()
using (CGPath p2 = new CGPath ()) {
p2.MoveToPoint (2, 2);
p2.AddLineToPoint (0, 0);
- Assert.IsNotNull (p1.CreateBySymmetricDifferenceOfPath (p2, false));
- Assert.IsNotNull (p1.CreateBySymmetricDifferenceOfPath (p2, true));
+ Assert.That (p1.CreateBySymmetricDifferenceOfPath (p2, false), Is.Not.Null);
+ Assert.That (p1.CreateBySymmetricDifferenceOfPath (p2, true), Is.Not.Null);
}
}
}
@@ -317,8 +317,8 @@ public void LineBySubtracting ()
using (CGPath p2 = new CGPath ()) {
p2.MoveToPoint (2, 2);
p2.AddLineToPoint (0, 0);
- Assert.IsNotNull (p1.CreateLineBySubtractingPath (p2, false));
- Assert.IsNotNull (p1.CreateLineBySubtractingPath (p2, true));
+ Assert.That (p1.CreateLineBySubtractingPath (p2, false), Is.Not.Null);
+ Assert.That (p1.CreateLineBySubtractingPath (p2, true), Is.Not.Null);
}
}
}
@@ -333,8 +333,8 @@ public void LineByIntersecting ()
using (CGPath p2 = new CGPath ()) {
p2.MoveToPoint (2, 2);
p2.AddLineToPoint (0, 0);
- Assert.IsNotNull (p1.CreateLineByIntersectingPath (p2, false));
- Assert.IsNotNull (p1.CreateLineByIntersectingPath (p2, true));
+ Assert.That (p1.CreateLineByIntersectingPath (p2, false), Is.Not.Null);
+ Assert.That (p1.CreateLineByIntersectingPath (p2, true), Is.Not.Null);
}
}
}
@@ -346,8 +346,8 @@ public void GetSeparateComponents ()
using (CGPath p1 = new CGPath ()) {
p1.MoveToPoint (0, 0);
p1.AddLineToPoint (1, 1);
- Assert.AreEqual (0, p1.GetSeparateComponents (true).Length);
- Assert.AreEqual (0, p1.GetSeparateComponents (false).Length);
+ Assert.That (p1.GetSeparateComponents (true).Length, Is.EqualTo (0));
+ Assert.That (p1.GetSeparateComponents (false).Length, Is.EqualTo (0));
}
}
@@ -358,7 +358,7 @@ public void CreateByFlattening ()
using (CGPath p1 = new CGPath ()) {
p1.MoveToPoint (0, 0);
p1.AddLineToPoint (1, 1);
- Assert.IsNotNull (p1.CreateByFlattening (new nfloat (0.5)));
+ Assert.That (p1.CreateByFlattening (new nfloat (0.5)), Is.Not.Null);
}
}
@@ -372,8 +372,8 @@ public void DoesIntersect ()
using (CGPath p2 = new CGPath ()) {
p2.MoveToPoint (0, 2);
p2.AddLineToPoint (2, 0);
- Assert.IsFalse (p1.DoesIntersect (p2, false));
- Assert.IsFalse (p1.DoesIntersect (p2, false));
+ Assert.That (p1.DoesIntersect (p2, false), Is.False);
+ Assert.That (p1.DoesIntersect (p2, false), Is.False);
}
}
}
@@ -387,7 +387,7 @@ public void Bug40230 ()
// Assertion failed: (corner_height >= 0 && 2 * corner_height <= CGRectGetHeight(rect)), function CGPathRef CGPathCreateWithRoundedRect
Assert.Throws (() => CGPath.FromRoundedRect (rect, 1, 13.5f), "height");
using (var path = CGPath.FromRoundedRect (rect, 1, 1)) {
- Assert.IsNotNull (path, "path");
+ Assert.That (path, Is.Not.Null, "path");
}
}
@@ -399,9 +399,9 @@ public void IncreaseRetainCountMakeMutable ()
var count = CFGetRetainCount (p1.Handle);
using (var copy = p1.Copy ()) {
var newRetainCount = CFGetRetainCount (copy.Handle);
- Assert.AreEqual (count, newRetainCount, "Ref count should not have changed.");
- Assert.AreEqual ((nint) 1, count, "Original count.");
- Assert.AreEqual ((nint) 1, newRetainCount, "New count");
+ Assert.That (newRetainCount, Is.EqualTo (count), "Ref count should not have changed.");
+ Assert.That (count, Is.EqualTo ((nint) 1), "Original count.");
+ Assert.That (newRetainCount, Is.EqualTo ((nint) 1), "New count");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/PointTest.cs b/tests/monotouch-test/CoreGraphics/PointTest.cs
index c7bb4948cad5..0fb9f695bf14 100644
--- a/tests/monotouch-test/CoreGraphics/PointTest.cs
+++ b/tests/monotouch-test/CoreGraphics/PointTest.cs
@@ -17,7 +17,7 @@ public class PointTest {
public void ToStringTest ()
{
var point = new CGPoint ((nfloat) 1, (nfloat) 2);
- Assert.AreEqual ("{1, 2}", point.ToString (), "ToString");
+ Assert.That (point.ToString (), Is.EqualTo ("{1, 2}"), "ToString");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/RectTest.cs b/tests/monotouch-test/CoreGraphics/RectTest.cs
index ced9f14f8e65..79cc65edeb6d 100644
--- a/tests/monotouch-test/CoreGraphics/RectTest.cs
+++ b/tests/monotouch-test/CoreGraphics/RectTest.cs
@@ -18,52 +18,52 @@ public void Inflate ()
{
var rect = new CGRect (1, 2, 3, 4);
rect.Inflate (5, 6);
- Assert.AreEqual (-4, (int) rect.X, "x 1");
- Assert.AreEqual (-4, (int) rect.Y, "y 1");
- Assert.AreEqual (13, (int) rect.Width, "w 1");
- Assert.AreEqual (16, (int) rect.Height, "h 1");
+ Assert.That ((int) rect.X, Is.EqualTo (-4), "x 1");
+ Assert.That ((int) rect.Y, Is.EqualTo (-4), "y 1");
+ Assert.That ((int) rect.Width, Is.EqualTo (13), "w 1");
+ Assert.That ((int) rect.Height, Is.EqualTo (16), "h 1");
rect.Inflate (new CGSize (10, 20));
- Assert.AreEqual (-14, (int) rect.X, "x 2");
- Assert.AreEqual (-24, (int) rect.Y, "y 2");
- Assert.AreEqual (33, (int) rect.Width, "w 2");
- Assert.AreEqual (56, (int) rect.Height, "h 2");
+ Assert.That ((int) rect.X, Is.EqualTo (-14), "x 2");
+ Assert.That ((int) rect.Y, Is.EqualTo (-24), "y 2");
+ Assert.That ((int) rect.Width, Is.EqualTo (33), "w 2");
+ Assert.That ((int) rect.Height, Is.EqualTo (56), "h 2");
rect = CGRect.Inflate (rect, 5, 4);
- Assert.AreEqual (-19, (int) rect.X, "x 3");
- Assert.AreEqual (-28, (int) rect.Y, "y 3");
- Assert.AreEqual (43, (int) rect.Width, "w 3");
- Assert.AreEqual (64, (int) rect.Height, "h 3");
+ Assert.That ((int) rect.X, Is.EqualTo (-19), "x 3");
+ Assert.That ((int) rect.Y, Is.EqualTo (-28), "y 3");
+ Assert.That ((int) rect.Width, Is.EqualTo (43), "w 3");
+ Assert.That ((int) rect.Height, Is.EqualTo (64), "h 3");
}
[Test]
public void Null ()
{
- Assert.True (CGRect.Null.IsNull (), "Null.IsNull");
- Assert.True (CGRect.Null.IsEmpty, "Null.IsEmpty");
- Assert.False (CGRect.Null.IsInfinite (), "Null.IsInfinite");
+ Assert.That (CGRect.Null.IsNull (), Is.True, "Null.IsNull");
+ Assert.That (CGRect.Null.IsEmpty, Is.True, "Null.IsEmpty");
+ Assert.That (CGRect.Null.IsInfinite (), Is.False, "Null.IsInfinite");
}
[Test]
public void Infinite ()
{
- Assert.True (CGRect.Infinite.IsInfinite (), "Infinite.IsInfinite");
- Assert.False (CGRect.Infinite.IsEmpty, "Infinite.IsEmpty");
- Assert.False (CGRect.Infinite.IsNull (), "Infinite.IsNull");
+ Assert.That (CGRect.Infinite.IsInfinite (), Is.True, "Infinite.IsInfinite");
+ Assert.That (CGRect.Infinite.IsEmpty, Is.False, "Infinite.IsEmpty");
+ Assert.That (CGRect.Infinite.IsNull (), Is.False, "Infinite.IsNull");
}
[Test]
public void Empty ()
{
- Assert.True (CGRect.Empty.IsEmpty, "Empty.IsEmpty");
- Assert.False (CGRect.Empty.IsNull (), "Empty.IsNull");
- Assert.False (CGRect.Empty.IsInfinite (), "Empty.IsInfinite");
+ Assert.That (CGRect.Empty.IsEmpty, Is.True, "Empty.IsEmpty");
+ Assert.That (CGRect.Empty.IsNull (), Is.False, "Empty.IsNull");
+ Assert.That (CGRect.Empty.IsInfinite (), Is.False, "Empty.IsInfinite");
// for System.Drawing compatibility this was named Empty - test confirms it's identical to CGRectZero
var handle = Dlfcn.dlopen (Constants.CoreGraphicsLibrary, 0);
try {
var zero = Dlfcn.GetCGRect (handle, "CGRectZero");
- Assert.AreEqual (CGRect.Empty, zero, "CGRectZero");
+ Assert.That (zero, Is.EqualTo (CGRect.Empty), "CGRectZero");
} finally {
Dlfcn.dlclose (handle);
}
@@ -73,7 +73,7 @@ public void Empty ()
public void ToStringTest ()
{
var rect = new CGRect ((nfloat) 1, (nfloat) 2, (nfloat) 3, (nfloat) 4);
- Assert.AreEqual ("{{1, 2}, {3, 4}}", rect.ToString (), "ToString");
+ Assert.That (rect.ToString (), Is.EqualTo ("{{1, 2}, {3, 4}}"), "ToString");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/ShadingTest.cs b/tests/monotouch-test/CoreGraphics/ShadingTest.cs
index 44220f4819c5..17c104a1f98b 100644
--- a/tests/monotouch-test/CoreGraphics/ShadingTest.cs
+++ b/tests/monotouch-test/CoreGraphics/ShadingTest.cs
@@ -55,7 +55,7 @@ void CreateShadingWithContentHeadroomTest (Func {
try {
using var hdrCapableColorspace = CGColorSpace.CreateWithName (CGColorSpaceNames.DisplayP3_PQ);
- Assert.IsTrue (hdrCapableColorspace.IsHdr, "IsHdr");
+ Assert.That (hdrCapableColorspace.IsHdr, Is.True, "IsHdr");
using var slopedFunction = FunctionTest.CreateSlopedFunction (() => functionCalled = true, 1, hdrCapableColorspace.Components + 1);
@@ -66,8 +66,8 @@ void CreateShadingWithContentHeadroomTest (Func Marshal.FreeHGlobal (v), out err)) {
- Assert.AreEqual (shape, arr.Shape, "2 Shape");
- Assert.AreEqual (MLMultiArrayDataType.Float32, arr.DataType, "2 DataType");
- Assert.AreEqual (strides, arr.Strides, "2 Strides");
- Assert.IsNull (err, "2 err");
+ Assert.That (arr.Shape, Is.EqualTo (shape), "2 Shape");
+ Assert.That (arr.DataType, Is.EqualTo (MLMultiArrayDataType.Float32), "2 DataType");
+ Assert.That (arr.Strides, Is.EqualTo (strides), "2 Strides");
+ Assert.That (err, Is.Null, "2 err");
}
using (var arr = new MLMultiArray (IntPtr.Zero, nsshape, MLMultiArrayDataType.Double, nsstrides, (v) => Marshal.FreeHGlobal (v), out err)) {
- Assert.AreEqual (shape, arr.Shape, "3 Shape");
- Assert.AreEqual (MLMultiArrayDataType.Double, arr.DataType, "3 DataType");
- Assert.AreEqual (strides, arr.Strides, "3 Strides");
- Assert.AreEqual (IntPtr.Zero, arr.DataPointer, "3 DataPointer");
- Assert.IsNull (err, "3 err");
+ Assert.That (arr.Shape, Is.EqualTo (shape), "3 Shape");
+ Assert.That (arr.DataType, Is.EqualTo (MLMultiArrayDataType.Double), "3 DataType");
+ Assert.That (arr.Strides, Is.EqualTo (strides), "3 Strides");
+ Assert.That (arr.DataPointer, Is.EqualTo (IntPtr.Zero), "3 DataPointer");
+ Assert.That (err, Is.Null, "3 err");
}
using (var arr = new MLMultiArray (nsshape, MLMultiArrayDataType.Int32, out err)) {
- Assert.AreEqual (shape, arr.Shape, "4 Shape");
- Assert.AreEqual (MLMultiArrayDataType.Int32, arr.DataType, "4 DataType");
- Assert.IsNull (err, "4 err");
+ Assert.That (arr.Shape, Is.EqualTo (shape), "4 Shape");
+ Assert.That (arr.DataType, Is.EqualTo (MLMultiArrayDataType.Int32), "4 DataType");
+ Assert.That (err, Is.Null, "4 err");
}
}
@@ -61,25 +61,25 @@ public void Indexers ()
NSError err;
var shape = new nint [] { 10 };
using (var arr = new MLMultiArray (shape, MLMultiArrayDataType.Int32, out err)) {
- Assert.IsNull (err, "err");
- Assert.AreEqual ((nint) 10, arr.Count, "Count");
- Assert.AreEqual (new nint [] { 10 }, arr.Shape, "Shape");
- Assert.AreEqual (new nint [] { 1 }, arr.Strides, "Strides");
+ Assert.That (err, Is.Null, "err");
+ Assert.That (arr.Count, Is.EqualTo ((nint) 10), "Count");
+ Assert.That (arr.Shape, Is.EqualTo (new nint [] { 10 }), "Shape");
+ Assert.That (arr.Strides, Is.EqualTo (new nint [] { 1 }), "Strides");
arr [0] = 0; // MLMultiArray's elements aren't zero-initialized
- Assert.AreEqual (0, arr [0].Int32Value, "a");
- Assert.AreEqual (0, arr [new nint [] { 0 }].Int32Value, "b");
- Assert.AreEqual (0, arr [new NSNumber [] { NSNumber.FromNInt (0) }].Int32Value, "c nint");
- Assert.AreEqual (0, arr [new NSNumber [] { NSNumber.FromInt32 (0) }].Int32Value, "c int32");
- Assert.AreEqual (0, arr [new NSNumber [] { NSNumber.FromByte (0) }].Int32Value, "c byte");
- Assert.AreEqual (0, arr [new NSNumber [] { NSNumber.FromFloat (0) }].Int32Value, "c float");
-
- Assert.AreEqual (0, arr.GetObject (0).Int32Value, "GetObject a");
- Assert.AreEqual (0, arr.GetObject (new nint [] { 0 }).Int32Value, "GetObject b");
- Assert.AreEqual (0, arr.GetObject (new NSNumber [] { NSNumber.FromNInt (0) }).Int32Value, "GetObject c nint");
- Assert.AreEqual (0, arr.GetObject (new NSNumber [] { NSNumber.FromInt32 (0) }).Int32Value, "GetObject c int32");
- Assert.AreEqual (0, arr.GetObject (new NSNumber [] { NSNumber.FromByte (0) }).Int32Value, "GetObject c byte");
- Assert.AreEqual (0, arr.GetObject (new NSNumber [] { NSNumber.FromFloat (0) }).Int32Value, "GetObject c float");
+ Assert.That (arr [0].Int32Value, Is.EqualTo (0), "a");
+ Assert.That (arr [new nint [] { 0 }].Int32Value, Is.EqualTo (0), "b");
+ Assert.That (arr [new NSNumber [] { NSNumber.FromNInt (0) }].Int32Value, Is.EqualTo (0), "c nint");
+ Assert.That (arr [new NSNumber [] { NSNumber.FromInt32 (0) }].Int32Value, Is.EqualTo (0), "c int32");
+ Assert.That (arr [new NSNumber [] { NSNumber.FromByte (0) }].Int32Value, Is.EqualTo (0), "c byte");
+ Assert.That (arr [new NSNumber [] { NSNumber.FromFloat (0) }].Int32Value, Is.EqualTo (0), "c float");
+
+ Assert.That (arr.GetObject (0).Int32Value, Is.EqualTo (0), "GetObject a");
+ Assert.That (arr.GetObject (new nint [] { 0 }).Int32Value, Is.EqualTo (0), "GetObject b");
+ Assert.That (arr.GetObject (new NSNumber [] { NSNumber.FromNInt (0) }).Int32Value, Is.EqualTo (0), "GetObject c nint");
+ Assert.That (arr.GetObject (new NSNumber [] { NSNumber.FromInt32 (0) }).Int32Value, Is.EqualTo (0), "GetObject c int32");
+ Assert.That (arr.GetObject (new NSNumber [] { NSNumber.FromByte (0) }).Int32Value, Is.EqualTo (0), "GetObject c byte");
+ Assert.That (arr.GetObject (new NSNumber [] { NSNumber.FromFloat (0) }).Int32Value, Is.EqualTo (0), "GetObject c float");
arr [1] = NSNumber.FromInt32 (1);
arr [new nint [] { 2 }] = NSNumber.FromInt32 (2);
@@ -88,28 +88,28 @@ public void Indexers ()
arr.SetObject (NSNumber.FromInt32 (5), new nint [] { 5 });
arr.SetObject (NSNumber.FromInt32 (6), new NSNumber [] { NSNumber.FromSByte (6) });
- Assert.AreEqual (1, arr [1].Int32Value, "1");
- Assert.AreEqual (2, arr [2].Int32Value, "2");
- Assert.AreEqual (3, arr [3].Int32Value, "3");
- Assert.AreEqual (4, arr [4].Int32Value, "4");
- Assert.AreEqual (5, arr [5].Int32Value, "5");
- Assert.AreEqual (6, arr [6].Int32Value, "6");
+ Assert.That (arr [1].Int32Value, Is.EqualTo (1), "1");
+ Assert.That (arr [2].Int32Value, Is.EqualTo (2), "2");
+ Assert.That (arr [3].Int32Value, Is.EqualTo (3), "3");
+ Assert.That (arr [4].Int32Value, Is.EqualTo (4), "4");
+ Assert.That (arr [5].Int32Value, Is.EqualTo (5), "5");
+ Assert.That (arr [6].Int32Value, Is.EqualTo (6), "6");
}
// multi-dimensional
shape = new nint [] { 7, 7, 7 };
using (var arr = new MLMultiArray (shape, MLMultiArrayDataType.Int32, out err)) {
- Assert.IsNull (err, "err");
- Assert.AreEqual (shape [0] * shape [1] * shape [2], arr.Count, "Count");
+ Assert.That (err, Is.Null, "err");
+ Assert.That (arr.Count, Is.EqualTo (shape [0] * shape [1] * shape [2]), "Count");
arr [0, 0, 0] = 0; // MLMultiArray's elements aren't zero-initialized
- Assert.AreEqual (0, arr [0, 0, 0].Int32Value, "a");
- Assert.AreEqual (0, arr [new nint [] { 0, 0, 0 }].Int32Value, "b");
- Assert.AreEqual (0, arr [new NSNumber [] { NSNumber.FromNInt (0), NSNumber.FromNInt (0), NSNumber.FromNInt (0) }].Int32Value, "c nint");
+ Assert.That (arr [0, 0, 0].Int32Value, Is.EqualTo (0), "a");
+ Assert.That (arr [new nint [] { 0, 0, 0 }].Int32Value, Is.EqualTo (0), "b");
+ Assert.That (arr [new NSNumber [] { NSNumber.FromNInt (0), NSNumber.FromNInt (0), NSNumber.FromNInt (0) }].Int32Value, Is.EqualTo (0), "c nint");
- Assert.AreEqual (0, arr.GetObject (0, 0, 0).Int32Value, "GetObject a");
- Assert.AreEqual (0, arr.GetObject (new nint [] { 0, 0, 0 }).Int32Value, "GetObject b");
- Assert.AreEqual (0, arr.GetObject (new NSNumber [] { NSNumber.FromNInt (0), NSNumber.FromNInt (0), NSNumber.FromNInt (0) }).Int32Value, "GetObject c nint");
+ Assert.That (arr.GetObject (0, 0, 0).Int32Value, Is.EqualTo (0), "GetObject a");
+ Assert.That (arr.GetObject (new nint [] { 0, 0, 0 }).Int32Value, Is.EqualTo (0), "GetObject b");
+ Assert.That (arr.GetObject (new NSNumber [] { NSNumber.FromNInt (0), NSNumber.FromNInt (0), NSNumber.FromNInt (0) }).Int32Value, Is.EqualTo (0), "GetObject c nint");
arr [1, 1, 1] = NSNumber.FromInt32 (1);
arr [new nint [] { 2, 2, 2 }] = NSNumber.FromInt32 (2);
@@ -118,12 +118,12 @@ public void Indexers ()
arr.SetObject (NSNumber.FromInt32 (5), new nint [] { 5, 5, 5 });
arr.SetObject (NSNumber.FromInt32 (6), new NSNumber [] { NSNumber.FromSByte (6), NSNumber.FromSByte (6), NSNumber.FromSByte (6) });
- Assert.AreEqual (1, arr [1, 1, 1].Int32Value, "1");
- Assert.AreEqual (2, arr [2, 2, 2].Int32Value, "2");
- Assert.AreEqual (3, arr [3, 3, 3].Int32Value, "3");
- Assert.AreEqual (4, arr [4, 4, 4].Int32Value, "4");
- Assert.AreEqual (5, arr [5, 5, 5].Int32Value, "5");
- Assert.AreEqual (6, arr [6, 6, 6].Int32Value, "6");
+ Assert.That (arr [1, 1, 1].Int32Value, Is.EqualTo (1), "1");
+ Assert.That (arr [2, 2, 2].Int32Value, Is.EqualTo (2), "2");
+ Assert.That (arr [3, 3, 3].Int32Value, Is.EqualTo (3), "3");
+ Assert.That (arr [4, 4, 4].Int32Value, Is.EqualTo (4), "4");
+ Assert.That (arr [5, 5, 5].Int32Value, Is.EqualTo (5), "5");
+ Assert.That (arr [6, 6, 6].Int32Value, Is.EqualTo (6), "6");
}
}
}
diff --git a/tests/monotouch-test/CoreMedia/BlockBufferTest.cs b/tests/monotouch-test/CoreMedia/BlockBufferTest.cs
index 484fcf00989c..63bf6a07703c 100644
--- a/tests/monotouch-test/CoreMedia/BlockBufferTest.cs
+++ b/tests/monotouch-test/CoreMedia/BlockBufferTest.cs
@@ -31,7 +31,7 @@ public void CreateEmpty ()
public void CMBlockBufferCustomBlockSource ()
{
var type = typeof (CMCustomBlockAllocator).GetNestedType ("CMBlockBufferCustomBlockSource", BindingFlags.NonPublic);
- Assert.NotNull (type, "CMBlockBufferCustomBlockSource");
+ Assert.That (type, Is.Not.Null, "CMBlockBufferCustomBlockSource");
// it's 28 (not 32) bytes when executed on 64bits iOS, which implies it's packed to 4 bytes
#pragma warning disable IL3050 // Using member 'System.Runtime.InteropServices.Marshal.SizeOf(Type)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. Marshalling code for the object might not be available. Use the SizeOf overload instead.
Assert.That (Marshal.SizeOf (type), Is.EqualTo (4 + 3 * IntPtr.Size), "Size");
@@ -75,7 +75,7 @@ public void AppendMemoryBlockTest ()
Assert.That (err2, Is.EqualTo (CMBlockBufferError.None), "AppendMemoryBlock error");
Assert.That (bb.DataLength, Is.EqualTo ((nuint) 10), "FromMemoryBlock DataLength");
}
- Assert.IsTrue (freeCalled, "FromMemoryBlock FreeCalled");
+ Assert.That (freeCalled, Is.True, "FromMemoryBlock FreeCalled");
}
public bool allocateCalled;
@@ -107,9 +107,9 @@ public void FromMemoryBlockAndContiguousTest ()
using (var bb = CMBlockBuffer.FromMemoryBlock (IntPtr.Zero, 16, allocator, 0, 5, CMBlockBufferFlags.AssureMemoryNow, out err1)) {
Assert.That (err1, Is.EqualTo (CMBlockBufferError.None), "FromMemoryBlock error");
Assert.That (bb.DataLength, Is.EqualTo ((nuint) 5), "FromMemoryBlock DataLength");
- Assert.IsTrue (allocateCalled, "FromMemoryBlock AllocateCalled");
+ Assert.That (allocateCalled, Is.True, "FromMemoryBlock AllocateCalled");
}
- Assert.IsTrue (freeCalled, "FromMemoryBlock FreeCalled");
+ Assert.That (freeCalled, Is.True, "FromMemoryBlock FreeCalled");
}
class CustomAllocator : CMCustomBlockAllocator {
@@ -209,7 +209,7 @@ public void CopyDataBytesTest ()
err = buf.CopyDataBytes (0, (uint) data.Length, destPointer);
Assert.That (err, Is.EqualTo (CMBlockBufferError.None), $"CMBlockBufferError 2: {err}");
for (int i = 0; i < data.Length; i++)
- Assert.AreEqual (data [0], destData [0], $"CMBlockBuffer CopyDataBytesTest iteration: {i}");
+ Assert.That (destData [0], Is.EqualTo (data [0]), $"CMBlockBuffer CopyDataBytesTest iteration: {i}");
}
pinned.Free ();
destPinned.Free ();
@@ -227,7 +227,7 @@ public void CopyDataBytesUsingManagedArrayTest ()
err = buf.CopyDataBytes (0, (uint) data.Length, out destData);
Assert.That (err, Is.EqualTo (CMBlockBufferError.None), $"CMBlockBufferError 2: {err}");
for (int i = 0; i < data.Length; i++)
- Assert.AreEqual (data [0], destData [0], $"CMBlockBuffer CopyDataBytesUsingManagedArrayTest iteration: {i}");
+ Assert.That (destData [0], Is.EqualTo (data [0]), $"CMBlockBuffer CopyDataBytesUsingManagedArrayTest iteration: {i}");
}
}
@@ -248,7 +248,7 @@ public void ReplaceDataBytesTest ()
err = buf.ReplaceDataBytes (replacePointer, 0, (uint) replaceData.Length);
Assert.That (err, Is.EqualTo (CMBlockBufferError.None), $"CMBlockBufferError 2: {err}");
for (int i = 0; i < data.Length; i++)
- Assert.AreEqual (0x5, data [0], $"CMBlockBuffer ReplaceDataBytesTest iteration: {i}");
+ Assert.That (data [0], Is.EqualTo (0x5), $"CMBlockBuffer ReplaceDataBytesTest iteration: {i}");
}
pinned.Free ();
replacePinned.Free ();
@@ -267,7 +267,7 @@ public void ReplaceDataBytesManagedTest ()
err = buf.ReplaceDataBytes (replaceData, 0);
Assert.That (err, Is.EqualTo (CMBlockBufferError.None), $"CMBlockBufferError 2: {err}");
for (int i = 0; i < data.Length; i++)
- Assert.AreEqual (0x5, data [0], $"CMBlockBuffer ReplaceDataBytesManagedTest iteration: {i}");
+ Assert.That (data [0], Is.EqualTo (0x5), $"CMBlockBuffer ReplaceDataBytesManagedTest iteration: {i}");
}
}
@@ -290,7 +290,7 @@ public void AccessDataBytesTest ()
Marshal.Copy (outPtr, tempBuffer, 0, 5);
for (int i = 0; i < tempBuffer.Length; i++)
- Assert.AreEqual ((byte) (i + 5), tempBuffer [i], $"CMBlockBuffer AccessDataBytesTest iteration: {i}");
+ Assert.That (tempBuffer [i], Is.EqualTo ((byte) (i + 5)), $"CMBlockBuffer AccessDataBytesTest iteration: {i}");
}
pinned.Free ();
tempBufferPinned.Free ();
@@ -315,7 +315,7 @@ public void GetDataPointerTest ()
Marshal.Copy (outPtr, tempBuffer, 0, (int) lengthAtOffset);
for (int i = 0; i < tempBuffer.Length; i++)
- Assert.AreEqual ((byte) (i + 5), tempBuffer [i], $"CMBlockBuffer GetDataPointerTest iteration: {i}");
+ Assert.That (tempBuffer [i], Is.EqualTo ((byte) (i + 5)), $"CMBlockBuffer GetDataPointerTest iteration: {i}");
}
pinned.Free ();
}
diff --git a/tests/monotouch-test/CoreMedia/CMClockOrTimebaseTest.cs b/tests/monotouch-test/CoreMedia/CMClockOrTimebaseTest.cs
index 48a7673b80d1..4498f90a386f 100644
--- a/tests/monotouch-test/CoreMedia/CMClockOrTimebaseTest.cs
+++ b/tests/monotouch-test/CoreMedia/CMClockOrTimebaseTest.cs
@@ -15,7 +15,7 @@ public void RetainReleaseTest ()
var clock = CMClock.HostTimeClock;
var timebase = Runtime.GetINativeObject (clock.Handle, false);
// we should be able to dispose the clock and the timebase with no crashes.
- Assert.AreEqual (clock.Handle, timebase.Handle);
+ Assert.That (timebase.Handle, Is.EqualTo (clock.Handle));
clock.Dispose ();
timebase.Dispose ();
}
diff --git a/tests/monotouch-test/CoreMedia/CMClockTest.cs b/tests/monotouch-test/CoreMedia/CMClockTest.cs
index 24b4e11c93ab..1e5741e9c771 100644
--- a/tests/monotouch-test/CoreMedia/CMClockTest.cs
+++ b/tests/monotouch-test/CoreMedia/CMClockTest.cs
@@ -28,7 +28,7 @@ public void CreateAudioClock ()
using (var clock = CMClock.CreateAudioClock (out ce)) {
if (ce == (CMClockError) (-101))
TestRuntime.IgnoreInCI ("For unknown reasons, we might get -101 as an error code on the bots sometimes.");
- Assert.AreEqual (CMClockError.None, ce);
+ Assert.That (ce, Is.EqualTo (CMClockError.None));
}
}
#endif
diff --git a/tests/monotouch-test/CoreMedia/CMFormatDescriptionTest.cs b/tests/monotouch-test/CoreMedia/CMFormatDescriptionTest.cs
index b9fb6269ee4f..9f994c640160 100644
--- a/tests/monotouch-test/CoreMedia/CMFormatDescriptionTest.cs
+++ b/tests/monotouch-test/CoreMedia/CMFormatDescriptionTest.cs
@@ -25,10 +25,10 @@ public void ClosedCaption ()
{
CMFormatDescriptionError fde;
using (var fd = CMFormatDescription.Create (CMMediaType.ClosedCaption, (uint) CMClosedCaptionFormatType.CEA608, out fde)) {
- Assert.AreEqual (CMFormatDescriptionError.None, fde, "#1");
- Assert.AreEqual ((CMMuxedStreamType) 0, fd.MuxedStreamType, "#2");
- Assert.AreEqual (CMMediaType.ClosedCaption, fd.MediaType, "#3");
- Assert.AreEqual (CMClosedCaptionFormatType.CEA608, fd.ClosedCaptionFormatType, "#4");
+ Assert.That (fde, Is.EqualTo (CMFormatDescriptionError.None), "#1");
+ Assert.That (fd.MuxedStreamType, Is.EqualTo ((CMMuxedStreamType) 0), "#2");
+ Assert.That (fd.MediaType, Is.EqualTo (CMMediaType.ClosedCaption), "#3");
+ Assert.That (fd.ClosedCaptionFormatType, Is.EqualTo (CMClosedCaptionFormatType.CEA608), "#4");
}
}
@@ -47,12 +47,12 @@ public void Video ()
case AVAuthorizationStatus.Denied:
case AVAuthorizationStatus.NotDetermined:
// We can't test the below, since the some other tests may have initialized whatever we need for the API to work correctly.
- // Assert.Null (CMFormatDescription.Create (CMMediaType.Video, (uint) CMVideoCodecType.H264, out fde), "null ({0})", auth);
+ // Assert.That (CMFormatDescription.Create (CMMediaType.Video, (uint) CMVideoCodecType.H264, out fde), Is.Null, "null ({0})", auth);
// Assert.That (fde, Is.EqualTo (CMFormatDescriptionError.InvalidParameter), "CMFormatDescriptionError");
break;
case AVAuthorizationStatus.Authorized:
// We can't test the below, since the some other tests may have initialized whatever we need for the API to work correctly.
- // Assert.Null (CMFormatDescription.Create (CMMediaType.Video, (uint) CMVideoCodecType.H264, out fde), "null (authorized)");
+ // Assert.That (CMFormatDescription.Create (CMMediaType.Video, (uint) CMVideoCodecType.H264, out fde), Is.Null, "null (authorized)");
// Assert.That (fde, Is.EqualTo (CMFormatDescriptionError.InvalidParameter), "CMFormatDescriptionError (authorized)");
using (var captureSession = new AVCaptureSession ()) {
@@ -66,7 +66,7 @@ public void Video ()
}
}
- Assert.IsNotNull (CMFormatDescription.Create (CMMediaType.Video, (uint) CMVideoCodecType.H264, out fde), "not null (authorized)");
+ Assert.That (CMFormatDescription.Create (CMMediaType.Video, (uint) CMVideoCodecType.H264, out fde), Is.Not.Null, "not null (authorized)");
Assert.That (fde, Is.EqualTo (CMFormatDescriptionError.None), "CMFormatDescriptionError #2 (authorized)");
break;
}
@@ -117,7 +117,7 @@ public void H264ParameterSetsTest ()
var desc = CMVideoFormatDescription.FromH264ParameterSets (props, 4, out error);
props = null;
Assert.That (error == CMFormatDescriptionError.None, "H264ParameterSetsTest");
- Assert.NotNull (desc, "H264ParameterSetsTest");
+ Assert.That (desc, Is.Not.Null, "H264ParameterSetsTest");
Assert.That (desc.Dimensions.Height == 1080 && desc.Dimensions.Width == 1920, "H264ParameterSetsTest");
CMFormatDescriptionError err;
@@ -125,14 +125,14 @@ public void H264ParameterSetsTest ()
int nalCount;
var bytes = desc.GetH264ParameterSet (0, out paramCount, out nalCount, out err);
Assert.That (err == CMFormatDescriptionError.None, "H264ParameterSetsTest");
- Assert.NotNull (bytes, "H264ParameterSetsTest");
- Assert.True (nalCount == 4 && paramCount == 2);
+ Assert.That (bytes, Is.Not.Null, "H264ParameterSetsTest");
+ Assert.That (nalCount == 4 && paramCount == 2, Is.True);
Assert.That (arr0, Is.EqualTo (bytes), "H264ParameterSetsTest roundtrip");
bytes = desc.GetH264ParameterSet (1, out paramCount, out nalCount, out err);
Assert.That (err == CMFormatDescriptionError.None, "H264ParameterSetsTest");
- Assert.NotNull (bytes, "H264ParameterSetsTest");
- Assert.True (nalCount == 4 && paramCount == 2);
+ Assert.That (bytes, Is.Not.Null, "H264ParameterSetsTest");
+ Assert.That (nalCount == 4 && paramCount == 2, Is.True);
Assert.That (arr1, Is.EqualTo (bytes), "H264ParameterSetsTest roundtrip");
}
@@ -151,7 +151,7 @@ public void HevcParameterSetsTest ()
props = null;
Assert.That (error == CMFormatDescriptionError.None, "HevcParameterSetsTest 1");
- Assert.NotNull (desc, "HevcParameterSetsTest 2");
+ Assert.That (desc, Is.Not.Null, "HevcParameterSetsTest 2");
Assert.That (desc.Dimensions.Height == 720 && desc.Dimensions.Width == 1280, "HevcParameterSetsTest 3");
CMFormatDescriptionError err;
@@ -159,20 +159,20 @@ public void HevcParameterSetsTest ()
int nalCount;
var bytes = desc.GetHevcParameterSet (0, out paramCount, out nalCount, out err);
Assert.That (err == CMFormatDescriptionError.None, "HevcParameterSetsTest arr0 1");
- Assert.NotNull (bytes, "HevcParameterSetsTest arr0 2");
- Assert.True (nalCount == 4 && paramCount == 3);
+ Assert.That (bytes, Is.Not.Null, "HevcParameterSetsTest arr0 2");
+ Assert.That (nalCount == 4 && paramCount == 3, Is.True);
Assert.That (arr0, Is.EqualTo (bytes), "HevcParameterSetsTest arr0 roundtrip");
bytes = desc.GetHevcParameterSet (1, out paramCount, out nalCount, out err);
Assert.That (err == CMFormatDescriptionError.None, "HevcParameterSetsTest arr1 1");
- Assert.NotNull (bytes, "HevcParameterSetsTest arr1 2");
- Assert.True (nalCount == 4 && paramCount == 3);
+ Assert.That (bytes, Is.Not.Null, "HevcParameterSetsTest arr1 2");
+ Assert.That (nalCount == 4 && paramCount == 3, Is.True);
Assert.That (arr1, Is.EqualTo (bytes), "HevcParameterSetsTest arr1 roundtrip");
bytes = desc.GetHevcParameterSet (2, out paramCount, out nalCount, out err);
Assert.That (err == CMFormatDescriptionError.None, "HevcParameterSetsTest arr2 1");
- Assert.NotNull (bytes, "HevcParameterSetsTest arr2 2");
- Assert.True (nalCount == 4 && paramCount == 3);
+ Assert.That (bytes, Is.Not.Null, "HevcParameterSetsTest arr2 2");
+ Assert.That (nalCount == 4 && paramCount == 3, Is.True);
Assert.That (arr2, Is.EqualTo (bytes), "HevcParameterSetsTest arr2 roundtrip");
}
@@ -180,30 +180,30 @@ public void HevcParameterSetsTest ()
public void VideoFormatDescriptionConstructors ()
{
using (var obj = new CMVideoFormatDescription (CMVideoCodecType.H264, new CMVideoDimensions (960, 540))) {
- Assert.AreEqual (960, obj.Dimensions.Width, "Width #1");
- Assert.AreEqual (540, obj.Dimensions.Height, "Height #1");
- Assert.AreEqual (CMVideoCodecType.H264, obj.VideoCodecType, "VideoCodecType #1");
- Assert.IsNull (obj.GetExtensions (), "Extensions #1");
+ Assert.That (obj.Dimensions.Width, Is.EqualTo (960), "Width #1");
+ Assert.That (obj.Dimensions.Height, Is.EqualTo (540), "Height #1");
+ Assert.That (obj.VideoCodecType, Is.EqualTo (CMVideoCodecType.H264), "VideoCodecType #1");
+ Assert.That (obj.GetExtensions (), Is.Null, "Extensions #1");
}
using (var obj = new CMVideoFormatDescription (CMVideoCodecType.H263, new CMVideoDimensions (480, 270), (NSDictionary?) null)) {
- Assert.AreEqual (480, obj.Dimensions.Width, "Width #2");
- Assert.AreEqual (270, obj.Dimensions.Height, "Height #2");
- Assert.AreEqual (CMVideoCodecType.H263, obj.VideoCodecType, "VideoCodecType #2");
- Assert.IsNull (obj.GetExtensions (), "Extensions #2");
+ Assert.That (obj.Dimensions.Width, Is.EqualTo (480), "Width #2");
+ Assert.That (obj.Dimensions.Height, Is.EqualTo (270), "Height #2");
+ Assert.That (obj.VideoCodecType, Is.EqualTo (CMVideoCodecType.H263), "VideoCodecType #2");
+ Assert.That (obj.GetExtensions (), Is.Null, "Extensions #2");
}
var extensions = new CMFormatDescriptionExtensions () {
BytesPerRow = 24,
};
using (var obj = new CMVideoFormatDescription (CMVideoCodecType.H263, new CMVideoDimensions (480, 270), extensions)) {
- Assert.AreEqual (480, obj.Dimensions.Width, "Width #3");
- Assert.AreEqual (270, obj.Dimensions.Height, "Height #3");
- Assert.AreEqual (CMVideoCodecType.H263, obj.VideoCodecType, "VideoCodecType #3");
+ Assert.That (obj.Dimensions.Width, Is.EqualTo (480), "Width #3");
+ Assert.That (obj.Dimensions.Height, Is.EqualTo (270), "Height #3");
+ Assert.That (obj.VideoCodecType, Is.EqualTo (CMVideoCodecType.H263), "VideoCodecType #3");
var dict = obj.GetExtensions ();
var ext = new CMFormatDescriptionExtensions (dict);
- Assert.IsNotNull (ext, "Extensions #3");
- Assert.AreEqual (24, ext.BytesPerRow, "Extensions.BytesPerRow #3");
+ Assert.That (ext, Is.Not.Null, "Extensions #3");
+ Assert.That (ext.BytesPerRow, Is.EqualTo (24), "Extensions.BytesPerRow #3");
}
}
diff --git a/tests/monotouch-test/CoreMedia/CMMemoryPoolTest.cs b/tests/monotouch-test/CoreMedia/CMMemoryPoolTest.cs
index e481c8a91ade..701116454ca3 100644
--- a/tests/monotouch-test/CoreMedia/CMMemoryPoolTest.cs
+++ b/tests/monotouch-test/CoreMedia/CMMemoryPoolTest.cs
@@ -22,7 +22,7 @@ public void Ctor ()
using (var mp = new CMMemoryPool ()) {
var allocator = mp.GetAllocator ();
var ptr = allocator.Allocate (55);
- Assert.AreNotEqual (IntPtr.Zero, ptr);
+ Assert.That (ptr, Is.Not.EqualTo (IntPtr.Zero));
allocator.Deallocate (ptr);
}
}
@@ -35,7 +35,7 @@ public void CtorAgeOutPeriod ()
using (var mp = new CMMemoryPool (TimeSpan.FromSeconds (40))) {
var allocator = mp.GetAllocator ();
var ptr = allocator.Allocate (2);
- Assert.AreNotEqual (IntPtr.Zero, ptr);
+ Assert.That (ptr, Is.Not.EqualTo (IntPtr.Zero));
allocator.Deallocate (ptr);
}
}
diff --git a/tests/monotouch-test/CoreMedia/CMTagCollectionTests.cs b/tests/monotouch-test/CoreMedia/CMTagCollectionTests.cs
index 57db0e5a1a6c..36c99149b63e 100644
--- a/tests/monotouch-test/CoreMedia/CMTagCollectionTests.cs
+++ b/tests/monotouch-test/CoreMedia/CMTagCollectionTests.cs
@@ -23,7 +23,7 @@ public void GetTypeIdTest ()
{
TestRuntime.AssertXcodeVersion (15, 0);
- Assert.AreNotEqual (0, CMTagCollection.GetTypeId (), "GetTypeId");
+ Assert.That (CMTagCollection.GetTypeId (), Is.Not.EqualTo (0), "GetTypeId");
}
[Test]
@@ -33,26 +33,26 @@ public void CreateTest ()
{
using var tagCollection = CMTagCollection.Create ();
- Assert.AreEqual (0, (int) tagCollection.Count, "Count A");
- Assert.IsTrue (tagCollection.IsEmpty, "IsEmpty A");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (0), "Count A");
+ Assert.That (tagCollection.IsEmpty, Is.True, "IsEmpty A");
}
{
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo);
- Assert.AreEqual (1, (int) tagCollection.Count, "Count B");
- Assert.IsFalse (tagCollection.IsEmpty, "IsEmpty B");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (1), "Count B");
+ Assert.That (tagCollection.IsEmpty, Is.False, "IsEmpty B");
}
{
using var tagCollection = CMTagCollection.Create (new CMTag [] { CMTag.MediaTypeVideo });
- Assert.AreEqual (1, (int) tagCollection.Count, "Count C");
- Assert.IsFalse (tagCollection.IsEmpty, "IsEmpty C");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (1), "Count C");
+ Assert.That (tagCollection.IsEmpty, Is.False, "IsEmpty C");
}
{
using var tagCollection = CMTagCollection.Create ((CMTag []) null);
- Assert.AreEqual (0, (int) tagCollection.Count, "Count D");
- Assert.IsTrue (tagCollection.IsEmpty, "IsEmpty D");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (0), "Count D");
+ Assert.That (tagCollection.IsEmpty, Is.True, "IsEmpty D");
}
}
@@ -63,30 +63,30 @@ public void CreateTest_OSStatus ()
{
using var tagCollection = CMTagCollection.Create (out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status A");
- Assert.AreEqual (0, (int) tagCollection.Count, "Count A");
- Assert.IsTrue (tagCollection.IsEmpty, "IsEmpty A");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status A");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (0), "Count A");
+ Assert.That (tagCollection.IsEmpty, Is.True, "IsEmpty A");
}
{
using var tagCollection = CMTagCollection.Create (out var status, CMTag.MediaTypeVideo);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status B");
- Assert.AreEqual (1, (int) tagCollection.Count, "Count B");
- Assert.IsFalse (tagCollection.IsEmpty, "IsEmpty B");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status B");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (1), "Count B");
+ Assert.That (tagCollection.IsEmpty, Is.False, "IsEmpty B");
}
{
using var tagCollection = CMTagCollection.Create (out var status, new CMTag [] { CMTag.MediaTypeVideo });
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status C");
- Assert.AreEqual (1, (int) tagCollection.Count, "Count C");
- Assert.IsFalse (tagCollection.IsEmpty, "IsEmpty C");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status C");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (1), "Count C");
+ Assert.That (tagCollection.IsEmpty, Is.False, "IsEmpty C");
}
{
using var tagCollection = CMTagCollection.Create (out var status, (CMTag []) null);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status D");
- Assert.AreEqual (0, (int) tagCollection.Count, "Count D");
- Assert.IsTrue (tagCollection.IsEmpty, "IsEmpty D");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status D");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (0), "Count D");
+ Assert.That (tagCollection.IsEmpty, Is.True, "IsEmpty D");
}
}
@@ -97,28 +97,28 @@ public void CreateMutableTest ()
{
using var tagCollection = CMTagCollection.CreateMutable (out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status A");
- Assert.AreEqual (0, (int) tagCollection.Count, "Count A");
- Assert.IsTrue (tagCollection.IsEmpty, "IsEmpty A");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status A");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (0), "Count A");
+ Assert.That (tagCollection.IsEmpty, Is.True, "IsEmpty A");
}
{
using var tagCollection = CMTagCollection.CreateMutable (1, out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status B");
- Assert.AreEqual (0, (int) tagCollection.Count, "Count B");
- Assert.IsTrue (tagCollection.IsEmpty, "IsEmpty B");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status B");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (0), "Count B");
+ Assert.That (tagCollection.IsEmpty, Is.True, "IsEmpty B");
}
{
using var tagCollection = CMTagCollection.CreateMutable (-1, out var status);
- Assert.AreEqual (CMTagCollectionError.ParamErr, status, "Status C");
- Assert.IsNull (tagCollection, "Null C");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.ParamErr), "Status C");
+ Assert.That (tagCollection, Is.Null, "Null C");
}
{
using var tagCollection = CMTagCollection.CreateMutable ();
- Assert.AreEqual (0, (int) tagCollection.Count, "Count D");
- Assert.IsTrue (tagCollection.IsEmpty, "IsEmpty D");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (0), "Count D");
+ Assert.That (tagCollection.IsEmpty, Is.True, "IsEmpty D");
}
}
@@ -128,13 +128,13 @@ public void CopyTest ()
TestRuntime.AssertXcodeVersion (15, 0);
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo);
- Assert.AreEqual (1, (int) tagCollection.Count, "Count A");
- Assert.IsFalse (tagCollection.IsEmpty, "IsEmpty A");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (1), "Count A");
+ Assert.That (tagCollection.IsEmpty, Is.False, "IsEmpty A");
using var copy = tagCollection.Copy (out var status);
- Assert.AreEqual (1, (int) copy.Count, "Count B");
- Assert.IsFalse (copy.IsEmpty, "IsEmpty B");
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status B");
+ Assert.That ((int) copy.Count, Is.EqualTo (1), "Count B");
+ Assert.That (copy.IsEmpty, Is.False, "IsEmpty B");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status B");
}
[Test]
@@ -143,13 +143,13 @@ public void CreateMutableCopyTest ()
TestRuntime.AssertXcodeVersion (15, 0);
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo);
- Assert.AreEqual (1, (int) tagCollection.Count, "Count A");
- Assert.IsFalse (tagCollection.IsEmpty, "IsEmpty A");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (1), "Count A");
+ Assert.That (tagCollection.IsEmpty, Is.False, "IsEmpty A");
using var copy = tagCollection.CreateMutableCopy (out var status);
- Assert.AreEqual (1, (int) copy.Count, "Count B");
- Assert.IsFalse (copy.IsEmpty, "IsEmpty B");
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status B");
+ Assert.That ((int) copy.Count, Is.EqualTo (1), "Count B");
+ Assert.That (copy.IsEmpty, Is.False, "IsEmpty B");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status B");
}
[Test]
@@ -158,7 +158,7 @@ public void ToStringTest ()
TestRuntime.AssertXcodeVersion (15, 0);
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo);
- Assert.AreEqual ("CMTagCollection{\n{category:'mdia' value:'vide' }\n}", tagCollection.ToString (), "ToString");
+ Assert.That (tagCollection.ToString (), Is.EqualTo ("CMTagCollection{\n{category:'mdia' value:'vide' }\n}"), "ToString");
}
[Test]
@@ -167,8 +167,8 @@ public void ContainsTagTest ()
TestRuntime.AssertXcodeVersion (15, 0);
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo);
- Assert.AreEqual (true, tagCollection.ContainsTag (CMTag.MediaTypeVideo), "MediaTypeVideo");
- Assert.AreEqual (false, tagCollection.ContainsTag (CMTag.MediaTypeAudio), "MediaTypeAudio");
+ Assert.That (tagCollection.ContainsTag (CMTag.MediaTypeVideo), Is.EqualTo (true), "MediaTypeVideo");
+ Assert.That (tagCollection.ContainsTag (CMTag.MediaTypeAudio), Is.EqualTo (false), "MediaTypeAudio");
}
[Test]
@@ -178,8 +178,8 @@ public void ContainsTagCollectionTest ()
using var tagCollection1 = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
using var tagCollection2 = CMTagCollection.Create (CMTag.MediaTypeAudio);
- Assert.AreEqual (true, tagCollection1.ContainsTagCollection (tagCollection2), "1");
- Assert.AreEqual (false, tagCollection2.ContainsTagCollection (tagCollection1), "2");
+ Assert.That (tagCollection1.ContainsTagCollection (tagCollection2), Is.EqualTo (true), "1");
+ Assert.That (tagCollection2.ContainsTagCollection (tagCollection1), Is.EqualTo (false), "2");
Assert.Throws (() => tagCollection1.ContainsTagCollection (null), "Null");
}
@@ -190,10 +190,10 @@ public void ContainsTagsTest ()
TestRuntime.AssertXcodeVersion (15, 0);
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
- Assert.AreEqual (true, tagCollection.ContainsTags (CMTag.MediaTypeVideo), "MediaTypeVideo");
- Assert.AreEqual (true, tagCollection.ContainsTags (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio), "MediaTypeVideo+MediaTypeAudio");
- Assert.AreEqual (false, tagCollection.ContainsTags (CMTag.MediaTypeVideo, CMTag.PackingTypeNone), "MediaTypeVideo+PackingTypeNone");
- Assert.AreEqual (false, tagCollection.ContainsTags (CMTag.PackingTypeNone), "PackingTypeNone");
+ Assert.That (tagCollection.ContainsTags (CMTag.MediaTypeVideo), Is.EqualTo (true), "MediaTypeVideo");
+ Assert.That (tagCollection.ContainsTags (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio), Is.EqualTo (true), "MediaTypeVideo+MediaTypeAudio");
+ Assert.That (tagCollection.ContainsTags (CMTag.MediaTypeVideo, CMTag.PackingTypeNone), Is.EqualTo (false), "MediaTypeVideo+PackingTypeNone");
+ Assert.That (tagCollection.ContainsTags (CMTag.PackingTypeNone), Is.EqualTo (false), "PackingTypeNone");
}
[Test]
@@ -202,8 +202,8 @@ public void ContainsCategoryTest ()
TestRuntime.AssertXcodeVersion (15, 0);
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
- Assert.AreEqual (false, tagCollection.ContainsCategory (CMTagCategory.ProjectionType), "ProjectionType");
- Assert.AreEqual (true, tagCollection.ContainsCategory (CMTagCategory.MediaType), "MediaType");
+ Assert.That (tagCollection.ContainsCategory (CMTagCategory.ProjectionType), Is.EqualTo (false), "ProjectionType");
+ Assert.That (tagCollection.ContainsCategory (CMTagCategory.MediaType), Is.EqualTo (true), "MediaType");
}
[Test]
@@ -212,8 +212,8 @@ public void GetCountTest ()
TestRuntime.AssertXcodeVersion (15, 0);
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
- Assert.AreEqual (0, (int) tagCollection.GetCount (CMTagCategory.ProjectionType), "ProjectionType");
- Assert.AreEqual (2, (int) tagCollection.GetCount (CMTagCategory.MediaType), "MediaType");
+ Assert.That ((int) tagCollection.GetCount (CMTagCategory.ProjectionType), Is.EqualTo (0), "ProjectionType");
+ Assert.That ((int) tagCollection.GetCount (CMTagCategory.MediaType), Is.EqualTo (2), "MediaType");
}
[Test]
@@ -223,7 +223,7 @@ public void TagsTest ()
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
var tags = tagCollection.Tags;
- Assert.AreEqual (2, tags.Length, "Length");
+ Assert.That (tags.Length, Is.EqualTo (2), "Length");
}
[Test]
@@ -233,8 +233,8 @@ public void GetTagsTest ()
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
var tags = tagCollection.GetTags (out var status);
- Assert.AreEqual (2, tags.Length, "Length");
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status");
+ Assert.That (tags.Length, Is.EqualTo (2), "Length");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status");
}
[Test]
@@ -245,10 +245,10 @@ public void GetTags2Test ()
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
var tags = new CMTag [1];
var status = tagCollection.GetTags (tags, tags.Length, out var tagsCopied);
- Assert.AreEqual (1, tags.Length, "Length");
- Assert.AreEqual (1, (int) tagsCopied, "Tags Copied");
- Assert.AreEqual (CMTagCollectionError.ExhaustedBufferSize, status, "Status");
- Assert.IsTrue (tags [0].IsValid, "Tags[0].IsValid");
+ Assert.That (tags.Length, Is.EqualTo (1), "Length");
+ Assert.That ((int) tagsCopied, Is.EqualTo (1), "Tags Copied");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.ExhaustedBufferSize), "Status");
+ Assert.That (tags [0].IsValid, Is.True, "Tags[0].IsValid");
Assert.Throws (() => tagCollection.GetTags (tags, tags.Length + 1, out tagsCopied), "AOORE");
Assert.Throws (() => tagCollection.GetTags (tags, -1, out tagsCopied), "AOORE 2");
@@ -261,8 +261,8 @@ public void GetTagsForCategoryTest ()
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
var tags = tagCollection.GetTags (CMTagCategory.MediaType, out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status");
- Assert.AreEqual (2, tags.Length, "Length");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status");
+ Assert.That (tags.Length, Is.EqualTo (2), "Length");
}
[Test]
@@ -273,10 +273,10 @@ public void GetTagsForCategory2Test ()
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
var tags = new CMTag [1];
var status = tagCollection.GetTags (CMTagCategory.MediaType, tags, tags.Length, out var tagsCopied);
- Assert.AreEqual (1, tags.Length, "Length");
- Assert.AreEqual (1, (int) tagsCopied, "Tags Copied");
- Assert.AreEqual (CMTagCollectionError.ExhaustedBufferSize, status, "Status");
- Assert.IsTrue (tags [0].IsValid, "Tags[0].IsValid");
+ Assert.That (tags.Length, Is.EqualTo (1), "Length");
+ Assert.That ((int) tagsCopied, Is.EqualTo (1), "Tags Copied");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.ExhaustedBufferSize), "Status");
+ Assert.That (tags [0].IsValid, Is.True, "Tags[0].IsValid");
Assert.Throws (() => tagCollection.GetTags (CMTagCategory.MediaType, tags, tags.Length + 1, out var tagsCopied), "AOORE");
Assert.Throws (() => tagCollection.GetTags (CMTagCategory.MediaType, tags, -1, out var tagsCopied), "AOORE 2");
@@ -288,7 +288,7 @@ public void GetCount_Filter ()
TestRuntime.AssertXcodeVersion (15, 0);
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
- Assert.AreEqual (2, (int) tagCollection.GetCount ((v) => v.Category == CMTagCategory.MediaType), "Count");
+ Assert.That ((int) tagCollection.GetCount ((v) => v.Category == CMTagCategory.MediaType), Is.EqualTo (2), "Count");
}
[Test]
@@ -298,7 +298,7 @@ public void GetTags_Filter ()
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
var count = tagCollection.GetCount ((v) => v.Category == CMTagCategory.MediaType);
- Assert.AreEqual (2, (int) count, "Count");
+ Assert.That ((int) count, Is.EqualTo (2), "Count");
}
[Test]
@@ -309,10 +309,10 @@ public void GetTags2_Filter ()
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
var tags = new CMTag [1];
var status = tagCollection.GetTags ((v) => v.Category == CMTagCategory.MediaType, tags, tags.Length, out var tagsCopied);
- Assert.AreEqual (1, tags.Length, "Length");
- Assert.AreEqual (1, (int) tagsCopied, "Tags Copied");
- Assert.AreEqual (CMTagCollectionError.ExhaustedBufferSize, status, "Status");
- Assert.IsTrue (tags [0].IsValid, "Tags[0].IsValid");
+ Assert.That (tags.Length, Is.EqualTo (1), "Length");
+ Assert.That ((int) tagsCopied, Is.EqualTo (1), "Tags Copied");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.ExhaustedBufferSize), "Status");
+ Assert.That (tags [0].IsValid, Is.True, "Tags[0].IsValid");
Assert.Throws (() => tagCollection.GetTags ((v) => v.Category == CMTagCategory.MediaType, tags, tags.Length + 1, out tagsCopied), "AOORE");
Assert.Throws (() => tagCollection.GetTags ((v) => v.Category == CMTagCategory.MediaType, tags, -1, out tagsCopied), "AOORE 2");
@@ -325,8 +325,8 @@ public void CreateWithCopyOfTags_Filter ()
using var tagCollection1 = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
using var tagCollection2 = tagCollection1.CreateWithCopyOfTags (out var status, CMTagCategory.MediaType);
- Assert.AreEqual (2, (int) tagCollection2.Count, "Count");
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status");
+ Assert.That ((int) tagCollection2.Count, Is.EqualTo (2), "Count");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status");
}
[Test]
@@ -339,7 +339,7 @@ public void ApplyTest ()
tagCollection.Apply ((v) => {
counter++;
});
- Assert.AreEqual ((int) tagCollection.Count, counter, "Counter");
+ Assert.That (counter, Is.EqualTo ((int) tagCollection.Count), "Counter");
}
[Test]
@@ -353,8 +353,8 @@ public void ApplyUntilTest ()
counter++;
return false;
});
- Assert.AreEqual ((int) tagCollection.Count, counter, "Counter A");
- Assert.IsFalse (tag.IsValid, "IsValid A");
+ Assert.That (counter, Is.EqualTo ((int) tagCollection.Count), "Counter A");
+ Assert.That (tag.IsValid, Is.False, "IsValid A");
counter = 0;
tag = tagCollection.ApplyUntil ((v) => {
@@ -365,8 +365,8 @@ public void ApplyUntilTest ()
});
Assert.That (counter, Is.GreaterThan (0), "Counter B1");
Assert.That (counter, Is.LessThanOrEqualTo ((int) tagCollection.Count), "Counter B2");
- Assert.IsTrue (tag.IsValid, "IsValid B");
- Assert.IsTrue (CMTag.Equals (tag, CMTag.PackingTypeNone), "Equals B");
+ Assert.That (tag.IsValid, Is.True, "IsValid B");
+ Assert.That (CMTag.Equals (tag, CMTag.PackingTypeNone), Is.True, "Equals B");
}
[Test]
@@ -377,9 +377,9 @@ public void Intersect ()
using var tagCollection1 = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
using var tagCollection2 = CMTagCollection.Create (CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
using var tagCollection = CMTagCollection.Intersect (tagCollection1, tagCollection2, out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status");
- Assert.AreEqual (1, (int) tagCollection.Count, "Count");
- Assert.IsTrue (CMTag.Equals (CMTag.MediaTypeAudio, tagCollection.Tags [0]), "Tag #0");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (1), "Count");
+ Assert.That (CMTag.Equals (CMTag.MediaTypeAudio, tagCollection.Tags [0]), Is.True, "Tag #0");
}
@@ -391,9 +391,9 @@ public void Intersect_Instance ()
using var tagCollection1 = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
using var tagCollection2 = CMTagCollection.Create (CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
using var tagCollection = tagCollection1.Intersect (tagCollection2, out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status");
- Assert.AreEqual (1, (int) tagCollection.Count, "Count");
- Assert.IsTrue (CMTag.Equals (CMTag.MediaTypeAudio, tagCollection.Tags [0]), "Tag #0");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (1), "Count");
+ Assert.That (CMTag.Equals (CMTag.MediaTypeAudio, tagCollection.Tags [0]), Is.True, "Tag #0");
}
[Test]
@@ -404,8 +404,8 @@ public void Union ()
using var tagCollection1 = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
using var tagCollection2 = CMTagCollection.Create (CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
using var tagCollection = CMTagCollection.Union (tagCollection1, tagCollection2, out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status");
- Assert.AreEqual (3, (int) tagCollection.Count, "Count");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (3), "Count");
}
@@ -417,8 +417,8 @@ public void Union_Instance ()
using var tagCollection1 = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
using var tagCollection2 = CMTagCollection.Create (CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
using var tagCollection = tagCollection1.Union (tagCollection2, out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status");
- Assert.AreEqual (3, (int) tagCollection.Count, "Count");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (3), "Count");
}
[Test]
@@ -429,9 +429,9 @@ public void Subtract ()
using var tagCollection1 = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
using var tagCollection2 = CMTagCollection.Create (CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
using var tagCollection = CMTagCollection.Subtract (tagCollection1, tagCollection2, out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status");
- Assert.AreEqual (1, (int) tagCollection.Count, "Count");
- Assert.IsTrue (CMTag.Equals (CMTag.MediaTypeVideo, tagCollection.Tags [0]), "Tag #0");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (1), "Count");
+ Assert.That (CMTag.Equals (CMTag.MediaTypeVideo, tagCollection.Tags [0]), Is.True, "Tag #0");
}
[Test]
@@ -442,9 +442,9 @@ public void Subtract_Instance ()
using var tagCollection1 = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
using var tagCollection2 = CMTagCollection.Create (CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
using var tagCollection = tagCollection1.Subtract (tagCollection2, out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status");
- Assert.AreEqual (1, (int) tagCollection.Count, "Count");
- Assert.IsTrue (CMTag.Equals (CMTag.MediaTypeVideo, tagCollection.Tags [0]), "Tag #0");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (1), "Count");
+ Assert.That (CMTag.Equals (CMTag.MediaTypeVideo, tagCollection.Tags [0]), Is.True, "Tag #0");
}
[Test]
@@ -455,8 +455,8 @@ public void ExclusiveOr ()
using var tagCollection1 = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
using var tagCollection2 = CMTagCollection.Create (CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
using var tagCollection = CMTagCollection.ExclusiveOr (tagCollection1, tagCollection2, out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status");
- Assert.AreEqual (2, (int) tagCollection.Count, "Count");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (2), "Count");
}
[Test]
@@ -467,8 +467,8 @@ public void ExclusiveOr_Instance ()
using var tagCollection1 = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
using var tagCollection2 = CMTagCollection.Create (CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
using var tagCollection = tagCollection1.ExclusiveOr (tagCollection2, out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, "Status");
- Assert.AreEqual (2, (int) tagCollection.Count, "Count");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), "Status");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (2), "Count");
}
[Test]
@@ -478,7 +478,7 @@ public void AddTest ()
// Trying to modify a non-mutable collection
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo);
- Assert.AreEqual (CMTagCollectionError.ParamErr, tagCollection.Add (CMTag.MediaTypeAudio), "Add");
+ Assert.That (tagCollection.Add (CMTag.MediaTypeAudio), Is.EqualTo (CMTagCollectionError.ParamErr), "Add");
}
[Test]
@@ -487,9 +487,9 @@ public void AddMutableTest ()
TestRuntime.AssertXcodeVersion (15, 0);
using var tagCollection = CMTagCollection.CreateMutable ();
- Assert.AreEqual (CMTagCollectionError.Success, tagCollection.Add (CMTag.MediaTypeAudio), "Add 1");
- Assert.AreEqual (CMTagCollectionError.Success, tagCollection.Add (CMTag.MediaTypeAudio), "Add 2");
- Assert.AreEqual (1, (int) tagCollection.Count, "Count");
+ Assert.That (tagCollection.Add (CMTag.MediaTypeAudio), Is.EqualTo (CMTagCollectionError.Success), "Add 1");
+ Assert.That (tagCollection.Add (CMTag.MediaTypeAudio), Is.EqualTo (CMTagCollectionError.Success), "Add 2");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (1), "Count");
}
[Test]
@@ -499,7 +499,7 @@ public void RemoveTest ()
// Trying to modify a non-mutable collection
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo);
- Assert.AreEqual (CMTagCollectionError.ParamErr, tagCollection.Remove (CMTag.MediaTypeAudio), "Remove");
+ Assert.That (tagCollection.Remove (CMTag.MediaTypeAudio), Is.EqualTo (CMTagCollectionError.ParamErr), "Remove");
}
[Test]
@@ -508,11 +508,11 @@ public void RemoveMutableTest ()
TestRuntime.AssertXcodeVersion (15, 0);
using var tagCollection = CMTagCollection.CreateMutable ();
- Assert.AreEqual (CMTagCollectionError.TagNotFound, tagCollection.Remove (CMTag.MediaTypeAudio), "Remove 1");
- Assert.AreEqual (CMTagCollectionError.Success, tagCollection.Add (CMTag.MediaTypeAudio), "Add 1");
- Assert.AreEqual (CMTagCollectionError.Success, tagCollection.Remove (CMTag.MediaTypeAudio), "Remove 2");
- Assert.AreEqual (0, (int) tagCollection.Count, "Count");
- Assert.AreEqual (CMTagCollectionError.TagNotFound, tagCollection.Remove (CMTag.MediaTypeAudio), "Remove 3");
+ Assert.That (tagCollection.Remove (CMTag.MediaTypeAudio), Is.EqualTo (CMTagCollectionError.TagNotFound), "Remove 1");
+ Assert.That (tagCollection.Add (CMTag.MediaTypeAudio), Is.EqualTo (CMTagCollectionError.Success), "Add 1");
+ Assert.That (tagCollection.Remove (CMTag.MediaTypeAudio), Is.EqualTo (CMTagCollectionError.Success), "Remove 2");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (0), "Count");
+ Assert.That (tagCollection.Remove (CMTag.MediaTypeAudio), Is.EqualTo (CMTagCollectionError.TagNotFound), "Remove 3");
}
[Test]
@@ -522,7 +522,7 @@ public void RemoveAllTest ()
// Trying to modify a non-mutable collection
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo);
- Assert.AreEqual (CMTagCollectionError.ParamErr, tagCollection.RemoveAllTags (), "Remove");
+ Assert.That (tagCollection.RemoveAllTags (), Is.EqualTo (CMTagCollectionError.ParamErr), "Remove");
}
[Test]
@@ -531,10 +531,10 @@ public void RemoveAllMutableTest ()
TestRuntime.AssertXcodeVersion (15, 0);
using var tagCollection = CMTagCollection.CreateMutable ();
- Assert.AreEqual (CMTagCollectionError.Success, tagCollection.Add (CMTag.MediaTypeAudio), "Add 1");
- Assert.AreEqual (CMTagCollectionError.Success, tagCollection.Add (CMTag.MediaTypeVideo), "Add 2");
- Assert.AreEqual (CMTagCollectionError.Success, tagCollection.RemoveAllTags (), "RemoveAll");
- Assert.AreEqual (0, (int) tagCollection.Count, "Count");
+ Assert.That (tagCollection.Add (CMTag.MediaTypeAudio), Is.EqualTo (CMTagCollectionError.Success), "Add 1");
+ Assert.That (tagCollection.Add (CMTag.MediaTypeVideo), Is.EqualTo (CMTagCollectionError.Success), "Add 2");
+ Assert.That (tagCollection.RemoveAllTags (), Is.EqualTo (CMTagCollectionError.Success), "RemoveAll");
+ Assert.That ((int) tagCollection.Count, Is.EqualTo (0), "Count");
}
[Test]
@@ -546,7 +546,7 @@ public void AddCollection ()
using var tagCollection1 = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
using var tagCollection2 = CMTagCollection.Create (CMTag.MediaTypeAudio, CMTag.PackingTypeNone);
Assert.Throws (() => tagCollection1.Add ((CMTagCollection) null), "Add null");
- Assert.AreEqual (CMTagCollectionError.ParamErr, tagCollection1.Add (tagCollection2), "Add");
+ Assert.That (tagCollection1.Add (tagCollection2), Is.EqualTo (CMTagCollectionError.ParamErr), "Add");
}
[Test]
@@ -556,7 +556,7 @@ public void AddTags ()
using var tagCollection = CMTagCollection.Create (CMTag.MediaTypeVideo, CMTag.MediaTypeAudio);
Assert.Throws (() => tagCollection.Add ((CMTag []) null), "Add null");
- Assert.AreEqual (CMTagCollectionError.ParamErr, tagCollection.Add (CMTag.MediaTypeAudio, CMTag.PackingTypeNone), "Add");
+ Assert.That (tagCollection.Add (CMTag.MediaTypeAudio, CMTag.PackingTypeNone), Is.EqualTo (CMTagCollectionError.ParamErr), "Add");
}
[Test]
@@ -567,11 +567,11 @@ public void Dictionary ()
var roundTrip = new Action ((collection, message) => {
var dict = collection.ToDictionary ();
var deserializedCollection = CMTagCollection.Create (dict, out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, $"{message}: Status");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), $"{message}: Status");
// if the union of the original and deserialized collection has the same number of tags as the original collection, then the original and deserialized collections are identical.
var union = collection.Union (deserializedCollection, out status);
- Assert.AreEqual (CMTagCollectionError.Success, status, $"{message}: Status 2");
- Assert.AreEqual (collection.Count, union.Count, "Count");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), $"{message}: Status 2");
+ Assert.That (union.Count, Is.EqualTo (collection.Count), "Count");
});
Assert.Multiple (() => {
@@ -590,11 +590,11 @@ public void Data ()
var roundTrip = new Action ((collection, message) => {
var data = collection.ToData ();
var deserializedCollection = CMTagCollection.Create (data, out var status);
- Assert.AreEqual (CMTagCollectionError.Success, status, $"{message}: Status");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), $"{message}: Status");
// if the union of the original and deserialized collection has the same number of tags as the original collection, then the original and deserialized collections are identical.
var union = collection.Union (deserializedCollection, out status);
- Assert.AreEqual (CMTagCollectionError.Success, status, $"{message}: Status 2");
- Assert.AreEqual (collection.Count, union.Count, "Count");
+ Assert.That (status, Is.EqualTo (CMTagCollectionError.Success), $"{message}: Status 2");
+ Assert.That (union.Count, Is.EqualTo (collection.Count), "Count");
});
Assert.Multiple (() => {
diff --git a/tests/monotouch-test/CoreMedia/CMTagTests.cs b/tests/monotouch-test/CoreMedia/CMTagTests.cs
index 916859abff9d..727c76d3fc24 100644
--- a/tests/monotouch-test/CoreMedia/CMTagTests.cs
+++ b/tests/monotouch-test/CoreMedia/CMTagTests.cs
@@ -73,58 +73,58 @@ public void Equals ()
TestRuntime.AssertXcodeVersion (15, 0);
Assert.Multiple (() => {
- Assert.AreEqual (true, CMTag.Equals (default (CMTag), default (CMTag)), "Default");
- Assert.AreEqual (true, CMTag.Equals (CMTag.Invalid, CMTag.Invalid), "Invalid");
- Assert.AreEqual (true, CMTag.Equals (CMTag.MediaTypeVideo, CMTag.MediaTypeVideo), "MediaTypeVideo");
- Assert.AreEqual (true, CMTag.Equals (CMTag.MediaSubTypeMebx, CMTag.MediaSubTypeMebx), "MediaSubTypeMebx");
- Assert.AreEqual (true, CMTag.Equals (CMTag.MediaTypeAudio, CMTag.MediaTypeAudio), "MediaTypeAudio");
- Assert.AreEqual (true, CMTag.Equals (CMTag.MediaTypeMetadata, CMTag.MediaTypeMetadata), "MediaTypeMetadata");
- Assert.AreEqual (true, CMTag.Equals (CMTag.StereoLeftEye, CMTag.StereoLeftEye), "StereoLeftEye");
- Assert.AreEqual (true, CMTag.Equals (CMTag.StereoRightEye, CMTag.StereoRightEye), "StereoRightEye");
- Assert.AreEqual (true, CMTag.Equals (CMTag.StereoLeftAndRightEye, CMTag.StereoLeftAndRightEye), "StereoLeftAndRightEye");
- Assert.AreEqual (true, CMTag.Equals (CMTag.StereoNone, CMTag.StereoNone), "StereoNone");
- Assert.AreEqual (true, CMTag.Equals (CMTag.StereoInterpretationOrderReversed, CMTag.StereoInterpretationOrderReversed), "StereoInterpretationOrderReversed");
- Assert.AreEqual (true, CMTag.Equals (CMTag.ProjectionTypeRectangular, CMTag.ProjectionTypeRectangular), "ProjectionTypeRectangular");
- Assert.AreEqual (true, CMTag.Equals (CMTag.ProjectionTypeEquirectangular, CMTag.ProjectionTypeEquirectangular), "ProjectionTypeEquirectangular");
- Assert.AreEqual (true, CMTag.Equals (CMTag.ProjectionTypeHalfEquirectangular, CMTag.ProjectionTypeHalfEquirectangular), "ProjectionTypeHalfEquirectangular");
- Assert.AreEqual (true, CMTag.Equals (CMTag.ProjectionTypeFisheye, CMTag.ProjectionTypeFisheye), "ProjectionTypeFisheye");
- Assert.AreEqual (true, CMTag.Equals (CMTag.PackingTypeNone, CMTag.PackingTypeNone), "PackingTypeNone");
- Assert.AreEqual (true, CMTag.Equals (CMTag.PackingTypeSideBySide, CMTag.PackingTypeSideBySide), "PackingTypeSideBySide");
- Assert.AreEqual (true, CMTag.Equals (CMTag.PackingTypeOverUnder, CMTag.PackingTypeOverUnder), "PackingTypeOverUnder");
-
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.MediaTypeVideo), "Invalid vs MediaTypeVideo");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.MediaSubTypeMebx), "Invalid vs MediaSubTypeMebx");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.MediaTypeAudio), "Invalid vs MediaTypeAudio");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.MediaTypeMetadata), "Invalid vs MediaTypeMetadata");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.StereoLeftEye), "Invalid vs StereoLeftEye");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.StereoRightEye), "Invalid vs StereoRightEye");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.StereoLeftAndRightEye), "Invalid vs StereoLeftAndRightEye");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.StereoNone), "Invalid vs StereoNone");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.StereoInterpretationOrderReversed), "Invalid vs StereoInterpretationOrderReversed");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.ProjectionTypeRectangular), "Invalid vs ProjectionTypeRectangular");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.ProjectionTypeEquirectangular), "Invalid vs ProjectionTypeEquirectangular");
- Assert.AreEqual (!TestRuntime.CheckXcodeVersion (16, 0), CMTag.Equals (CMTag.Invalid, CMTag.ProjectionTypeHalfEquirectangular), "Invalid vs ProjectionTypeHalfEquirectangular");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.ProjectionTypeFisheye), "Invalid vs ProjectionTypeFisheye");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.PackingTypeNone), "Invalid vs PackingTypeNone");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.PackingTypeSideBySide), "Invalid vs PackingTypeSideBySide");
- Assert.AreEqual (false, CMTag.Equals (CMTag.Invalid, CMTag.PackingTypeOverUnder), "Invalid vs PackingTypeOverUnder");
-
- Assert.AreEqual (false, CMTag.Equals (CMTag.MediaTypeVideo, CMTag.Invalid), "MediaTypeVideo vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.MediaSubTypeMebx, CMTag.Invalid), "MediaSubTypeMebx vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.MediaTypeAudio, CMTag.Invalid), "MediaTypeAudio vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.MediaTypeMetadata, CMTag.Invalid), "MediaTypeMetadata vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.StereoLeftEye, CMTag.Invalid), "StereoLeftEye vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.StereoRightEye, CMTag.Invalid), "StereoRightEye vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.StereoLeftAndRightEye, CMTag.Invalid), "StereoLeftAndRightEye vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.StereoNone, CMTag.Invalid), "StereoNone vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.StereoInterpretationOrderReversed, CMTag.Invalid), "StereoInterpretationOrderReversed vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.ProjectionTypeRectangular, CMTag.Invalid), "ProjectionTypeRectangular vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.ProjectionTypeEquirectangular, CMTag.Invalid), "ProjectionTypeEquirectangular vs Invalid");
- Assert.AreEqual (!TestRuntime.CheckXcodeVersion (16, 0), CMTag.Equals (CMTag.ProjectionTypeHalfEquirectangular, CMTag.Invalid), "ProjectionTypeHalfEquirectangular vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.ProjectionTypeFisheye, CMTag.Invalid), "ProjectionTypeFisheye vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.PackingTypeNone, CMTag.Invalid), "PackingTypeNone vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.PackingTypeSideBySide, CMTag.Invalid), "PackingTypeSideBySide vs Invalid");
- Assert.AreEqual (false, CMTag.Equals (CMTag.PackingTypeOverUnder, CMTag.Invalid), "PackingTypeOverUnder vs Invalid");
+ Assert.That (CMTag.Equals (default (CMTag), default (CMTag)), Is.EqualTo (true), "Default");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.Invalid), Is.EqualTo (true), "Invalid");
+ Assert.That (CMTag.Equals (CMTag.MediaTypeVideo, CMTag.MediaTypeVideo), Is.EqualTo (true), "MediaTypeVideo");
+ Assert.That (CMTag.Equals (CMTag.MediaSubTypeMebx, CMTag.MediaSubTypeMebx), Is.EqualTo (true), "MediaSubTypeMebx");
+ Assert.That (CMTag.Equals (CMTag.MediaTypeAudio, CMTag.MediaTypeAudio), Is.EqualTo (true), "MediaTypeAudio");
+ Assert.That (CMTag.Equals (CMTag.MediaTypeMetadata, CMTag.MediaTypeMetadata), Is.EqualTo (true), "MediaTypeMetadata");
+ Assert.That (CMTag.Equals (CMTag.StereoLeftEye, CMTag.StereoLeftEye), Is.EqualTo (true), "StereoLeftEye");
+ Assert.That (CMTag.Equals (CMTag.StereoRightEye, CMTag.StereoRightEye), Is.EqualTo (true), "StereoRightEye");
+ Assert.That (CMTag.Equals (CMTag.StereoLeftAndRightEye, CMTag.StereoLeftAndRightEye), Is.EqualTo (true), "StereoLeftAndRightEye");
+ Assert.That (CMTag.Equals (CMTag.StereoNone, CMTag.StereoNone), Is.EqualTo (true), "StereoNone");
+ Assert.That (CMTag.Equals (CMTag.StereoInterpretationOrderReversed, CMTag.StereoInterpretationOrderReversed), Is.EqualTo (true), "StereoInterpretationOrderReversed");
+ Assert.That (CMTag.Equals (CMTag.ProjectionTypeRectangular, CMTag.ProjectionTypeRectangular), Is.EqualTo (true), "ProjectionTypeRectangular");
+ Assert.That (CMTag.Equals (CMTag.ProjectionTypeEquirectangular, CMTag.ProjectionTypeEquirectangular), Is.EqualTo (true), "ProjectionTypeEquirectangular");
+ Assert.That (CMTag.Equals (CMTag.ProjectionTypeHalfEquirectangular, CMTag.ProjectionTypeHalfEquirectangular), Is.EqualTo (true), "ProjectionTypeHalfEquirectangular");
+ Assert.That (CMTag.Equals (CMTag.ProjectionTypeFisheye, CMTag.ProjectionTypeFisheye), Is.EqualTo (true), "ProjectionTypeFisheye");
+ Assert.That (CMTag.Equals (CMTag.PackingTypeNone, CMTag.PackingTypeNone), Is.EqualTo (true), "PackingTypeNone");
+ Assert.That (CMTag.Equals (CMTag.PackingTypeSideBySide, CMTag.PackingTypeSideBySide), Is.EqualTo (true), "PackingTypeSideBySide");
+ Assert.That (CMTag.Equals (CMTag.PackingTypeOverUnder, CMTag.PackingTypeOverUnder), Is.EqualTo (true), "PackingTypeOverUnder");
+
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.MediaTypeVideo), Is.EqualTo (false), "Invalid vs MediaTypeVideo");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.MediaSubTypeMebx), Is.EqualTo (false), "Invalid vs MediaSubTypeMebx");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.MediaTypeAudio), Is.EqualTo (false), "Invalid vs MediaTypeAudio");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.MediaTypeMetadata), Is.EqualTo (false), "Invalid vs MediaTypeMetadata");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.StereoLeftEye), Is.EqualTo (false), "Invalid vs StereoLeftEye");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.StereoRightEye), Is.EqualTo (false), "Invalid vs StereoRightEye");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.StereoLeftAndRightEye), Is.EqualTo (false), "Invalid vs StereoLeftAndRightEye");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.StereoNone), Is.EqualTo (false), "Invalid vs StereoNone");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.StereoInterpretationOrderReversed), Is.EqualTo (false), "Invalid vs StereoInterpretationOrderReversed");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.ProjectionTypeRectangular), Is.EqualTo (false), "Invalid vs ProjectionTypeRectangular");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.ProjectionTypeEquirectangular), Is.EqualTo (false), "Invalid vs ProjectionTypeEquirectangular");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.ProjectionTypeHalfEquirectangular), Is.EqualTo (!TestRuntime.CheckXcodeVersion (16, 0)), "Invalid vs ProjectionTypeHalfEquirectangular");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.ProjectionTypeFisheye), Is.EqualTo (false), "Invalid vs ProjectionTypeFisheye");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.PackingTypeNone), Is.EqualTo (false), "Invalid vs PackingTypeNone");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.PackingTypeSideBySide), Is.EqualTo (false), "Invalid vs PackingTypeSideBySide");
+ Assert.That (CMTag.Equals (CMTag.Invalid, CMTag.PackingTypeOverUnder), Is.EqualTo (false), "Invalid vs PackingTypeOverUnder");
+
+ Assert.That (CMTag.Equals (CMTag.MediaTypeVideo, CMTag.Invalid), Is.EqualTo (false), "MediaTypeVideo vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.MediaSubTypeMebx, CMTag.Invalid), Is.EqualTo (false), "MediaSubTypeMebx vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.MediaTypeAudio, CMTag.Invalid), Is.EqualTo (false), "MediaTypeAudio vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.MediaTypeMetadata, CMTag.Invalid), Is.EqualTo (false), "MediaTypeMetadata vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.StereoLeftEye, CMTag.Invalid), Is.EqualTo (false), "StereoLeftEye vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.StereoRightEye, CMTag.Invalid), Is.EqualTo (false), "StereoRightEye vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.StereoLeftAndRightEye, CMTag.Invalid), Is.EqualTo (false), "StereoLeftAndRightEye vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.StereoNone, CMTag.Invalid), Is.EqualTo (false), "StereoNone vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.StereoInterpretationOrderReversed, CMTag.Invalid), Is.EqualTo (false), "StereoInterpretationOrderReversed vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.ProjectionTypeRectangular, CMTag.Invalid), Is.EqualTo (false), "ProjectionTypeRectangular vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.ProjectionTypeEquirectangular, CMTag.Invalid), Is.EqualTo (false), "ProjectionTypeEquirectangular vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.ProjectionTypeHalfEquirectangular, CMTag.Invalid), Is.EqualTo (!TestRuntime.CheckXcodeVersion (16, 0)), "ProjectionTypeHalfEquirectangular vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.ProjectionTypeFisheye, CMTag.Invalid), Is.EqualTo (false), "ProjectionTypeFisheye vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.PackingTypeNone, CMTag.Invalid), Is.EqualTo (false), "PackingTypeNone vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.PackingTypeSideBySide, CMTag.Invalid), Is.EqualTo (false), "PackingTypeSideBySide vs Invalid");
+ Assert.That (CMTag.Equals (CMTag.PackingTypeOverUnder, CMTag.Invalid), Is.EqualTo (false), "PackingTypeOverUnder vs Invalid");
});
}
@@ -134,87 +134,87 @@ public void Compare ()
TestRuntime.AssertXcodeVersion (15, 0);
Assert.Multiple (() => {
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (default (CMTag), default (CMTag)), "Default");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.Invalid, CMTag.Invalid), "Invalid");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.MediaTypeVideo, CMTag.MediaTypeVideo), "MediaTypeVideo");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.MediaSubTypeMebx, CMTag.MediaSubTypeMebx), "MediaSubTypeMebx");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.MediaTypeAudio, CMTag.MediaTypeAudio), "MediaTypeAudio");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.MediaTypeMetadata, CMTag.MediaTypeMetadata), "MediaTypeMetadata");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.StereoLeftEye, CMTag.StereoLeftEye), "StereoLeftEye");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.StereoRightEye, CMTag.StereoRightEye), "StereoRightEye");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.StereoLeftAndRightEye, CMTag.StereoLeftAndRightEye), "StereoLeftAndRightEye");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.StereoNone, CMTag.StereoNone), "StereoNone");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.StereoInterpretationOrderReversed, CMTag.StereoInterpretationOrderReversed), "StereoInterpretationOrderReversed");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.ProjectionTypeRectangular, CMTag.ProjectionTypeRectangular), "ProjectionTypeRectangular");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.ProjectionTypeEquirectangular, CMTag.ProjectionTypeEquirectangular), "ProjectionTypeEquirectangular");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.ProjectionTypeHalfEquirectangular, CMTag.ProjectionTypeHalfEquirectangular), "ProjectionTypeHalfEquirectangular");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.ProjectionTypeFisheye, CMTag.ProjectionTypeFisheye), "ProjectionTypeFisheye");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.PackingTypeNone, CMTag.PackingTypeNone), "PackingTypeNone");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.PackingTypeSideBySide, CMTag.PackingTypeSideBySide), "PackingTypeSideBySide");
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.PackingTypeOverUnder, CMTag.PackingTypeOverUnder), "PackingTypeOverUnder");
-
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.MediaTypeVideo), "Invalid vs MediaTypeVideo");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.MediaSubTypeMebx), "Invalid vs MediaSubTypeMebx");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.MediaTypeAudio), "Invalid vs MediaTypeAudio");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.MediaTypeMetadata), "Invalid vs MediaTypeMetadata");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.StereoLeftEye), "Invalid vs StereoLeftEye");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.StereoRightEye), "Invalid vs StereoRightEye");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.StereoLeftAndRightEye), "Invalid vs StereoLeftAndRightEye");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.StereoNone), "Invalid vs StereoNone");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.StereoInterpretationOrderReversed), "Invalid vs StereoInterpretationOrderReversed");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.ProjectionTypeRectangular), "Invalid vs ProjectionTypeRectangular");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.ProjectionTypeEquirectangular), "Invalid vs ProjectionTypeEquirectangular");
+ Assert.That (CMTag.Compare (default (CMTag), default (CMTag)), Is.EqualTo (CFComparisonResult.EqualTo), "Default");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.Invalid), Is.EqualTo (CFComparisonResult.EqualTo), "Invalid");
+ Assert.That (CMTag.Compare (CMTag.MediaTypeVideo, CMTag.MediaTypeVideo), Is.EqualTo (CFComparisonResult.EqualTo), "MediaTypeVideo");
+ Assert.That (CMTag.Compare (CMTag.MediaSubTypeMebx, CMTag.MediaSubTypeMebx), Is.EqualTo (CFComparisonResult.EqualTo), "MediaSubTypeMebx");
+ Assert.That (CMTag.Compare (CMTag.MediaTypeAudio, CMTag.MediaTypeAudio), Is.EqualTo (CFComparisonResult.EqualTo), "MediaTypeAudio");
+ Assert.That (CMTag.Compare (CMTag.MediaTypeMetadata, CMTag.MediaTypeMetadata), Is.EqualTo (CFComparisonResult.EqualTo), "MediaTypeMetadata");
+ Assert.That (CMTag.Compare (CMTag.StereoLeftEye, CMTag.StereoLeftEye), Is.EqualTo (CFComparisonResult.EqualTo), "StereoLeftEye");
+ Assert.That (CMTag.Compare (CMTag.StereoRightEye, CMTag.StereoRightEye), Is.EqualTo (CFComparisonResult.EqualTo), "StereoRightEye");
+ Assert.That (CMTag.Compare (CMTag.StereoLeftAndRightEye, CMTag.StereoLeftAndRightEye), Is.EqualTo (CFComparisonResult.EqualTo), "StereoLeftAndRightEye");
+ Assert.That (CMTag.Compare (CMTag.StereoNone, CMTag.StereoNone), Is.EqualTo (CFComparisonResult.EqualTo), "StereoNone");
+ Assert.That (CMTag.Compare (CMTag.StereoInterpretationOrderReversed, CMTag.StereoInterpretationOrderReversed), Is.EqualTo (CFComparisonResult.EqualTo), "StereoInterpretationOrderReversed");
+ Assert.That (CMTag.Compare (CMTag.ProjectionTypeRectangular, CMTag.ProjectionTypeRectangular), Is.EqualTo (CFComparisonResult.EqualTo), "ProjectionTypeRectangular");
+ Assert.That (CMTag.Compare (CMTag.ProjectionTypeEquirectangular, CMTag.ProjectionTypeEquirectangular), Is.EqualTo (CFComparisonResult.EqualTo), "ProjectionTypeEquirectangular");
+ Assert.That (CMTag.Compare (CMTag.ProjectionTypeHalfEquirectangular, CMTag.ProjectionTypeHalfEquirectangular), Is.EqualTo (CFComparisonResult.EqualTo), "ProjectionTypeHalfEquirectangular");
+ Assert.That (CMTag.Compare (CMTag.ProjectionTypeFisheye, CMTag.ProjectionTypeFisheye), Is.EqualTo (CFComparisonResult.EqualTo), "ProjectionTypeFisheye");
+ Assert.That (CMTag.Compare (CMTag.PackingTypeNone, CMTag.PackingTypeNone), Is.EqualTo (CFComparisonResult.EqualTo), "PackingTypeNone");
+ Assert.That (CMTag.Compare (CMTag.PackingTypeSideBySide, CMTag.PackingTypeSideBySide), Is.EqualTo (CFComparisonResult.EqualTo), "PackingTypeSideBySide");
+ Assert.That (CMTag.Compare (CMTag.PackingTypeOverUnder, CMTag.PackingTypeOverUnder), Is.EqualTo (CFComparisonResult.EqualTo), "PackingTypeOverUnder");
+
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.MediaTypeVideo), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs MediaTypeVideo");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.MediaSubTypeMebx), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs MediaSubTypeMebx");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.MediaTypeAudio), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs MediaTypeAudio");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.MediaTypeMetadata), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs MediaTypeMetadata");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.StereoLeftEye), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs StereoLeftEye");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.StereoRightEye), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs StereoRightEye");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.StereoLeftAndRightEye), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs StereoLeftAndRightEye");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.StereoNone), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs StereoNone");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.StereoInterpretationOrderReversed), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs StereoInterpretationOrderReversed");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.ProjectionTypeRectangular), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs ProjectionTypeRectangular");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.ProjectionTypeEquirectangular), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs ProjectionTypeEquirectangular");
if (TestRuntime.CheckXcodeVersion (16, 0)) {
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.ProjectionTypeHalfEquirectangular), "Invalid vs ProjectionTypeHalfEquirectangular");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.ProjectionTypeHalfEquirectangular), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs ProjectionTypeHalfEquirectangular");
} else {
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.Invalid, CMTag.ProjectionTypeHalfEquirectangular), "Invalid vs ProjectionTypeHalfEquirectangular");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.ProjectionTypeHalfEquirectangular), Is.EqualTo (CFComparisonResult.EqualTo), "Invalid vs ProjectionTypeHalfEquirectangular");
}
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.ProjectionTypeFisheye), "Invalid vs ProjectionTypeFisheye");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.PackingTypeNone), "Invalid vs PackingTypeNone");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.PackingTypeSideBySide), "Invalid vs PackingTypeSideBySide");
- Assert.AreEqual (CFComparisonResult.LessThan, CMTag.Compare (CMTag.Invalid, CMTag.PackingTypeOverUnder), "Invalid vs PackingTypeOverUnder");
-
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.MediaTypeVideo, CMTag.Invalid), "MediaTypeVideo vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.MediaSubTypeMebx, CMTag.Invalid), "MediaSubTypeMebx vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.MediaTypeAudio, CMTag.Invalid), "MediaTypeAudio vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.MediaTypeMetadata, CMTag.Invalid), "MediaTypeMetadata vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.StereoLeftEye, CMTag.Invalid), "StereoLeftEye vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.StereoRightEye, CMTag.Invalid), "StereoRightEye vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.StereoLeftAndRightEye, CMTag.Invalid), "StereoLeftAndRightEye vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.StereoNone, CMTag.Invalid), "StereoNone vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.StereoInterpretationOrderReversed, CMTag.Invalid), "StereoInterpretationOrderReversed vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.ProjectionTypeRectangular, CMTag.Invalid), "ProjectionTypeRectangular vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.ProjectionTypeEquirectangular, CMTag.Invalid), "ProjectionTypeEquirectangular vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.ProjectionTypeFisheye), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs ProjectionTypeFisheye");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.PackingTypeNone), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs PackingTypeNone");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.PackingTypeSideBySide), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs PackingTypeSideBySide");
+ Assert.That (CMTag.Compare (CMTag.Invalid, CMTag.PackingTypeOverUnder), Is.EqualTo (CFComparisonResult.LessThan), "Invalid vs PackingTypeOverUnder");
+
+ Assert.That (CMTag.Compare (CMTag.MediaTypeVideo, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "MediaTypeVideo vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.MediaSubTypeMebx, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "MediaSubTypeMebx vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.MediaTypeAudio, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "MediaTypeAudio vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.MediaTypeMetadata, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "MediaTypeMetadata vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.StereoLeftEye, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "StereoLeftEye vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.StereoRightEye, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "StereoRightEye vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.StereoLeftAndRightEye, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "StereoLeftAndRightEye vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.StereoNone, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "StereoNone vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.StereoInterpretationOrderReversed, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "StereoInterpretationOrderReversed vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.ProjectionTypeRectangular, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "ProjectionTypeRectangular vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.ProjectionTypeEquirectangular, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "ProjectionTypeEquirectangular vs Invalid");
if (TestRuntime.CheckXcodeVersion (16, 0)) {
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.ProjectionTypeHalfEquirectangular, CMTag.Invalid), "ProjectionTypeHalfEquirectangular vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.ProjectionTypeHalfEquirectangular, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "ProjectionTypeHalfEquirectangular vs Invalid");
} else {
- Assert.AreEqual (CFComparisonResult.EqualTo, CMTag.Compare (CMTag.ProjectionTypeHalfEquirectangular, CMTag.Invalid), "ProjectionTypeHalfEquirectangular vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.ProjectionTypeHalfEquirectangular, CMTag.Invalid), Is.EqualTo (CFComparisonResult.EqualTo), "ProjectionTypeHalfEquirectangular vs Invalid");
}
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.ProjectionTypeFisheye, CMTag.Invalid), "ProjectionTypeFisheye vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.PackingTypeNone, CMTag.Invalid), "PackingTypeNone vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.PackingTypeSideBySide, CMTag.Invalid), "PackingTypeSideBySide vs Invalid");
- Assert.AreEqual (CFComparisonResult.GreaterThan, CMTag.Compare (CMTag.PackingTypeOverUnder, CMTag.Invalid), "PackingTypeOverUnder vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.ProjectionTypeFisheye, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "ProjectionTypeFisheye vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.PackingTypeNone, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "PackingTypeNone vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.PackingTypeSideBySide, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "PackingTypeSideBySide vs Invalid");
+ Assert.That (CMTag.Compare (CMTag.PackingTypeOverUnder, CMTag.Invalid), Is.EqualTo (CFComparisonResult.GreaterThan), "PackingTypeOverUnder vs Invalid");
});
}
void AssertTag (CMTag tag, CMTagCategory category, CMTagDataType dataType, ulong value, bool isValid, bool hasFloat64Value, double float64Value, bool hasOSTypeValue, uint osTypeValue, bool hasFlagsValue, ulong flagsValue, bool hasInt64Value, long int64Value, string message)
{
- Assert.AreEqual (category, tag.Category, $"{message}: Category");
- Assert.AreEqual (dataType, tag.DataType, $"{message}: DataType");
- Assert.AreEqual (value, tag.Value, $"{message}: Value");
- Assert.AreEqual (isValid, tag.IsValid, $"{message}: IsValid");
- Assert.AreEqual (hasFloat64Value, tag.HasFloat64Value, $"{message}: HasFloat64Value");
+ Assert.That (tag.Category, Is.EqualTo (category), $"{message}: Category");
+ Assert.That (tag.DataType, Is.EqualTo (dataType), $"{message}: DataType");
+ Assert.That (tag.Value, Is.EqualTo (value), $"{message}: Value");
+ Assert.That (tag.IsValid, Is.EqualTo (isValid), $"{message}: IsValid");
+ Assert.That (tag.HasFloat64Value, Is.EqualTo (hasFloat64Value), $"{message}: HasFloat64Value");
if (hasFloat64Value)
- Assert.AreEqual (float64Value, tag.Float64Value, $"{message}: Float64Value");
- Assert.AreEqual (hasOSTypeValue, tag.HasOSTypeValue, $"{message}: HasOSTypeValue");
+ Assert.That (tag.Float64Value, Is.EqualTo (float64Value), $"{message}: Float64Value");
+ Assert.That (tag.HasOSTypeValue, Is.EqualTo (hasOSTypeValue), $"{message}: HasOSTypeValue");
if (hasOSTypeValue)
- Assert.AreEqual (osTypeValue, tag.OSTypeValue, $"{message}: OSTypeValue ({AVFoundationEnumTest.FourCC (osTypeValue)}={osTypeValue} vs {AVFoundationEnumTest.FourCC (tag.OSTypeValue)}={tag.OSTypeValue})");
- Assert.AreEqual (hasFlagsValue, tag.HasFlagsValue, $"{message}: HasFlagsValue");
+ Assert.That (tag.OSTypeValue, Is.EqualTo (osTypeValue), $"{message}: OSTypeValue ({AVFoundationEnumTest.FourCC (osTypeValue)}={osTypeValue} vs {AVFoundationEnumTest.FourCC (tag.OSTypeValue)}={tag.OSTypeValue})");
+ Assert.That (tag.HasFlagsValue, Is.EqualTo (hasFlagsValue), $"{message}: HasFlagsValue");
if (hasFlagsValue)
- Assert.AreEqual (flagsValue, tag.FlagsValue, $"{message}: FlagsValue");
- Assert.AreEqual (hasInt64Value, tag.HasInt64Value, $"{message}: HasInt64Value");
+ Assert.That (tag.FlagsValue, Is.EqualTo (flagsValue), $"{message}: FlagsValue");
+ Assert.That (tag.HasInt64Value, Is.EqualTo (hasInt64Value), $"{message}: HasInt64Value");
if (hasInt64Value)
- Assert.AreEqual (int64Value, tag.Int64Value, $"{message}: Int64Value");
+ Assert.That (tag.Int64Value, Is.EqualTo (int64Value), $"{message}: Int64Value");
}
[Test]
@@ -253,28 +253,28 @@ public void ToStringTests ()
TestRuntime.AssertXcodeVersion (15, 0);
Assert.Multiple (() => {
- Assert.AreEqual ("{category:''{INVALID}", default (CMTag).ToString (), "Default");
- Assert.AreEqual ("{category:''{INVALID}", CMTag.Invalid.ToString (), "Invalid");
- Assert.AreEqual ("{category:'mdia' value:'vide' }", CMTag.MediaTypeVideo.ToString (), "MediaTypeVideo");
- Assert.AreEqual ("{category:'msub' value:'mebx' }", CMTag.MediaSubTypeMebx.ToString (), "MediaSubTypeMebx");
- Assert.AreEqual ("{category:'mdia' value:'soun' }", CMTag.MediaTypeAudio.ToString (), "MediaTypeAudio");
- Assert.AreEqual ("{category:'mdia' value:'meta' }", CMTag.MediaTypeMetadata.ToString (), "MediaTypeMetadata");
- Assert.AreEqual ("{category:'eyes' value:0x1 }", CMTag.StereoLeftEye.ToString (), "StereoLeftEye");
- Assert.AreEqual ("{category:'eyes' value:0x2 }", CMTag.StereoRightEye.ToString (), "StereoRightEye");
- Assert.AreEqual ("{category:'eyes' value:0x3 }", CMTag.StereoLeftAndRightEye.ToString (), "StereoLeftAndRightEye");
- Assert.AreEqual ("{category:'eyes' value:0x0 }", CMTag.StereoNone.ToString (), "StereoNone");
- Assert.AreEqual ("{category:'eyip' value:0x1 }", CMTag.StereoInterpretationOrderReversed.ToString (), "StereoInterpretationOrderReversed");
- Assert.AreEqual ("{category:'proj' value:'rect' }", CMTag.ProjectionTypeRectangular.ToString (), "ProjectionTypeRectangular");
- Assert.AreEqual ("{category:'proj' value:'equi' }", CMTag.ProjectionTypeEquirectangular.ToString (), "ProjectionTypeEquirectangular");
+ Assert.That (default (CMTag).ToString (), Is.EqualTo ("{category:''{INVALID}"), "Default");
+ Assert.That (CMTag.Invalid.ToString (), Is.EqualTo ("{category:''{INVALID}"), "Invalid");
+ Assert.That (CMTag.MediaTypeVideo.ToString (), Is.EqualTo ("{category:'mdia' value:'vide' }"), "MediaTypeVideo");
+ Assert.That (CMTag.MediaSubTypeMebx.ToString (), Is.EqualTo ("{category:'msub' value:'mebx' }"), "MediaSubTypeMebx");
+ Assert.That (CMTag.MediaTypeAudio.ToString (), Is.EqualTo ("{category:'mdia' value:'soun' }"), "MediaTypeAudio");
+ Assert.That (CMTag.MediaTypeMetadata.ToString (), Is.EqualTo ("{category:'mdia' value:'meta' }"), "MediaTypeMetadata");
+ Assert.That (CMTag.StereoLeftEye.ToString (), Is.EqualTo ("{category:'eyes' value:0x1 }"), "StereoLeftEye");
+ Assert.That (CMTag.StereoRightEye.ToString (), Is.EqualTo ("{category:'eyes' value:0x2 }"), "StereoRightEye");
+ Assert.That (CMTag.StereoLeftAndRightEye.ToString (), Is.EqualTo ("{category:'eyes' value:0x3 }"), "StereoLeftAndRightEye");
+ Assert.That (CMTag.StereoNone.ToString (), Is.EqualTo ("{category:'eyes' value:0x0 }"), "StereoNone");
+ Assert.That (CMTag.StereoInterpretationOrderReversed.ToString (), Is.EqualTo ("{category:'eyip' value:0x1 }"), "StereoInterpretationOrderReversed");
+ Assert.That (CMTag.ProjectionTypeRectangular.ToString (), Is.EqualTo ("{category:'proj' value:'rect' }"), "ProjectionTypeRectangular");
+ Assert.That (CMTag.ProjectionTypeEquirectangular.ToString (), Is.EqualTo ("{category:'proj' value:'equi' }"), "ProjectionTypeEquirectangular");
if (TestRuntime.CheckXcodeVersion (16, 0)) {
- Assert.AreEqual ("{category:'proj' value:'hequ' }", CMTag.ProjectionTypeHalfEquirectangular.ToString (), "ProjectionTypeHalfEquirectangular");
+ Assert.That (CMTag.ProjectionTypeHalfEquirectangular.ToString (), Is.EqualTo ("{category:'proj' value:'hequ' }"), "ProjectionTypeHalfEquirectangular");
} else {
- Assert.AreEqual ("{category:''{INVALID}", CMTag.ProjectionTypeHalfEquirectangular.ToString (), "ProjectionTypeHalfEquirectangular");
+ Assert.That (CMTag.ProjectionTypeHalfEquirectangular.ToString (), Is.EqualTo ("{category:''{INVALID}"), "ProjectionTypeHalfEquirectangular");
}
- Assert.AreEqual ("{category:'proj' value:'fish' }", CMTag.ProjectionTypeFisheye.ToString (), "ProjectionTypeFisheye");
- Assert.AreEqual ("{category:'pack' value:'none' }", CMTag.PackingTypeNone.ToString (), "PackingTypeNone");
- Assert.AreEqual ("{category:'pack' value:'side' }", CMTag.PackingTypeSideBySide.ToString (), "PackingTypeSideBySide");
- Assert.AreEqual ("{category:'pack' value:'over' }", CMTag.PackingTypeOverUnder.ToString (), "PackingTypeOverUnder");
+ Assert.That (CMTag.ProjectionTypeFisheye.ToString (), Is.EqualTo ("{category:'proj' value:'fish' }"), "ProjectionTypeFisheye");
+ Assert.That (CMTag.PackingTypeNone.ToString (), Is.EqualTo ("{category:'pack' value:'none' }"), "PackingTypeNone");
+ Assert.That (CMTag.PackingTypeSideBySide.ToString (), Is.EqualTo ("{category:'pack' value:'side' }"), "PackingTypeSideBySide");
+ Assert.That (CMTag.PackingTypeOverUnder.ToString (), Is.EqualTo ("{category:'pack' value:'over' }"), "PackingTypeOverUnder");
});
}
@@ -286,7 +286,7 @@ public void Dictionary ()
var roundTrip = new Action ((tag, message) => {
var dict = tag.ToDictionary ();
var deserializedTag = CMTag.Create (dict);
- Assert.AreEqual (true, CMTag.Equals (tag, deserializedTag), message);
+ Assert.That (CMTag.Equals (tag, deserializedTag), Is.EqualTo (true), message);
});
Assert.Multiple (() => {
@@ -317,24 +317,24 @@ public void Hash ()
TestRuntime.AssertXcodeVersion (15, 0);
Assert.Multiple (() => {
- Assert.AreNotEqual (0, default (CMTag).GetHashCode (), "Default");
- Assert.AreNotEqual (0, CMTag.Invalid.GetHashCode (), "Invalid");
- Assert.AreNotEqual (0, CMTag.MediaTypeVideo.GetHashCode (), "MediaTypeVideo");
- Assert.AreNotEqual (0, CMTag.MediaSubTypeMebx.GetHashCode (), "MediaSubTypeMebx");
- Assert.AreNotEqual (0, CMTag.MediaTypeAudio.GetHashCode (), "MediaTypeAudio");
- Assert.AreNotEqual (0, CMTag.MediaTypeMetadata.GetHashCode (), "MediaTypeMetadata");
- Assert.AreNotEqual (0, CMTag.StereoLeftEye.GetHashCode (), "StereoLeftEye");
- Assert.AreNotEqual (0, CMTag.StereoRightEye.GetHashCode (), "StereoRightEye");
- Assert.AreNotEqual (0, CMTag.StereoLeftAndRightEye.GetHashCode (), "StereoLeftAndRightEye");
- Assert.AreNotEqual (0, CMTag.StereoNone.GetHashCode (), "StereoNone");
- Assert.AreNotEqual (0, CMTag.StereoInterpretationOrderReversed.GetHashCode (), "StereoInterpretationOrderReversed");
- Assert.AreNotEqual (0, CMTag.ProjectionTypeRectangular.GetHashCode (), "ProjectionTypeRectangular");
- Assert.AreNotEqual (0, CMTag.ProjectionTypeEquirectangular.GetHashCode (), "ProjectionTypeEquirectangular");
- Assert.AreNotEqual (0, CMTag.ProjectionTypeHalfEquirectangular.GetHashCode (), "ProjectionTypeHalfEquirectangular");
- Assert.AreNotEqual (0, CMTag.ProjectionTypeFisheye.GetHashCode (), "ProjectionTypeFisheye");
- Assert.AreNotEqual (0, CMTag.PackingTypeNone.GetHashCode (), "PackingTypeNone");
- Assert.AreNotEqual (0, CMTag.PackingTypeSideBySide.GetHashCode (), "PackingTypeSideBySide");
- Assert.AreNotEqual (0, CMTag.PackingTypeOverUnder.GetHashCode (), "PackingTypeOverUnder");
+ Assert.That (default (CMTag).GetHashCode (), Is.Not.EqualTo (0), "Default");
+ Assert.That (CMTag.Invalid.GetHashCode (), Is.Not.EqualTo (0), "Invalid");
+ Assert.That (CMTag.MediaTypeVideo.GetHashCode (), Is.Not.EqualTo (0), "MediaTypeVideo");
+ Assert.That (CMTag.MediaSubTypeMebx.GetHashCode (), Is.Not.EqualTo (0), "MediaSubTypeMebx");
+ Assert.That (CMTag.MediaTypeAudio.GetHashCode (), Is.Not.EqualTo (0), "MediaTypeAudio");
+ Assert.That (CMTag.MediaTypeMetadata.GetHashCode (), Is.Not.EqualTo (0), "MediaTypeMetadata");
+ Assert.That (CMTag.StereoLeftEye.GetHashCode (), Is.Not.EqualTo (0), "StereoLeftEye");
+ Assert.That (CMTag.StereoRightEye.GetHashCode (), Is.Not.EqualTo (0), "StereoRightEye");
+ Assert.That (CMTag.StereoLeftAndRightEye.GetHashCode (), Is.Not.EqualTo (0), "StereoLeftAndRightEye");
+ Assert.That (CMTag.StereoNone.GetHashCode (), Is.Not.EqualTo (0), "StereoNone");
+ Assert.That (CMTag.StereoInterpretationOrderReversed.GetHashCode (), Is.Not.EqualTo (0), "StereoInterpretationOrderReversed");
+ Assert.That (CMTag.ProjectionTypeRectangular.GetHashCode (), Is.Not.EqualTo (0), "ProjectionTypeRectangular");
+ Assert.That (CMTag.ProjectionTypeEquirectangular.GetHashCode (), Is.Not.EqualTo (0), "ProjectionTypeEquirectangular");
+ Assert.That (CMTag.ProjectionTypeHalfEquirectangular.GetHashCode (), Is.Not.EqualTo (0), "ProjectionTypeHalfEquirectangular");
+ Assert.That (CMTag.ProjectionTypeFisheye.GetHashCode (), Is.Not.EqualTo (0), "ProjectionTypeFisheye");
+ Assert.That (CMTag.PackingTypeNone.GetHashCode (), Is.Not.EqualTo (0), "PackingTypeNone");
+ Assert.That (CMTag.PackingTypeSideBySide.GetHashCode (), Is.Not.EqualTo (0), "PackingTypeSideBySide");
+ Assert.That (CMTag.PackingTypeOverUnder.GetHashCode (), Is.Not.EqualTo (0), "PackingTypeOverUnder");
});
}
}
diff --git a/tests/monotouch-test/CoreMedia/CMTaggedBufferGroupTests.cs b/tests/monotouch-test/CoreMedia/CMTaggedBufferGroupTests.cs
index eb638bf29f62..8f197d1038cf 100644
--- a/tests/monotouch-test/CoreMedia/CMTaggedBufferGroupTests.cs
+++ b/tests/monotouch-test/CoreMedia/CMTaggedBufferGroupTests.cs
@@ -24,7 +24,7 @@ public void GetTypeIdTest ()
{
TestRuntime.AssertXcodeVersion (15, 0);
- Assert.AreNotEqual (0, CMTaggedBufferGroup.GetTypeId (), "GetTypeId");
+ Assert.That (CMTaggedBufferGroup.GetTypeId (), Is.Not.EqualTo (0), "GetTypeId");
}
[Test]
@@ -39,8 +39,8 @@ public void Create_PixelBuffers ()
new [] { tagCollection },
new [] { pixelBuffer },
out var status);
- Assert.AreEqual (CMTaggedBufferGroupError.Success, status, "Status");
- Assert.AreEqual (1, (int) group.Count, "Count A");
+ Assert.That (status, Is.EqualTo (CMTaggedBufferGroupError.Success), "Status");
+ Assert.That ((int) group.Count, Is.EqualTo (1), "Count A");
Assert.Throws (() => CMTaggedBufferGroup.Create (
new [] { tagCollection },
@@ -79,8 +79,8 @@ public void Create_MediaBuffers ()
new [] { tagCollection },
new [] { sampleBuffer },
out var status);
- Assert.AreEqual (CMTaggedBufferGroupError.Success, status, "Status");
- Assert.AreEqual (1, (int) group.Count, "Count A");
+ Assert.That (status, Is.EqualTo (CMTaggedBufferGroupError.Success), "Status");
+ Assert.That ((int) group.Count, Is.EqualTo (1), "Count A");
Assert.Throws