From 7a5aca9a67e2e5e3ccdbf4f3195948e0625acfc1 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 26 Aug 2024 11:18:18 -0400 Subject: [PATCH] more type converter test fixes --- .../InternetAddressTypeConverterTests.cs | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/UnitTests/InternetAddressTypeConverterTests.cs b/UnitTests/InternetAddressTypeConverterTests.cs index d1d4f85974..13a9fcaac1 100644 --- a/UnitTests/InternetAddressTypeConverterTests.cs +++ b/UnitTests/InternetAddressTypeConverterTests.cs @@ -26,8 +26,6 @@ using System.ComponentModel; -using NUnit.Framework; - using MimeKit; namespace UnitTests { @@ -37,39 +35,41 @@ public class InternetAddressTypeConverterTests [Test] public void TestCanConvert () { - var converter = TypeDescriptor.GetConverter (typeof(InternetAddress)); - Assert.True (converter.CanConvertFrom (typeof(string))); - Assert.True (converter.CanConvertTo (typeof(string))); + var converter = TypeDescriptor.GetConverter (typeof (InternetAddress)); + Assert.That (converter.CanConvertFrom(typeof (string)), Is.True); + Assert.That (converter.CanConvertTo (typeof (string)), Is.True); } [Test] public void TestIsValid () { - var converter = TypeDescriptor.GetConverter (typeof(InternetAddress)); - Assert.True (converter.IsValid ("Jeffrey Stedfast ")); + var converter = TypeDescriptor.GetConverter (typeof (InternetAddress)); + Assert.That (converter.IsValid ("Jeffrey Stedfast "), Is.True); } [Test] public void TestConvertFromValid () { - var converter = TypeDescriptor.GetConverter (typeof(InternetAddress)); + var converter = TypeDescriptor.GetConverter (typeof (InternetAddress)); var result = converter.ConvertFrom ("Jeffrey Stedfast "); - Assert.IsInstanceOf (result); - Assert.AreEqual ("Jeffrey Stedfast", ((MailboxAddress)result).Name); - Assert.AreEqual ("jestedfa@microsoft.com", ((MailboxAddress)result).Address); + Assert.That (result, Is.InstanceOf (typeof (MailboxAddress))); + + var mailbox = (MailboxAddress) result; + Assert.That (mailbox.Name, Is.EqualTo ("Jeffrey Stedfast")); + Assert.That (mailbox.Address, Is.EqualTo ("jestedfa@microsoft.com")); } [Test] public void TestIsNotValid () { - var converter = TypeDescriptor.GetConverter (typeof(InternetAddress)); - Assert.False (converter.IsValid ("")); + var converter = TypeDescriptor.GetConverter (typeof (InternetAddress)); + Assert.That (converter.IsValid (""), Is.False); } [Test] public void TestConvertFromNotValid () { - var converter = TypeDescriptor.GetConverter (typeof(InternetAddress)); + var converter = TypeDescriptor.GetConverter (typeof (InternetAddress)); Assert.Throws (() => converter.ConvertFrom ("")); } }