diff --git a/.gitignore b/.gitignore index 49c9486..c58989a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,37 +1,28 @@ - - Scaffold Mailer InvitationMailer InviteFriend - - - - - - - public virtual MailMessage InviteFriend(Invitation invitation) - { - var mailMessage = new MailMessage{Subject = "Invitation from TravelTo"}; - - mailMessage.To.Add(invitation.FriendEmail); - ViewBag.Invitation = invitation; - PopulateBody(mailMessage, viewName: "InviteFriend"); - - return mailMessage; - } - - -

TravelTo Invitation

- -Hi @ViewBag.Invitation.FriendName:
- -Your friend @ViewBag.Invitation.Name invited you to TravelTo. He also wrote this message.
- -
-@ViewBag.Invitation.InvitationMessage - -
- -@Url.Abs(Url.Action("Index", "Home")) - -using TravelTo.Mailers; -using Mvc.Mailer; - -new InvitationMailer().InviteFriend(invitation).Send(); \ No newline at end of file +# vs +obj +bin +Bin +build +*.csproj.user +*ReSharper* +*resharper* +*.suo +*.user +*.bak +*.sln.cache + +# other +*.bak +*.cache +*.log +*.swp +*.user +* Thumbs.db +*.bin +Autotest.config + +#nuget package +*.nupkg +#Nuget/input/lib +lib +packages diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config new file mode 100644 index 0000000..6a318ad --- /dev/null +++ b/.nuget/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe new file mode 100644 index 0000000..8d13fd8 Binary files /dev/null and b/.nuget/NuGet.exe differ diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets new file mode 100644 index 0000000..1f7c9b5 --- /dev/null +++ b/.nuget/NuGet.targets @@ -0,0 +1,153 @@ + + + + $(MSBuildProjectDirectory)\..\ + + + false + + + false + + + true + + + false + + + + + + + + + + + $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) + $([System.IO.Path]::Combine($(ProjectDir), "packages.config")) + $([System.IO.Path]::Combine($(SolutionDir), "packages")) + + + + + $(SolutionDir).nuget + packages.config + $(SolutionDir)packages + + + + + $(NuGetToolsPath)\nuget.exe + @(PackageSource) + + "$(NuGetExePath)" + mono --runtime=v4.0.30319 $(NuGetExePath) + + $(TargetDir.Trim('\\')) + + -RequireConsent + + $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -o "$(PackagesDir)" + $(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols + + + + RestorePackages; + $(ResolveReferencesDependsOn); + + + + + $(BuildDependsOn); + BuildPackage; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Mvc.Mailer.PreMailer/Mvc.Mailer.PreMailerPostProcessor.csproj b/Mvc.Mailer.PreMailer/Mvc.Mailer.PreMailerPostProcessor.csproj new file mode 100644 index 0000000..deb2fc5 --- /dev/null +++ b/Mvc.Mailer.PreMailer/Mvc.Mailer.PreMailerPostProcessor.csproj @@ -0,0 +1,65 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {209E5AE9-C1E3-4553-9BAB-E711F4F923E3} + Library + Properties + Mvc.Mailer.PreMailerPostProcessor + Mvc.Mailer.PreMailerPostProcessor + v4.0 + 512 + ..\ + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + D:\Desarrollo\nuget + + + + ..\packages\Mvc.Mailer.1.0.4784.2487\lib\net40\Mvc.Mailer.dll + + + ..\packages\PreMailer.Net.1.1.2\lib\net40\PreMailer.Net.dll + + + + + + + + + + + + + + + nuget pack $(ProjectPath) -Prop Configuration=Release -o $(NugetPath) + + + \ No newline at end of file diff --git a/Mvc.Mailer.PreMailer/Mvc.Mailer.PreMailerPostProcessor.nuspec b/Mvc.Mailer.PreMailer/Mvc.Mailer.PreMailerPostProcessor.nuspec new file mode 100644 index 0000000..4715a0d --- /dev/null +++ b/Mvc.Mailer.PreMailer/Mvc.Mailer.PreMailerPostProcessor.nuspec @@ -0,0 +1,17 @@ + + + + $id$ + $version$ + $title$ + $author$ + Hernan Marano + https://github.com/hernangm/MvcMailer + http://www.opensource.org/licenses/mit-license.php + false + This is a satellite assembly to MvcMailer containing a post-processor that applies PreMailer to the html body + First implementation + Copyright 2013 + aspmvc, mvcmailer, premailer + + \ No newline at end of file diff --git a/Mvc.Mailer.PreMailer/PreMailerPostProcessor.cs b/Mvc.Mailer.PreMailer/PreMailerPostProcessor.cs new file mode 100644 index 0000000..157a226 --- /dev/null +++ b/Mvc.Mailer.PreMailer/PreMailerPostProcessor.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Mvc.Mailer.PreMailerPostProcessor +{ + public class PreMailerPostProcessor : IPostProcessor + { + private bool RemoveStyleTag {get; set;} + + public PreMailerPostProcessor() : this(true) {} + + public PreMailerPostProcessor(bool removeStyleTag) + { + this.RemoveStyleTag = removeStyleTag; + } + + public string Process(string body) + { + var pm = new PreMailer.Net.PreMailer(); + return pm.MoveCssInline(body, this.RemoveStyleTag); + } + } +} diff --git a/Mvc.Mailer.PreMailer/Properties/AssemblyInfo.cs b/Mvc.Mailer.PreMailer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..210da22 --- /dev/null +++ b/Mvc.Mailer.PreMailer/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Mvc.Mailer.PreMailerPostProcessor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("Mvc.Mailer.PreMailerPostProcessor")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyCompany("Hernan Marano")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("919e4f63-60f4-4cd6-ba91-92d375686c77")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Mvc.Mailer.PreMailer/packages.config b/Mvc.Mailer.PreMailer/packages.config new file mode 100644 index 0000000..843c276 --- /dev/null +++ b/Mvc.Mailer.PreMailer/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Mvc.Mailer.Test/ExtensionMethods/HtmlHelperExtensionsTest.cs b/Mvc.Mailer.Test/ExtensionMethods/HtmlHelperExtensionsTest.cs index ed7b581..a5f22bf 100644 --- a/Mvc.Mailer.Test/ExtensionMethods/HtmlHelperExtensionsTest.cs +++ b/Mvc.Mailer.Test/ExtensionMethods/HtmlHelperExtensionsTest.cs @@ -1,29 +1,20 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; -using Moq; -using System.Web.Mvc; -using Mvc.Mailer; - -namespace Mvc.Mailer.Test -{ - [TestFixture] - public class HtmlHelperExtensionsTest - { - [Test] - public void InlineAttachment_should_produce_the_right_tag() - { - var htmlHelper = new HtmlHelper(new ViewContext(), new Mock().Object); - Assert.AreEqual("\"\"/", htmlHelper.InlineImage("logo").ToString()); - } - - [Test] - public void InlineAttachment_should_produce_the_right_tag_with_alt() - { - var htmlHelper = new HtmlHelper(new ViewContext(), new Mock().Object); - Assert.AreEqual("\"Company", htmlHelper.InlineImage("logo", "Company Logo").ToString()); - } - } -} +using NUnit.Framework; +using Moq; +using System.Web.Mvc; + +namespace Mvc.Mailer.Test.ExtensionMethods { + [TestFixture] + public class HtmlHelperExtensionsTest { + [Test] + public void InlineAttachment_should_produce_the_right_tag() { + var htmlHelper = new HtmlHelper(new ViewContext(), new Mock().Object); + Assert.AreEqual("\"\"/", htmlHelper.InlineImage("logo").ToString()); + } + + [Test] + public void InlineAttachment_should_produce_the_right_tag_with_alt() { + var htmlHelper = new HtmlHelper(new ViewContext(), new Mock().Object); + Assert.AreEqual("\"Company", htmlHelper.InlineImage("logo", "Company Logo").ToString()); + } + } +} diff --git a/Mvc.Mailer.Test/ExtensionMethods/UrlHelperExtensionsTest.cs b/Mvc.Mailer.Test/ExtensionMethods/UrlHelperExtensionsTest.cs index eb0234a..6bbd881 100644 --- a/Mvc.Mailer.Test/ExtensionMethods/UrlHelperExtensionsTest.cs +++ b/Mvc.Mailer.Test/ExtensionMethods/UrlHelperExtensionsTest.cs @@ -1,90 +1,73 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; -using System.Web; -using System.Web.Mvc; -using System.Web.Routing; -using System.IO; -using System.Configuration; - -namespace Mvc.Mailer.Test -{ - [TestFixture] - public class UrlHelperExtensionsTest - { - UrlHelper _urlHelper; - - [SetUp] - public void Init() - { - var httpContext = HttpContext.Current; - - if (httpContext == null) - { - var request = new HttpRequest("/", "http://example.com:8080", ""); - var response = new HttpResponse(new StringWriter()); - httpContext = new HttpContext(request, response); - } - - var httpContextBase = new HttpContextWrapper(httpContext); - var routeData = new RouteData(); - var requestContext = new RequestContext(httpContextBase, routeData); - - _urlHelper = new UrlHelper(requestContext); - } - - [Test] - public void Abs_with_abs_should_return_itself() - { - Assert.AreEqual("http://hello.com/any/thing", _urlHelper.Abs("http://hello.com/any/thing")); - } - - [Test] - public void Abs_with_relative_should_absolutilze() - { - Assert.AreEqual("http://example.com:8080/any/thing", _urlHelper.Abs("/any/thing")); - } - - [Test] - public void Abs_with_root_should_absolutilze() - { - Assert.AreEqual("http://example.com:8080/", _urlHelper.Abs("/")); - } - - [Test] - public void Abs_with_encoded_params_should_keep_encoding() - { - Assert.AreEqual("http://example.com:8080/?param=encoded%20value", _urlHelper.Abs("/?param=encoded%20value")); - } - - [Test] - public void Abs_with_config_should_use_the_base_url_from_the_config() - { - ConfigurationManager.AppSettings[UrlHelperExtensions.BASE_URL_KEY] = "http://my:666"; - Assert.AreEqual("http://my:666/hello/there", _urlHelper.Abs("/hello/there")); - } - - [Test] - public void Abs_with_config_should_not_double_slash_when_using_the_base_url_from_the_config() - { - ConfigurationManager.AppSettings[UrlHelperExtensions.BASE_URL_KEY] = "http://my:666/"; - Assert.AreEqual("http://my:666/hello/there", _urlHelper.Abs("/hello/there")); - } - - [Test] - public void Abs_with_config_should_put_a_slash_when_using_the_base_url_from_the_config() - { - ConfigurationManager.AppSettings[UrlHelperExtensions.BASE_URL_KEY] = "http://my:666"; - Assert.AreEqual("http://my:666/hello/there", _urlHelper.Abs("hello/there")); - } - - [TearDown] - public void TearDown() - { - ConfigurationManager.AppSettings[UrlHelperExtensions.BASE_URL_KEY] = string.Empty; - } - - } -} +using NUnit.Framework; +using System.Web; +using System.Web.Mvc; +using System.Web.Routing; +using System.IO; +using System.Configuration; + +namespace Mvc.Mailer.Test.ExtensionMethods { + [TestFixture] + public class UrlHelperExtensionsTest { + UrlHelper _urlHelper; + + [SetUp] + public void Init() { + var httpContext = HttpContext.Current; + + if (httpContext == null) { + var request = new HttpRequest("/", "http://example.com:8080", ""); + var response = new HttpResponse(new StringWriter()); + httpContext = new HttpContext(request, response); + } + + var httpContextBase = new HttpContextWrapper(httpContext); + var routeData = new RouteData(); + var requestContext = new RequestContext(httpContextBase, routeData); + + _urlHelper = new UrlHelper(requestContext); + } + + [Test] + public void Abs_with_abs_should_return_itself() { + Assert.AreEqual("http://hello.com/any/thing", _urlHelper.Abs("http://hello.com/any/thing")); + } + + [Test] + public void Abs_with_relative_should_absolutilze() { + Assert.AreEqual("http://example.com:8080/any/thing", _urlHelper.Abs("/any/thing")); + } + + [Test] + public void Abs_with_root_should_absolutilze() { + Assert.AreEqual("http://example.com:8080/", _urlHelper.Abs("/")); + } + + [Test] + public void Abs_with_encoded_params_should_keep_encoding() { + Assert.AreEqual("http://example.com:8080/?param=encoded%20value", _urlHelper.Abs("/?param=encoded%20value")); + } + + [Test] + public void Abs_with_config_should_use_the_base_url_from_the_config() { + ConfigurationManager.AppSettings[UrlHelperExtensions.BASE_URL_KEY] = "http://my:666"; + Assert.AreEqual("http://my:666/hello/there", _urlHelper.Abs("/hello/there")); + } + + [Test] + public void Abs_with_config_should_not_double_slash_when_using_the_base_url_from_the_config() { + ConfigurationManager.AppSettings[UrlHelperExtensions.BASE_URL_KEY] = "http://my:666/"; + Assert.AreEqual("http://my:666/hello/there", _urlHelper.Abs("/hello/there")); + } + + [Test] + public void Abs_with_config_should_put_a_slash_when_using_the_base_url_from_the_config() { + ConfigurationManager.AppSettings[UrlHelperExtensions.BASE_URL_KEY] = "http://my:666"; + Assert.AreEqual("http://my:666/hello/there", _urlHelper.Abs("hello/there")); + } + + [TearDown] + public void TearDown() { + ConfigurationManager.AppSettings[UrlHelperExtensions.BASE_URL_KEY] = string.Empty; + } +} +} \ No newline at end of file diff --git a/Mvc.Mailer.Test/LinkedResourceProviderTest.cs b/Mvc.Mailer.Test/LinkedResourceProviderTest.cs index c108fc5..d43512e 100644 --- a/Mvc.Mailer.Test/LinkedResourceProviderTest.cs +++ b/Mvc.Mailer.Test/LinkedResourceProviderTest.cs @@ -1,57 +1,44 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; -using Moq; -using Mvc.Mailer; -using System.Net.Mail; -using System.IO; -using System.Net.Mime; - -namespace Mvc.Mailer.Test -{ - [TestFixture] - public class LinkedResourceProviderTest - { - [Test] - public void Test_GetAll_should_call_get_and_add_to_list() - { - var linkedResourceProvider = new Mock(); - linkedResourceProvider.CallBase = true; - - var logo = new LinkedResource(new MemoryStream()); - var banner = new LinkedResource(new MemoryStream()); - - linkedResourceProvider.Setup(p => p.Get("logo", "logo.png")).Returns(logo); - linkedResourceProvider.Setup(p => p.Get("banner", "banner.png")).Returns(banner); - - var resourcesMap = new Dictionary(){ - {"logo", "logo.png"}, - {"banner", "banner.png"} - }; - var resources = linkedResourceProvider.Object.GetAll(resourcesMap); - - linkedResourceProvider.VerifyAll(); - Assert.AreEqual(logo, resources.First()); - Assert.AreEqual(banner, resources.Last()); - } - - [Test] - public void Test_Get_should_return_a_linked_resource() - { - var linkedResourceProvider = new Mock(); - linkedResourceProvider.CallBase = true; - - var fileName = "Chrysanthemum.jpg"; - var linkedResource = linkedResourceProvider.Object.Get("flower", fileName); - - Assert.AreEqual("flower", linkedResource.ContentId); - Assert.AreEqual(new ContentType("image/jpeg"), linkedResource.ContentType); - - } - - - - } -} +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Moq; +using System.Net.Mail; +using System.IO; +using System.Net.Mime; + +namespace Mvc.Mailer.Test { + [TestFixture] + public class LinkedResourceProviderTest { + [Test] + public void Test_GetAll_should_call_get_and_add_to_list() { + var linkedResourceProvider = new Mock { CallBase = true }; + + var logo = new LinkedResource(new MemoryStream()); + var banner = new LinkedResource(new MemoryStream()); + + linkedResourceProvider.Setup(p => p.Get("logo", "logo.png")).Returns(logo); + linkedResourceProvider.Setup(p => p.Get("banner", "banner.png")).Returns(banner); + + var resourcesMap = new Dictionary(){ + {"logo", "logo.png"}, + {"banner", "banner.png"} + }; + var resources = linkedResourceProvider.Object.GetAll(resourcesMap); + + linkedResourceProvider.VerifyAll(); + Assert.AreEqual(logo, resources.First()); + Assert.AreEqual(banner, resources.Last()); + } + + [Test] + public void Test_Get_should_return_a_linked_resource() { + var linkedResourceProvider = new Mock { CallBase = true }; + + const string fileName = "Chrysanthemum.jpg"; + var linkedResource = linkedResourceProvider.Object.Get("flower", fileName); + + Assert.AreEqual("flower", linkedResource.ContentId); + Assert.AreEqual(new ContentType("image/jpeg"), linkedResource.ContentType); + } +} +} \ No newline at end of file diff --git a/Mvc.Mailer.Test/MailerBaseTest.cs b/Mvc.Mailer.Test/MailerBaseTest.cs index 3e6b88e..b1dabc6 100644 --- a/Mvc.Mailer.Test/MailerBaseTest.cs +++ b/Mvc.Mailer.Test/MailerBaseTest.cs @@ -1,331 +1,351 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; -using Mvc.Mailer; -using System.Net.Mail; -using System.Web.Mvc; -using Moq; -using System.IO; -using System.Web.Routing; -using System.Web; - -namespace Mvc.Mailer.Test -{ - [TestFixture] - public class MailerBaseTest - { - private MailerBase _mailerBase; - private Mock _mockMailer; - private MailMessage _mailMessage; - - [SetUp] - public void Setup() - { - MailerBase.IsTestModeEnabled = true; - _mailerBase = new MailerBase(); - _mailMessage = new MailMessage(); - - _mockMailer = new Mock(); - _mockMailer.CallBase = true; - } - - #region Properties Related tests - - [Test] - public void TestMasterName([Values(null, "", "_Layout")] string masterName) - { - _mailerBase.MasterName = masterName; - Assert.AreEqual(masterName, _mailerBase.MasterName); - } - - [Test] - public void Test_LinkedResourceProvider() - { - var mailer = new MailerBase(); - var linkResourceProvider = new Mock(); - - mailer.LinkedResourceProvider = linkResourceProvider.Object; - - Assert.AreEqual(linkResourceProvider.Object, mailer.LinkedResourceProvider); - } - - [Test] - public void Test_IsTestModeEnabled() - { - MailerBase.IsTestModeEnabled = true; - Assert.IsTrue(MailerBase.IsTestModeEnabled); - MailerBase.IsTestModeEnabled = false; - Assert.IsFalse(MailerBase.IsTestModeEnabled); - - } - - #endregion - - #region Text related tests - [Test] - public void PopulateTextBody_should_unmark_as_is_body_html() - { - _mockMailer.Setup(m => m.EmailBody("Welcome.text", "Layout.text")).Returns("Hello"); - - _mockMailer.Object.PopulateTextBody(_mailMessage, "Welcome", "Layout"); - _mockMailer.VerifyAll(); - - Assert.AreEqual("Hello", _mailMessage.Body); - Assert.IsFalse(_mailMessage.IsBodyHtml); - } - - [Test] - public void TextViewExists_should_call_view_exists_with_text_names() - { - _mockMailer.Setup(m => m.ViewExists("Welcome.text", "Layout.text")).Returns(true); - Assert.IsTrue(_mockMailer.Object.TextViewExists("Welcome", "Layout")); - _mockMailer.VerifyAll(); - } - - [Test] - public void TextViewName_should_append_dot_text() - { - Assert.AreEqual("Welcome.text", _mailerBase.TextViewName("Welcome")); - } - - [Test] - public void TextMasterName_should_append_dot_text() - { - Assert.AreEqual("Welcome.text", _mailerBase.TextMasterName("Welcome")); - } - - [Test, Sequential] - public void TextMasterName_should_return_nil_when_not_set([Values(null, "")] string masterName) - { - Assert.AreEqual(null, _mailerBase.TextMasterName(masterName)); - } - - [Test] - public void PopulateTextPart_should_use_right_view_name_and_mime() - { - _mockMailer.Setup(m => m.PopulatePart(_mailMessage, "Welcome.text", "text/plain", "Mail.text")); - _mockMailer.Object.PopulateTextPart(_mailMessage, "Welcome", "Mail"); - - _mockMailer.VerifyAll(); - } - - #endregion - - #region Html related tests - [Test] - public void PopulateHtmltBody_should_mark_as_is_body_html() - { - _mockMailer.Setup(m => m.EmailBody("Welcome", "Layout")).Returns("

Hello

"); - - _mockMailer.Object.PopulateHtmlBody(_mailMessage, "Welcome", "Layout"); - _mockMailer.VerifyAll(); - - Assert.AreEqual("

Hello

", _mailMessage.Body); - Assert.IsTrue(_mailMessage.IsBodyHtml); - } - - [Test] - public void HtmlViewExists_should_call_view_exists() - { - _mockMailer.Setup(m => m.ViewExists("Welcome", "Layout")).Returns(true); - Assert.IsTrue(_mockMailer.Object.HtmlViewExists("Welcome", "Layout")); - _mockMailer.VerifyAll(); - } - - [Test] - public void PopulateHtmlPart_should_use_right_view_name_and_mime() - { - var resources = new Dictionary(); - - _mockMailer.Setup(m => m.PopulatePart(_mailMessage, "Welcome", "text/html", "Mail")).Returns(AlternateView.CreateAlternateViewFromString("")); - _mockMailer.Setup(m => m.PopulateLinkedResources(It.IsAny(), resources)); - - _mockMailer.Object.PopulateHtmlPart(_mailMessage, "Welcome", "Mail", resources); - _mockMailer.VerifyAll(); - } - - #endregion - - #region Multi-part related tests - [Test] - [ExpectedException(typeof(ArgumentNullException))] - public void PopulateBody_should_throw_exception_if_mailMessage_is_null() - { - MailMessage mailMessage = null; - _mailerBase.PopulateBody(mailMessage, "Welcome"); - } - - [Test] - public void PopulateBody_should_populate_html_alternate_view_when_both_parts_present() - { - _mockMailer.Setup(m => m.TextViewExists("welcome", "Mail")).Returns(true); - _mockMailer.Setup(m => m.HtmlViewExists("welcome", "Mail")).Returns(true); - - - _mockMailer.Setup(m => m.PopulateTextBody(_mailMessage, "welcome", "Mail")); - _mockMailer.Setup(m => m.PopulateHtmlPart(_mailMessage, "welcome", "Mail", null)); - - _mockMailer.Object.PopulateBody(_mailMessage, "welcome", "Mail"); - _mockMailer.VerifyAll(); - } - - [Test] - public void PopulateBody_should_populate_body_with_text_when_only_text_present() - { - _mockMailer.Setup(m => m.HtmlViewExists("welcome", "Mail")).Returns(false); - _mockMailer.Setup(m => m.TextViewExists("welcome", "Mail")).Returns(true); - - _mockMailer.Setup(m => m.PopulateTextBody(_mailMessage, "welcome", "Mail")); - - _mockMailer.Object.PopulateBody(_mailMessage, "welcome", "Mail"); - _mockMailer.VerifyAll(); - } - - [Test] - public void PopulateBody_should_populate_body_with_html_when_only_html_present() - { - var resourcesToTry = new List>(); - resourcesToTry.Add(null); - resourcesToTry.Add(new Dictionary()); - - - foreach (var resources in resourcesToTry) - { - _mockMailer.Setup(m => m.TextViewExists("welcome", "Mail")).Returns(false); - _mockMailer.Setup(m => m.HtmlViewExists("welcome", "Mail")).Returns(true); - _mockMailer.Setup(m => m.PopulateHtmlBody(_mailMessage, "welcome", "Mail")); - - _mockMailer.Object.PopulateBody(_mailMessage, "welcome", "Mail", resources); - _mockMailer.VerifyAll(); - } - } - - [Test] - public void PopuateBody_should_populate_with_alternate_view_when_html_present_with_linked_resources() - { - - _mockMailer.Setup(m => m.TextViewExists("welcome", "Mail")).Returns(false); - _mockMailer.Setup(m => m.HtmlViewExists("welcome", "Mail")).Returns(true); - - var resources = new Dictionary { { "logo", "logo.png" } }; - _mockMailer.Setup(m => m.PopulateHtmlPart(_mailMessage, "welcome", "Mail", resources)); - - _mockMailer.Object.PopulateBody(_mailMessage, "welcome", "Mail", resources); - _mockMailer.VerifyAll(); - } - - [Test, Combinatorial] - public void IsMultiPart_should_check_html_and_text_exists([Values(true, false)] bool textExists, [Values(true, false)] bool htmlExists) - { - _mockMailer.Setup(m => m.TextViewExists("Welcome", "Layout")).Returns(textExists).Verifiable(); - _mockMailer.Setup(m => m.HtmlViewExists("Welcome", "Layout")).Returns(htmlExists); - - Assert.AreEqual(textExists && htmlExists, _mockMailer.Object.IsMultiPart("Welcome", "Layout")); - } - - #endregion - - #region Utility related tests - [Test] - public void PopulatePart_should_populate_the_specified_part() - { - _mockMailer.Setup(m => m.ViewExists("welcome.text", "Mail.text")).Returns(true); - _mockMailer.Setup(m => m.EmailBody("welcome.text", "Mail.text")).Returns("text part"); - - var mailPart = _mockMailer.Object.PopulatePart(_mailMessage, "welcome.text", "text/plain", "Mail.text"); - - _mockMailer.VerifyAll(); - Assert.AreEqual(1, _mailMessage.AlternateViews.Count); - Assert.AreEqual("text/plain", _mailMessage.AlternateViews[0].ContentType.MediaType); - Assert.AreEqual("text part", GetContent(_mailMessage.AlternateViews[0])); - Assert.IsNotNull(mailPart); - } - - [Test] - public void ViewExists_should_call_view_engines_to_to_find_view() - { - var engines = ViewEngines.Engines; - var engine = new Mock(); - var viewEngineResult = new ViewEngineResult(new Mock().Object, new Mock().Object); - try - { - var mailer = _mailerBase; - var mockControllerContext = new Mock(); - var routeData = new RouteData(); - routeData.Values["controller"] = "Mail"; - mockControllerContext.Setup(m => m.RouteData).Returns(routeData); - - mailer.ControllerContext = mockControllerContext.Object; - ViewEngines.Engines.Clear(); - ViewEngines.Engines.Add(engine.Object); - engine.Setup(e => e.FindView(mailer.ControllerContext, "welcome", "Mail", true)).Returns(viewEngineResult); - Assert.IsTrue(mailer.ViewExists("welcome", "Mail")); - engine.VerifyAll(); - } - finally - { - ViewEngines.Engines.Remove(engine.Object); - ViewEngines.Engines.Union(engines); - } - } - - [Test] - public void Test_PopulateLinkedResources_should_populate_each_resource() - { - var linkedResourceProviderMock = new Mock(); - - _mockMailer.Object.LinkedResourceProvider = linkedResourceProviderMock.Object; - - - var resources = new Dictionary{ - {"logo", "logo.png"}, - {"button", "button.png"} - }; - - var linkResources = new List(); - - linkedResourceProviderMock.Setup(p => p.GetAll(resources)).Returns(linkResources); - - - var htmlView = AlternateView.CreateAlternateViewFromString(""); - var actualResources = _mockMailer.Object.PopulateLinkedResources(htmlView, resources); - - linkedResourceProviderMock.VerifyAll(); - Assert.AreEqual(linkResources, htmlView.LinkedResources); - Assert.AreEqual(linkResources, actualResources); - - } - - [Test] - public void Test_PopulateLinkedResource_should_populate_the_resource() - { - var linkedResourceProviderMock = new Mock(); - - _mockMailer.Object.LinkedResourceProvider = linkedResourceProviderMock.Object; - - LinkedResource linkResource = new LinkedResource(new MemoryStream()); - - linkedResourceProviderMock.Setup(p => p.Get("logo", "logo.png")).Returns(linkResource); - - var htmlView = AlternateView.CreateAlternateViewFromString(""); - var actualResource = _mockMailer.Object.PopulateLinkedResource(htmlView, "logo", "logo.png"); - - linkedResourceProviderMock.VerifyAll(); - Assert.AreEqual(1, htmlView.LinkedResources.Count); - Assert.AreEqual(linkResource, htmlView.LinkedResources.First()); - Assert.AreEqual(linkResource, actualResource); - - } - #endregion - - private string GetContent(AlternateView alternateView) - { - var dataStream = alternateView.ContentStream; - byte[] byteBuffer = new byte[dataStream.Length]; - return System.Text.Encoding.ASCII.GetString(byteBuffer, 0, dataStream.Read(byteBuffer, 0, byteBuffer.Length)); - } - - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using System.Net.Mail; +using System.Web.Mvc; +using Moq; +using System.IO; +using System.Web.Routing; + +namespace Mvc.Mailer.Test +{ + [TestFixture] + public class MailerBaseTest + { + private MailerBase _mailerBase; + private Mock _mockMailer; + private MailMessage _mailMessage; + + [SetUp] + public void Setup() + { + MailerBase.IsTestModeEnabled = true; + _mailerBase = new MailerBase(); + _mailMessage = new MailMessage(); + + _mockMailer = new Mock { CallBase = true }; + } + + #region Properties Related tests + + [Test] + public void TestMasterName([Values(null, "", "_Layout")] string masterName) + { + _mailerBase.MasterName = masterName; + Assert.AreEqual(masterName, _mailerBase.MasterName); + } + + [Test] + public void Test_LinkedResourceProvider() + { + var mailer = new MailerBase(); + var linkResourceProvider = new Mock(); + + mailer.LinkedResourceProvider = linkResourceProvider.Object; + + Assert.AreEqual(linkResourceProvider.Object, mailer.LinkedResourceProvider); + } + + [Test] + public void Test_IsTestModeEnabled() + { + MailerBase.IsTestModeEnabled = true; + Assert.IsTrue(MailerBase.IsTestModeEnabled); + MailerBase.IsTestModeEnabled = false; + Assert.IsFalse(MailerBase.IsTestModeEnabled); + + } + + #endregion + + #region Text related tests + [Test] + public void PopulateTextBody_should_unmark_as_is_body_html() + { + _mockMailer.Setup(m => m.EmailBody("Welcome.text", "Layout.text")).Returns("Hello"); + + _mockMailer.Object.PopulateTextBody(_mailMessage, "Welcome", "Layout"); + _mockMailer.VerifyAll(); + + Assert.AreEqual("Hello", _mailMessage.Body); + Assert.IsFalse(_mailMessage.IsBodyHtml); + } + + [Test] + public void TextViewExists_should_call_view_exists_with_text_names() + { + _mockMailer.Setup(m => m.ViewExists("Welcome.text", "Layout.text")).Returns(true); + Assert.IsTrue(_mockMailer.Object.TextViewExists("Welcome", "Layout")); + _mockMailer.VerifyAll(); + } + + [Test] + public void TextViewName_should_append_dot_text() + { + Assert.AreEqual("Welcome.text", _mailerBase.TextViewName("Welcome")); + } + + [Test] + public void TextMasterName_should_append_dot_text() + { + Assert.AreEqual("Welcome.text", _mailerBase.TextMasterName("Welcome")); + } + + [Test, Sequential] + public void TextMasterName_should_return_nil_when_not_set([Values(null, "")] string masterName) + { + Assert.AreEqual(null, _mailerBase.TextMasterName(masterName)); + } + + [Test] + public void PopulateTextPart_should_use_right_view_name_and_mime() + { + _mockMailer.Setup(m => m.PopulatePart(_mailMessage, "Welcome.text", "text/plain", "Mail.text")); + _mockMailer.Object.PopulateTextPart(_mailMessage, "Welcome", "Mail"); + + _mockMailer.VerifyAll(); + } + + #endregion + + #region Html related tests + [Test] + public void PopulateHtmlBody_should_turn_documentstyle_into_inlinestyle() + { + _mockMailer.Setup(m => m.EmailBody("Welcome", "Layout")).Returns("

Hello

"); + + _mockMailer.Object.PopulateHtmlBody(_mailMessage, "Welcome", "Layout"); + _mockMailer.VerifyAll(); + + Assert.AreEqual("

Hello

", _mailMessage.Body); + Assert.IsTrue(_mailMessage.IsBodyHtml); + } + + [Test] + public void PopulateHtmlBody_should_mark_as_is_body_html() + { + _mockMailer.Setup(m => m.EmailBody("Welcome", "Layout")).Returns("

Hello

"); + + _mockMailer.Object.PopulateHtmlBody(_mailMessage, "Welcome", "Layout"); + _mockMailer.VerifyAll(); + + Assert.AreEqual("

Hello

", _mailMessage.Body); + Assert.IsTrue(_mailMessage.IsBodyHtml); + } + + [Test] + public void HtmlViewExists_should_call_view_exists() + { + _mockMailer.Setup(m => m.ViewExists("Welcome", "Layout")).Returns(true); + Assert.IsTrue(_mockMailer.Object.HtmlViewExists("Welcome", "Layout")); + _mockMailer.VerifyAll(); + } + + [Test] + public void PopulateHtmlPart_should_use_right_view_name_and_mime() + { + var resources = new Dictionary(); + + _mockMailer.Setup(m => m.PopulatePart(_mailMessage, "Welcome", "text/html", "Mail")).Returns(AlternateView.CreateAlternateViewFromString("")); + _mockMailer.Setup(m => m.PopulateLinkedResources(It.IsAny(), resources)); + + _mockMailer.Object.PopulateHtmlPart(_mailMessage, "Welcome", "Mail", resources); + _mockMailer.VerifyAll(); + } + + #endregion + + #region Multi-part related tests + + [Test] + public void Populate_should_create_a_mail_message_and_invoke_action() { + var linkedResources = new Dictionary(); + _mockMailer.Setup(x => x.PopulateBody(It.IsAny(), "welcome", "master", linkedResources)); + var mailMessage = _mockMailer.Object.Populate(x => { + x.Subject = "expected"; + x.ViewName = "welcome"; + x.MasterName = "master"; + x.LinkedResources = linkedResources; + }); + Assert.That(mailMessage.Subject, Is.EqualTo("expected")); + _mockMailer.VerifyAll(); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void PopulateBody_should_throw_exception_if_mailMessage_is_null() + { + MailMessage mailMessage = null; + _mailerBase.PopulateBody(mailMessage, "Welcome"); + } + + [Test] + public void PopulateBody_should_populate_html_alternate_view_when_both_parts_present() + { + _mockMailer.Setup(m => m.TextViewExists("welcome", "Mail")).Returns(true); + _mockMailer.Setup(m => m.HtmlViewExists("welcome", "Mail")).Returns(true); + + + _mockMailer.Setup(m => m.PopulateTextBody(_mailMessage, "welcome", "Mail")); + _mockMailer.Setup(m => m.PopulateHtmlPart(_mailMessage, "welcome", "Mail", null)); + + _mockMailer.Object.PopulateBody(_mailMessage, "welcome", "Mail"); + _mockMailer.VerifyAll(); + } + + [Test] + public void PopulateBody_should_populate_body_with_text_when_only_text_present() + { + _mockMailer.Setup(m => m.HtmlViewExists("welcome", "Mail")).Returns(false); + _mockMailer.Setup(m => m.TextViewExists("welcome", "Mail")).Returns(true); + + _mockMailer.Setup(m => m.PopulateTextBody(_mailMessage, "welcome", "Mail")); + + _mockMailer.Object.PopulateBody(_mailMessage, "welcome", "Mail"); + _mockMailer.VerifyAll(); + } + + [Test] + public void PopulateBody_should_populate_body_with_html_when_only_html_present() + { + var resourcesToTry = new List>(); + resourcesToTry.Add(null); + resourcesToTry.Add(new Dictionary()); + + + foreach (var resources in resourcesToTry) + { + _mockMailer.Setup(m => m.TextViewExists("welcome", "Mail")).Returns(false); + _mockMailer.Setup(m => m.HtmlViewExists("welcome", "Mail")).Returns(true); + _mockMailer.Setup(m => m.PopulateHtmlBody(_mailMessage, "welcome", "Mail")); + + _mockMailer.Object.PopulateBody(_mailMessage, "welcome", "Mail", resources); + _mockMailer.VerifyAll(); + } + } + + [Test] + public void PopulateBody_should_populate_with_alternate_view_when_html_present_with_linked_resources() + { + + _mockMailer.Setup(m => m.TextViewExists("welcome", "Mail")).Returns(false); + _mockMailer.Setup(m => m.HtmlViewExists("welcome", "Mail")).Returns(true); + + var resources = new Dictionary { { "logo", "logo.png" } }; + _mockMailer.Setup(m => m.PopulateHtmlPart(_mailMessage, "welcome", "Mail", resources)); + + _mockMailer.Object.PopulateBody(_mailMessage, "welcome", "Mail", resources); + _mockMailer.VerifyAll(); + } + + [Test, Combinatorial] + public void IsMultiPart_should_check_html_and_text_exists([Values(true, false)] bool textExists, [Values(true, false)] bool htmlExists) + { + _mockMailer.Setup(m => m.TextViewExists("Welcome", "Layout")).Returns(textExists).Verifiable(); + _mockMailer.Setup(m => m.HtmlViewExists("Welcome", "Layout")).Returns(htmlExists); + + Assert.AreEqual(textExists && htmlExists, _mockMailer.Object.IsMultiPart("Welcome", "Layout")); + } + + #endregion + + #region Utility related tests + [Test] + public void PopulatePart_should_populate_the_specified_part() + { + _mockMailer.Setup(m => m.ViewExists("welcome.text", "Mail.text")).Returns(true); + _mockMailer.Setup(m => m.EmailBody("welcome.text", "Mail.text")).Returns("text part"); + + var mailPart = _mockMailer.Object.PopulatePart(_mailMessage, "welcome.text", "text/plain", "Mail.text"); + + _mockMailer.VerifyAll(); + Assert.AreEqual(1, _mailMessage.AlternateViews.Count); + Assert.AreEqual("text/plain", _mailMessage.AlternateViews[0].ContentType.MediaType); + Assert.AreEqual("text part", GetContent(_mailMessage.AlternateViews[0])); + Assert.IsNotNull(mailPart); + } + + [Test] + public void ViewExists_should_call_view_engines_to_to_find_view() + { + var engines = ViewEngines.Engines; + var engine = new Mock(); + var viewEngineResult = new ViewEngineResult(new Mock().Object, new Mock().Object); + try + { + var mailer = _mailerBase; + var mockControllerContext = new Mock(); + var routeData = new RouteData(); + routeData.Values["controller"] = "Mail"; + mockControllerContext.Setup(m => m.RouteData).Returns(routeData); + + mailer.ControllerContext = mockControllerContext.Object; + ViewEngines.Engines.Clear(); + ViewEngines.Engines.Add(engine.Object); + engine.Setup(e => e.FindView(mailer.ControllerContext, "welcome", "Mail", true)).Returns(viewEngineResult); + Assert.IsTrue(mailer.ViewExists("welcome", "Mail")); + engine.VerifyAll(); + } + finally + { + ViewEngines.Engines.Remove(engine.Object); + ViewEngines.Engines.Union(engines); + } + } + + [Test] + public void Test_PopulateLinkedResources_should_populate_each_resource() + { + var linkedResourceProviderMock = new Mock(); + + _mockMailer.Object.LinkedResourceProvider = linkedResourceProviderMock.Object; + + + var resources = new Dictionary{ + {"logo", "logo.png"}, + {"button", "button.png"} + }; + + var linkResources = new List(); + + linkedResourceProviderMock.Setup(p => p.GetAll(resources)).Returns(linkResources); + + + var htmlView = AlternateView.CreateAlternateViewFromString(""); + var actualResources = _mockMailer.Object.PopulateLinkedResources(htmlView, resources); + + linkedResourceProviderMock.VerifyAll(); + Assert.AreEqual(linkResources, htmlView.LinkedResources); + Assert.AreEqual(linkResources, actualResources); + + } + + [Test] + public void Test_PopulateLinkedResource_should_populate_the_resource() + { + var linkedResourceProviderMock = new Mock(); + + _mockMailer.Object.LinkedResourceProvider = linkedResourceProviderMock.Object; + + var linkResource = new LinkedResource(new MemoryStream()); + + linkedResourceProviderMock.Setup(p => p.Get("logo", "logo.png")).Returns(linkResource); + + var htmlView = AlternateView.CreateAlternateViewFromString(""); + var actualResource = _mockMailer.Object.PopulateLinkedResource(htmlView, "logo", "logo.png"); + + linkedResourceProviderMock.VerifyAll(); + Assert.AreEqual(1, htmlView.LinkedResources.Count); + Assert.AreEqual(linkResource, htmlView.LinkedResources.First()); + Assert.AreEqual(linkResource, actualResource); + } + #endregion + + private string GetContent(AlternateView alternateView) { + var dataStream = alternateView.ContentStream; + var byteBuffer = new byte[dataStream.Length]; + return System.Text.Encoding.ASCII.GetString(byteBuffer, 0, dataStream.Read(byteBuffer, 0, byteBuffer.Length)); + } +} +} \ No newline at end of file diff --git a/Mvc.Mailer.Test/Mocks.cs b/Mvc.Mailer.Test/Mocks.cs index c6bb159..ad4f107 100644 --- a/Mvc.Mailer.Test/Mocks.cs +++ b/Mvc.Mailer.Test/Mocks.cs @@ -1,47 +1,30 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; -using Mvc.Mailer; -using System.Web.Mvc; -using System.Web; -using System.Web.Routing; - -namespace Mvc.Mailer.Test -{ - public class MockedView : IView - { - - public static readonly string CannedResponse = "Hello World!"; - - public void Render(ViewContext viewContext, System.IO.TextWriter writer) - { - writer.Write(MockedView.CannedResponse); - } - } - - public class EmptyHttpContext : HttpContextBase - { - - } - - public class MyViewEngine : IViewEngine - { - - public ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache) - { - throw new NotImplementedException(); - } - - public ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache) - { - return new ViewEngineResult(new MockedView(), this); - } - - public void ReleaseView(ControllerContext controllerContext, IView view) - { - throw new NotImplementedException(); - } - } +using System; +using System.Web.Mvc; +using System.Web; + +namespace Mvc.Mailer.Test { + public class MockedView : IView { + public static readonly string CannedResponse = "Hello World!"; + + public void Render(ViewContext viewContext, System.IO.TextWriter writer) { + writer.Write(CannedResponse); + } + } + + public class EmptyHttpContext : HttpContextBase { + } + + public class MyViewEngine : IViewEngine { + public ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache) { + throw new NotImplementedException(); + } + + public ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache) { + return new ViewEngineResult(new MockedView(), this); + } + + public void ReleaseView(ControllerContext controllerContext, IView view) { + throw new NotImplementedException(); + } + } } \ No newline at end of file diff --git a/Mvc.Mailer.Test/Mvc.Mailer.Test.csproj b/Mvc.Mailer.Test/Mvc.Mailer.Test.csproj index 59795cd..048c44d 100644 --- a/Mvc.Mailer.Test/Mvc.Mailer.Test.csproj +++ b/Mvc.Mailer.Test/Mvc.Mailer.Test.csproj @@ -1,84 +1,99 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {3664DD95-3C70-421E-96CA-9B63EE086C27} - Library - Properties - Mvc.Mailer.Test - Mvc.Mailer.Test - v4.0 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\Downloads\Moq.4.0.10827\NET40\Moq.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {37B58562-EF1A-47FE-A02E-98C82D5FB5BC} - Mvc.Mailer - - - - - Always - - - - - "C:\Program Files (x86)\NUnit 2.5.9\bin\net-2.0\nunit-x86" /run Mvc.Mailer.Test.dll - - + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {3664DD95-3C70-421E-96CA-9B63EE086C27} + Library + Properties + Mvc.Mailer.Test + Mvc.Mailer.Test + v4.0 + 512 + ..\ + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + AnyCPU + + + + ..\packages\Moq.4.0.10827\lib\NET40\Moq.dll + + + False + ..\packages\NUnit.2.6.2\lib\nunit.framework.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + Always + + + + + + + + {209E5AE9-C1E3-4553-9BAB-E711F4F923E3} + Mvc.Mailer.PreMailerPostProcessor + + + {37B58562-EF1A-47FE-A02E-98C82D5FB5BC} + Mvc.Mailer + + + + + + + + + \ No newline at end of file diff --git a/Mvc.Mailer.Test/Mvc.Mailer.Test.csproj.user b/Mvc.Mailer.Test/Mvc.Mailer.Test.csproj.user index aaca892..a4f945f 100644 --- a/Mvc.Mailer.Test/Mvc.Mailer.Test.csproj.user +++ b/Mvc.Mailer.Test/Mvc.Mailer.Test.csproj.user @@ -1,13 +1,13 @@ - - - - - - - - - - - - + + + + D:\Desarrollo\proyectos\_Frameworks\MvcMailer\Mvc.Mailer.Test\bin\Debug\ + Mvc.Mailer.Test.dll /run + Program + C:\Program Files (x86)\NUnit 2.6.1\bin\nunit.exe + + + + + \ No newline at end of file diff --git a/Mvc.Mailer.Test/ExtensionMethods/MailMessageExtensionsTest.cs b/Mvc.Mailer.Test/MvcMailMessageTest.cs similarity index 66% rename from Mvc.Mailer.Test/ExtensionMethods/MailMessageExtensionsTest.cs rename to Mvc.Mailer.Test/MvcMailMessageTest.cs index b62d8a7..456c2ba 100644 --- a/Mvc.Mailer.Test/ExtensionMethods/MailMessageExtensionsTest.cs +++ b/Mvc.Mailer.Test/MvcMailMessageTest.cs @@ -1,84 +1,68 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; -using Mvc.Mailer; -using System.Net.Mail; -using System.IO; -using System.Threading; -using Moq; - -namespace Mvc.Mailer.Test -{ - [TestFixture] - public class MailMessageExtensionsTest - { - - private SmtpClientWrapper _smtpClient; - private MailMessage _mailMessage; - private DirectoryInfo _mailDirectory; - - [SetUp] - public void SetUp() - { - var smtpClient = new SmtpClient(); - smtpClient.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; - - _mailDirectory = Directory.CreateDirectory(Path.Combine(Environment.CurrentDirectory, "Mails")); - smtpClient.PickupDirectoryLocation = _mailDirectory.FullName; - smtpClient.Host = "smtp.gmail.com"; - smtpClient.Port = 597; - _smtpClient = new SmtpClientWrapper{InnerSmtpClient = smtpClient}; - _mailMessage = new MailMessage { From = new MailAddress("gaga@gaga.com") }; - _mailMessage.To.Add("gigi@gigi.com"); - _mailMessage.Subject = "Hello!"; - _mailMessage.Body = "Mail Body"; - } - - [Test] - public void TestSend() - { - _mailMessage.Send(_smtpClient); - Assert.Pass("Mail Send working since no exception wast thrown"); - } - - [Test] - public void TestSendAsync() - { - _mailMessage.SendAsync(smtpClient: _smtpClient); - Assert.Pass("Mail Send Async working since no exception wast thrown"); - - } - - [Test] - public void SendAsync_with_userState_should_pass_that() - { - var client = new Mock(); - client.Setup(c => c.SendAsync(_mailMessage, "something")); - _mailMessage.SendAsync(userState: "something", smtpClient: client.Object); - client.VerifyAll(); - } - - [Test] - public void In_Test_Mode_should_use_TestSmtpClient() - { - TestSmtpClient.SentMails.Clear(); - MailerBase.IsTestModeEnabled = true; - _mailMessage.Send(); - Assert.AreEqual(1, TestSmtpClient.SentMails.Count); - Assert.AreSame(_mailMessage, TestSmtpClient.SentMails[0]); - } - - [TearDown] - public void TearDown() - { - MailerBase.IsTestModeEnabled = false; - TestSmtpClient.SentMails.Clear(); - _mailDirectory.Delete(true); - } - - - - } -} +using System; +using NUnit.Framework; +using System.Net.Mail; +using System.IO; +using Moq; + +namespace Mvc.Mailer.Test { + [TestFixture] + public class MvcMailMessageTest { + + private SmtpClientWrapper _smtpClient; + private MvcMailMessage _mailMessage; + private DirectoryInfo _mailDirectory; + + [SetUp] + public void SetUp() { + var smtpClient = new SmtpClient { + DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory + }; + + _mailDirectory = Directory.CreateDirectory(Path.Combine(Environment.CurrentDirectory, "Mails")); + smtpClient.PickupDirectoryLocation = _mailDirectory.FullName; + smtpClient.Host = "smtp.gmail.com"; + smtpClient.Port = 597; + _smtpClient = new SmtpClientWrapper { InnerSmtpClient = smtpClient }; + _mailMessage = new MvcMailMessage { From = new MailAddress("gaga@gaga.com") }; + _mailMessage.To.Add("gigi@gigi.com"); + _mailMessage.Subject = "Hello!"; + _mailMessage.Body = "Mail Body"; + } + + [Test] + public void TestSend() { + _mailMessage.Send(_smtpClient); + Assert.Pass("Mail Send working since no exception wast thrown"); + } + + [Test] + public void TestSendAsync() { + _mailMessage.SendAsync(smtpClient: _smtpClient); + Assert.Pass("Mail Send Async working since no exception wast thrown"); + } + + [Test] + public void SendAsync_with_userState_should_pass_that() { + var client = new Mock(); + client.Setup(c => c.SendAsync(_mailMessage, "something")); + _mailMessage.SendAsync(userState: "something", smtpClient: client.Object); + client.VerifyAll(); + } + + [Test] + public void In_Test_Mode_should_use_TestSmtpClient() { + TestSmtpClient.SentMails.Clear(); + MailerBase.IsTestModeEnabled = true; + _mailMessage.Send(); + Assert.AreEqual(1, TestSmtpClient.SentMails.Count); + Assert.AreSame(_mailMessage, TestSmtpClient.SentMails[0]); + } + + [TearDown] + public void TearDown() { + MailerBase.IsTestModeEnabled = false; + TestSmtpClient.SentMails.Clear(); + _mailDirectory.Delete(true); + } + } +} \ No newline at end of file diff --git a/Mvc.Mailer.Test/SmtpClientWrapperTest.cs b/Mvc.Mailer.Test/SmtpClientWrapperTest.cs index ce67747..fd1dfa4 100644 --- a/Mvc.Mailer.Test/SmtpClientWrapperTest.cs +++ b/Mvc.Mailer.Test/SmtpClientWrapperTest.cs @@ -1,44 +1,32 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; -using System.Net.Mail; - -namespace Mvc.Mailer.Test -{ - [TestFixture] - public class SmtpClientWrapperTest - { - [Test] - public void SmtpClientWrapper_should_be_implicitly_created_from_smtp_client() - { - SmtpClientWrapper smtpClientWrapper = new SmtpClient(); - } - - [Test] - public void Empty_constructor_should_initiaize_InnerSmtpClient() - { - Assert.IsNotNull(new SmtpClientWrapper().InnerSmtpClient); - } - - - [Test] - public void Constructor_with_SmtpClient_should_initiaize_InnerSmtpClient() - { - SmtpClient client = new SmtpClient(); - Assert.AreSame(client, new SmtpClientWrapper(client).InnerSmtpClient); - } - - [Test] - public void Test_InnerSmtpClient() - { - var wrapper = new SmtpClientWrapper(); - SmtpClient client = new SmtpClient(); - wrapper.InnerSmtpClient = client; - Assert.AreSame(client, wrapper.InnerSmtpClient); - } - - - } -} +using NUnit.Framework; +using System.Net.Mail; + +namespace Mvc.Mailer.Test { + [TestFixture] + public class SmtpClientWrapperTest { + [Test] + public void SmtpClientWrapper_should_be_implicitly_created_from_smtp_client() { + SmtpClientWrapper smtpClientWrapper = new SmtpClient(); + } + + [Test] + public void Empty_constructor_should_initiaize_InnerSmtpClient() { + Assert.IsNotNull(new SmtpClientWrapper().InnerSmtpClient); + } + + + [Test] + public void Constructor_with_SmtpClient_should_initiaize_InnerSmtpClient() { + var client = new SmtpClient(); + Assert.AreSame(client, new SmtpClientWrapper(client).InnerSmtpClient); + } + + [Test] + public void Test_InnerSmtpClient() { + var wrapper = new SmtpClientWrapper(); + var client = new SmtpClient(); + wrapper.InnerSmtpClient = client; + Assert.AreSame(client, wrapper.InnerSmtpClient); + } +} +} \ No newline at end of file diff --git a/Mvc.Mailer.Test/StringResultTest.cs b/Mvc.Mailer.Test/StringResultTest.cs index ed4d826..7f600a0 100644 --- a/Mvc.Mailer.Test/StringResultTest.cs +++ b/Mvc.Mailer.Test/StringResultTest.cs @@ -1,41 +1,31 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using NUnit.Framework; -using Mvc.Mailer; using System.Web.Mvc; -using System.Web; using System.Web.Routing; -namespace Mvc.Mailer.Test -{ +namespace Mvc.Mailer.Test { [TestFixture] - public class StringResultTest - { + public class StringResultTest { private StringResult _stringResult; + [SetUp] - public void SetUp() - { + public void SetUp() { _stringResult = new StringResult(); } [Test, ExpectedException(typeof(ArgumentNullException))] - public void ExecuteResultWithNullContextShouldThrowArgumentNullException() - { + public void ExecuteResultWithNullContextShouldThrowArgumentNullException() { _stringResult.ExecuteResult(null); } [Test, ExpectedException(typeof(ArgumentNullException))] - public void ExecuteResultWithBlankViewNameShouldThrowArgumentNullException([Values(null, "")] string viewName) - { + public void ExecuteResultWithBlankViewNameShouldThrowArgumentNullException([Values(null, "")] string viewName) { _stringResult.ViewName = viewName; _stringResult.ExecuteResult(new ControllerContext()); } [Test] - public void ShouldRenderViewIntoOutputPropertyWhenViewIsSet() - { + public void ShouldRenderViewIntoOutputPropertyWhenViewIsSet() { _stringResult.View = new MockedView(); _stringResult.ViewName = "welcome"; _stringResult.ExecuteResult(new ControllerContext()); @@ -43,8 +33,7 @@ public void ShouldRenderViewIntoOutputPropertyWhenViewIsSet() } [Test] - public void ShouldRenderViewIntoOutputProperty() - { + public void ShouldRenderViewIntoOutputProperty() { ViewEngines.Engines.Add(new MyViewEngine()); _stringResult.ViewName = "welcome"; var httpContext = new EmptyHttpContext(); @@ -56,5 +45,4 @@ public void ShouldRenderViewIntoOutputProperty() Assert.AreEqual(MockedView.CannedResponse, _stringResult.Output); } } - -} +} \ No newline at end of file diff --git a/Mvc.Mailer.Test/TestSmtpClientTest.cs b/Mvc.Mailer.Test/TestSmtpClientTest.cs index fa6e01f..72497e7 100644 --- a/Mvc.Mailer.Test/TestSmtpClientTest.cs +++ b/Mvc.Mailer.Test/TestSmtpClientTest.cs @@ -1,33 +1,24 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; +using NUnit.Framework; using System.Net.Mail; -namespace Mvc.Mailer.Test -{ +namespace Mvc.Mailer.Test { [TestFixture] - public class TestSmtpClientTest - { + public class TestSmtpClientTest { TestSmtpClient _testSmtpClient; [SetUp] - public void Init() - { + public void Init() { _testSmtpClient = new TestSmtpClient(); } [Test] - public void SentMails_should_be_not_null() - { + public void SentMails_should_be_not_null() { Assert.IsNotNull(TestSmtpClient.SentMails); } [Test] - public void Send_should_add_to_sent_mails() - { - var messageA = new MailMessage { From = new MailAddress("hello@example.com"), Subject="Hello", Body="There" }; + public void Send_should_add_to_sent_mails() { + var messageA = new MailMessage { From = new MailAddress("hello@example.com"), Subject = "Hello", Body = "There" }; messageA.To.Add("hi@example.com"); var messageB = new MailMessage { From = new MailAddress("hi@example.com"), Subject = "There", Body = "Hello" }; messageB.To.Add("hello@example.com"); @@ -41,8 +32,7 @@ public void Send_should_add_to_sent_mails() } [Test] - public void Send_should_set_async_to_false() - { + public void Send_should_set_async_to_false() { var messageA = new MailMessage { From = new MailAddress("hello@example.com"), Subject = "Hello", Body = "There" }; messageA.To.Add("hi@example.com"); @@ -53,8 +43,7 @@ public void Send_should_set_async_to_false() } [Test] - public void SendAsync_should_add_to_sent_mails() - { + public void SendAsync_should_add_to_sent_mails() { var messageA = new MailMessage { From = new MailAddress("hello@example.com"), Subject = "Hello", Body = "There" }; messageA.To.Add("hi@example.com"); var messageB = new MailMessage { From = new MailAddress("hi@example.com"), Subject = "There", Body = "Hello" }; @@ -69,8 +58,7 @@ public void SendAsync_should_add_to_sent_mails() } [Test] - public void SendAsync_should_set_async_to_false() - { + public void SendAsync_should_set_async_to_false() { var messageA = new MailMessage { From = new MailAddress("hello@example.com"), Subject = "Hello", Body = "There" }; messageA.To.Add("hi@example.com"); @@ -81,8 +69,7 @@ public void SendAsync_should_set_async_to_false() } [Test] - public void SendAsync_should_fire_call_back_if_registered() - { + public void SendAsync_should_fire_call_back_if_registered() { var eventFired = false; _testSmtpClient.SendCompleted += (sender, e) => eventFired = true; var messageA = new MailMessage { From = new MailAddress("hello@example.com"), Subject = "Hello", Body = "There" }; @@ -92,12 +79,10 @@ public void SendAsync_should_fire_call_back_if_registered() } [TearDown] - public void TearDown() - { + public void TearDown() { MailerBase.IsTestModeEnabled = false; TestSmtpClient.SentMails.Clear(); TestSmtpClient.WasLastCallAsync = false; } - } -} +} \ No newline at end of file diff --git a/Mvc.Mailer.Test/bin/Debug/Chrysanthemum.jpg b/Mvc.Mailer.Test/bin/Debug/Chrysanthemum.jpg deleted file mode 100644 index 757c2a6..0000000 Binary files a/Mvc.Mailer.Test/bin/Debug/Chrysanthemum.jpg and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Debug/Moq.dll b/Mvc.Mailer.Test/bin/Debug/Moq.dll deleted file mode 100644 index 3a3e653..0000000 Binary files a/Mvc.Mailer.Test/bin/Debug/Moq.dll and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Debug/Moq.pdb b/Mvc.Mailer.Test/bin/Debug/Moq.pdb deleted file mode 100644 index 03cca56..0000000 Binary files a/Mvc.Mailer.Test/bin/Debug/Moq.pdb and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Debug/Moq.xml b/Mvc.Mailer.Test/bin/Debug/Moq.xml deleted file mode 100644 index 13b8804..0000000 --- a/Mvc.Mailer.Test/bin/Debug/Moq.xml +++ /dev/null @@ -1,5120 +0,0 @@ - - - - Moq - - - - - Implements the fluent API. - - - - - The expectation will be considered only in the former condition. - - - - - - - The expectation will be considered only in the former condition. - - - - - - - - Setups the get. - - The type of the property. - The expression. - - - - - Setups the set. - - The type of the property. - The setter expression. - - - - - Setups the set. - - The setter expression. - - - - - Defines the Callback verb and overloads. - - - - - Helper interface used to hide the base - members from the fluent API to make it much cleaner - in Visual Studio intellisense. - - - - - - - - - - - - - - - - - Specifies a callback to invoke when the method is called. - - The callback method to invoke. - - The following example specifies a callback to set a boolean - value that can be used later: - - var called = false; - mock.Setup(x => x.Execute()) - .Callback(() => called = true); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The argument type of the invoked method. - The callback method to invoke. - - Invokes the given callback with the concrete invocation argument value. - - Notice how the specific string argument is retrieved by simply declaring - it as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute(It.IsAny<string>())) - .Callback((string command) => Console.WriteLine(command)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3) => Console.WriteLine(arg1 + arg2 + arg3)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The type of the fifteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The type of the fifteenth argument of the invoked method. - The type of the sixteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16)); - - - - - - Defines the Callback verb and overloads for callbacks on - setups that return a value. - - Mocked type. - Type of the return value of the setup. - - - - Specifies a callback to invoke when the method is called. - - The callback method to invoke. - - The following example specifies a callback to set a boolean value that can be used later: - - var called = false; - mock.Setup(x => x.Execute()) - .Callback(() => called = true) - .Returns(true); - - Note that in the case of value-returning methods, after the Callback - call you can still specify the return value. - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the argument of the invoked method. - Callback method to invoke. - - Invokes the given callback with the concrete invocation argument value. - - Notice how the specific string argument is retrieved by simply declaring - it as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute(It.IsAny<string>())) - .Callback(command => Console.WriteLine(command)) - .Returns(true); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2) => Console.WriteLine(arg1 + arg2)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3) => Console.WriteLine(arg1 + arg2 + arg3)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The type of the fifteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The type of the fifteenth argument of the invoked method. - The type of the sixteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16)); - - - - - - Defines the Raises verb. - - - - - Specifies the event that will be raised - when the setup is met. - - An expression that represents an event attach or detach action. - The event arguments to pass for the raised event. - - The following example shows how to raise an event when - the setup is met: - - var mock = new Mock<IContainer>(); - - mock.Setup(add => add.Add(It.IsAny<string>(), It.IsAny<object>())) - .Raises(add => add.Added += null, EventArgs.Empty); - - - - - - Specifies the event that will be raised - when the setup is matched. - - An expression that represents an event attach or detach action. - A function that will build the - to pass when raising the event. - - - - - Specifies the custom event that will be raised - when the setup is matched. - - An expression that represents an event attach or detach action. - The arguments to pass to the custom delegate (non EventHandler-compatible). - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - The type of the eleventh argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - The type of the eleventh argument received by the expected invocation. - The type of the twelfth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - The type of the eleventh argument received by the expected invocation. - The type of the twelfth argument received by the expected invocation. - The type of the thirteenth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - The type of the eleventh argument received by the expected invocation. - The type of the twelfth argument received by the expected invocation. - The type of the thirteenth argument received by the expected invocation. - The type of the fourteenth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - The type of the eleventh argument received by the expected invocation. - The type of the twelfth argument received by the expected invocation. - The type of the thirteenth argument received by the expected invocation. - The type of the fourteenth argument received by the expected invocation. - The type of the fifteenth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - The type of the eleventh argument received by the expected invocation. - The type of the twelfth argument received by the expected invocation. - The type of the thirteenth argument received by the expected invocation. - The type of the fourteenth argument received by the expected invocation. - The type of the fifteenth argument received by the expected invocation. - The type of the sixteenth argument received by the expected invocation. - - - - - Defines the Returns verb. - - Mocked type. - Type of the return value from the expression. - - - - Specifies the value to return. - - The value to return, or . - - Return a true value from the method call: - - mock.Setup(x => x.Execute("ping")) - .Returns(true); - - - - - - Specifies a function that will calculate the value to return from the method. - - The function that will calculate the return value. - - Return a calculated value when the method is called: - - mock.Setup(x => x.Execute("ping")) - .Returns(() => returnValues[0]); - - The lambda expression to retrieve the return value is lazy-executed, - meaning that its value may change depending on the moment the method - is executed and the value the returnValues array has at - that moment. - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the argument of the invoked method. - The function that will calculate the return value. - - Return a calculated value which is evaluated lazily at the time of the invocation. - - The lookup list can change between invocations and the setup - will return different values accordingly. Also, notice how the specific - string argument is retrieved by simply declaring it as part of the lambda - expression: - - - mock.Setup(x => x.Execute(It.IsAny<string>())) - .Returns((string command) => returnValues[command]); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2) => arg1 + arg2); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3) => arg1 + arg2 + arg3); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4) => arg1 + arg2 + arg3 + arg4); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5) => arg1 + arg2 + arg3 + arg4 + arg5); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The type of the fifteenth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The type of the fifteenth argument of the invoked method. - The type of the sixteenth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16); - - - - - - Language for ReturnSequence - - - - - Returns value - - - - - Throws an exception - - - - - Throws an exception - - - - - The first method call or member access will be the - last segment of the expression (depth-first traversal), - which is the one we have to Setup rather than FluentMock. - And the last one is the one we have to Mock.Get rather - than FluentMock. - - - - - Base class for mocks and static helper class with methods that - apply to mocked objects, such as to - retrieve a from an object instance. - - - - - Creates an mock object of the indicated type. - - The type of the mocked object. - The mocked object created. - - - - Creates an mock object of the indicated type. - - The predicate with the specification of how the mocked object should behave. - The type of the mocked object. - The mocked object created. - - - - Initializes a new instance of the class. - - - - - Retrieves the mock object for the given object instance. - - Type of the mock to retrieve. Can be omitted as it's inferred - from the object instance passed in as the instance. - The instance of the mocked object.The mock associated with the mocked object. - The received instance - was not created by Moq. - - The following example shows how to add a new setup to an object - instance which is not the original but rather - the object associated with it: - - // Typed instance, not the mock, is retrieved from some test API. - HttpContextBase context = GetMockContext(); - - // context.Request is the typed object from the "real" API - // so in order to add a setup to it, we need to get - // the mock that "owns" it - Mock<HttpRequestBase> request = Mock.Get(context.Request); - mock.Setup(req => req.AppRelativeCurrentExecutionFilePath) - .Returns(tempUrl); - - - - - - Returns the mocked object value. - - - - - Verifies that all verifiable expectations have been met. - - This example sets up an expectation and marks it as verifiable. After - the mock is used, a Verify() call is issued on the mock - to ensure the method in the setup was invoked: - - var mock = new Mock<IWarehouse>(); - this.Setup(x => x.HasInventory(TALISKER, 50)).Verifiable().Returns(true); - ... - // other test code - ... - // Will throw if the test code has didn't call HasInventory. - this.Verify(); - - Not all verifiable expectations were met. - - - - Verifies all expectations regardless of whether they have - been flagged as verifiable. - - This example sets up an expectation without marking it as verifiable. After - the mock is used, a call is issued on the mock - to ensure that all expectations are met: - - var mock = new Mock<IWarehouse>(); - this.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true); - ... - // other test code - ... - // Will throw if the test code has didn't call HasInventory, even - // that expectation was not marked as verifiable. - this.VerifyAll(); - - At least one expectation was not met. - - - - Gets the interceptor target for the given expression and root mock, - building the intermediate hierarchy of mock objects if necessary. - - - - - Raises the associated event with the given - event argument data. - - - - - Raises the associated event with the given - event argument data. - - - - - Adds an interface implementation to the mock, - allowing setups to be specified for it. - - This method can only be called before the first use - of the mock property, at which - point the runtime type has already been generated - and no more interfaces can be added to it. - - Also, must be an - interface and not a class, which must be specified - when creating the mock instead. - - - The mock type - has already been generated by accessing the property. - - The specified - is not an interface. - - The following example creates a mock for the main interface - and later adds to it to verify - it's called by the consumer code: - - var mock = new Mock<IProcessor>(); - mock.Setup(x => x.Execute("ping")); - - // add IDisposable interface - var disposable = mock.As<IDisposable>(); - disposable.Setup(d => d.Dispose()).Verifiable(); - - Type of interface to cast the mock to. - - - - - - - Behavior of the mock, according to the value set in the constructor. - - - - - Whether the base member virtual implementation will be called - for mocked classes if no setup is matched. Defaults to . - - - - - Specifies the behavior to use when returning default values for - unexpected invocations on loose mocks. - - - - - Gets the mocked object instance. - - - - - Retrieves the type of the mocked object, its generic type argument. - This is used in the auto-mocking of hierarchy access. - - - - - Specifies the class that will determine the default - value to return when invocations are made that - have no setups and need to return a default - value (for loose mocks). - - - - - Exposes the list of extra interfaces implemented by the mock. - - - - - Utility repository class to use to construct multiple - mocks when consistent verification is - desired for all of them. - - - If multiple mocks will be created during a test, passing - the desired (if different than the - or the one - passed to the repository constructor) and later verifying each - mock can become repetitive and tedious. - - This repository class helps in that scenario by providing a - simplified creation of multiple mocks with a default - (unless overriden by calling - ) and posterior verification. - - - - The following is a straightforward example on how to - create and automatically verify strict mocks using a : - - var repository = new MockRepository(MockBehavior.Strict); - - var foo = repository.Create<IFoo>(); - var bar = repository.Create<IBar>(); - - // no need to call Verifiable() on the setup - // as we'll be validating all of them anyway. - foo.Setup(f => f.Do()); - bar.Setup(b => b.Redo()); - - // exercise the mocks here - - repository.VerifyAll(); - // At this point all setups are already checked - // and an optional MockException might be thrown. - // Note also that because the mocks are strict, any invocation - // that doesn't have a matching setup will also throw a MockException. - - The following examples shows how to setup the repository - to create loose mocks and later verify only verifiable setups: - - var repository = new MockRepository(MockBehavior.Loose); - - var foo = repository.Create<IFoo>(); - var bar = repository.Create<IBar>(); - - // this setup will be verified when we verify the repository - foo.Setup(f => f.Do()).Verifiable(); - - // this setup will NOT be verified - foo.Setup(f => f.Calculate()); - - // this setup will be verified when we verify the repository - bar.Setup(b => b.Redo()).Verifiable(); - - // exercise the mocks here - // note that because the mocks are Loose, members - // called in the interfaces for which no matching - // setups exist will NOT throw exceptions, - // and will rather return default values. - - repository.Verify(); - // At this point verifiable setups are already checked - // and an optional MockException might be thrown. - - The following examples shows how to setup the repository with a - default strict behavior, overriding that default for a - specific mock: - - var repository = new MockRepository(MockBehavior.Strict); - - // this particular one we want loose - var foo = repository.Create<IFoo>(MockBehavior.Loose); - var bar = repository.Create<IBar>(); - - // specify setups - - // exercise the mocks here - - repository.Verify(); - - - - - - - Utility factory class to use to construct multiple - mocks when consistent verification is - desired for all of them. - - - If multiple mocks will be created during a test, passing - the desired (if different than the - or the one - passed to the factory constructor) and later verifying each - mock can become repetitive and tedious. - - This factory class helps in that scenario by providing a - simplified creation of multiple mocks with a default - (unless overriden by calling - ) and posterior verification. - - - - The following is a straightforward example on how to - create and automatically verify strict mocks using a : - - var factory = new MockFactory(MockBehavior.Strict); - - var foo = factory.Create<IFoo>(); - var bar = factory.Create<IBar>(); - - // no need to call Verifiable() on the setup - // as we'll be validating all of them anyway. - foo.Setup(f => f.Do()); - bar.Setup(b => b.Redo()); - - // exercise the mocks here - - factory.VerifyAll(); - // At this point all setups are already checked - // and an optional MockException might be thrown. - // Note also that because the mocks are strict, any invocation - // that doesn't have a matching setup will also throw a MockException. - - The following examples shows how to setup the factory - to create loose mocks and later verify only verifiable setups: - - var factory = new MockFactory(MockBehavior.Loose); - - var foo = factory.Create<IFoo>(); - var bar = factory.Create<IBar>(); - - // this setup will be verified when we verify the factory - foo.Setup(f => f.Do()).Verifiable(); - - // this setup will NOT be verified - foo.Setup(f => f.Calculate()); - - // this setup will be verified when we verify the factory - bar.Setup(b => b.Redo()).Verifiable(); - - // exercise the mocks here - // note that because the mocks are Loose, members - // called in the interfaces for which no matching - // setups exist will NOT throw exceptions, - // and will rather return default values. - - factory.Verify(); - // At this point verifiable setups are already checked - // and an optional MockException might be thrown. - - The following examples shows how to setup the factory with a - default strict behavior, overriding that default for a - specific mock: - - var factory = new MockFactory(MockBehavior.Strict); - - // this particular one we want loose - var foo = factory.Create<IFoo>(MockBehavior.Loose); - var bar = factory.Create<IBar>(); - - // specify setups - - // exercise the mocks here - - factory.Verify(); - - - - - - - Initializes the factory with the given - for newly created mocks from the factory. - - The behavior to use for mocks created - using the factory method if not overriden - by using the overload. - - - - Creates a new mock with the default - specified at factory construction time. - - Type to mock. - A new . - - - var factory = new MockFactory(MockBehavior.Strict); - - var foo = factory.Create<IFoo>(); - // use mock on tests - - factory.VerifyAll(); - - - - - - Creates a new mock with the default - specified at factory construction time and with the - the given constructor arguments for the class. - - - The mock will try to find the best match constructor given the - constructor arguments, and invoke that to initialize the instance. - This applies only to classes, not interfaces. - - Type to mock. - Constructor arguments for mocked classes. - A new . - - - var factory = new MockFactory(MockBehavior.Default); - - var mock = factory.Create<MyBase>("Foo", 25, true); - // use mock on tests - - factory.Verify(); - - - - - - Creates a new mock with the given . - - Type to mock. - Behavior to use for the mock, which overrides - the default behavior specified at factory construction time. - A new . - - The following example shows how to create a mock with a different - behavior to that specified as the default for the factory: - - var factory = new MockFactory(MockBehavior.Strict); - - var foo = factory.Create<IFoo>(MockBehavior.Loose); - - - - - - Creates a new mock with the given - and with the the given constructor arguments for the class. - - - The mock will try to find the best match constructor given the - constructor arguments, and invoke that to initialize the instance. - This applies only to classes, not interfaces. - - Type to mock. - Behavior to use for the mock, which overrides - the default behavior specified at factory construction time. - Constructor arguments for mocked classes. - A new . - - The following example shows how to create a mock with a different - behavior to that specified as the default for the factory, passing - constructor arguments: - - var factory = new MockFactory(MockBehavior.Default); - - var mock = factory.Create<MyBase>(MockBehavior.Strict, "Foo", 25, true); - - - - - - Implements creation of a new mock within the factory. - - Type to mock. - The behavior for the new mock. - Optional arguments for the construction of the mock. - - - - Verifies all verifiable expectations on all mocks created - by this factory. - - - One or more mocks had expectations that were not satisfied. - - - - Verifies all verifiable expectations on all mocks created - by this factory. - - - One or more mocks had expectations that were not satisfied. - - - - Invokes for each mock - in , and accumulates the resulting - that might be - thrown from the action. - - The action to execute against - each mock. - - - - Whether the base member virtual implementation will be called - for mocked classes if no setup is matched. Defaults to . - - - - - Specifies the behavior to use when returning default values for - unexpected invocations on loose mocks. - - - - - Gets the mocks that have been created by this factory and - that will get verified together. - - - - - Access the universe of mocks of the given type, to retrieve those - that behave according to the LINQ query specification. - - The type of the mocked object to query. - - - - Access the universe of mocks of the given type, to retrieve those - that behave according to the LINQ query specification. - - The predicate with the setup expressions. - The type of the mocked object to query. - - - - Creates an mock object of the indicated type. - - The type of the mocked object. - The mocked object created. - - - - Creates an mock object of the indicated type. - - The predicate with the setup expressions. - The type of the mocked object. - The mocked object created. - - - - Creates the mock query with the underlying queriable implementation. - - - - - Wraps the enumerator inside a queryable. - - - - - Method that is turned into the actual call from .Query{T}, to - transform the queryable query into a normal enumerable query. - This method is never used directly by consumers. - - - - - Initializes the repository with the given - for newly created mocks from the repository. - - The behavior to use for mocks created - using the repository method if not overriden - by using the overload. - - - - A that returns an empty default value - for invocations that do not have setups or return values, with loose mocks. - This is the default behavior for a mock. - - - - - Interface to be implemented by classes that determine the - default value of non-expected invocations. - - - - - Defines the default value to return in all the methods returning . - The type of the return value.The value to set as default. - - - - Provides a value for the given member and arguments. - - The member to provide a default value for. - - - - - The intention of is to create a more readable - string representation for the failure message. - - - - - Implements the fluent API. - - - - - Defines the Throws verb. - - - - - Specifies the exception to throw when the method is invoked. - - Exception instance to throw. - - This example shows how to throw an exception when the method is - invoked with an empty string argument: - - mock.Setup(x => x.Execute("")) - .Throws(new ArgumentException()); - - - - - - Specifies the type of exception to throw when the method is invoked. - - Type of exception to instantiate and throw when the setup is matched. - - This example shows how to throw an exception when the method is - invoked with an empty string argument: - - mock.Setup(x => x.Execute("")) - .Throws<ArgumentException>(); - - - - - - Implements the fluent API. - - - - - Defines occurrence members to constraint setups. - - - - - The expected invocation can happen at most once. - - - - var mock = new Mock<ICommand>(); - mock.Setup(foo => foo.Execute("ping")) - .AtMostOnce(); - - - - - - The expected invocation can happen at most specified number of times. - - The number of times to accept calls. - - - var mock = new Mock<ICommand>(); - mock.Setup(foo => foo.Execute("ping")) - .AtMost( 5 ); - - - - - - Defines the Verifiable verb. - - - - - Marks the expectation as verifiable, meaning that a call - to will check if this particular - expectation was met. - - - The following example marks the expectation as verifiable: - - mock.Expect(x => x.Execute("ping")) - .Returns(true) - .Verifiable(); - - - - - - Marks the expectation as verifiable, meaning that a call - to will check if this particular - expectation was met, and specifies a message for failures. - - - The following example marks the expectation as verifiable: - - mock.Expect(x => x.Execute("ping")) - .Returns(true) - .Verifiable("Ping should be executed always!"); - - - - - - Implements the fluent API. - - - - - We need this non-generics base class so that - we can use from - generic code. - - - - - Implements the fluent API. - - - - - Implements the fluent API. - - - - - Implements the fluent API. - - - - - Defines the Callback verb for property getter setups. - - - Mocked type. - Type of the property. - - - - Specifies a callback to invoke when the property is retrieved. - - Callback method to invoke. - - Invokes the given callback with the property value being set. - - mock.SetupGet(x => x.Suspended) - .Callback(() => called = true) - .Returns(true); - - - - - - Implements the fluent API. - - - - - Defines the Returns verb for property get setups. - - Mocked type. - Type of the property. - - - - Specifies the value to return. - - The value to return, or . - - Return a true value from the property getter call: - - mock.SetupGet(x => x.Suspended) - .Returns(true); - - - - - - Specifies a function that will calculate the value to return for the property. - - The function that will calculate the return value. - - Return a calculated value when the property is retrieved: - - mock.SetupGet(x => x.Suspended) - .Returns(() => returnValues[0]); - - The lambda expression to retrieve the return value is lazy-executed, - meaning that its value may change depending on the moment the property - is retrieved and the value the returnValues array has at - that moment. - - - - - Implements the fluent API. - - - - - Helper class to setup a full trace between many mocks - - - - - Initialize a trace setup - - - - - Allow sequence to be repeated - - - - - define nice api - - - - - Perform an expectation in the trace. - - - - - Marks a method as a matcher, which allows complete replacement - of the built-in class with your own argument - matching rules. - - - This feature has been deprecated in favor of the new - and simpler . - - - The argument matching is used to determine whether a concrete - invocation in the mock matches a given setup. This - matching mechanism is fully extensible. - - - There are two parts of a matcher: the compiler matcher - and the runtime matcher. - - - Compiler matcher - Used to satisfy the compiler requirements for the - argument. Needs to be a method optionally receiving any arguments - you might need for the matching, but with a return type that - matches that of the argument. - - Let's say I want to match a lists of orders that contains - a particular one. I might create a compiler matcher like the following: - - - public static class Orders - { - [Matcher] - public static IEnumerable<Order> Contains(Order order) - { - return null; - } - } - - Now we can invoke this static method instead of an argument in an - invocation: - - var order = new Order { ... }; - var mock = new Mock<IRepository<Order>>(); - - mock.Setup(x => x.Save(Orders.Contains(order))) - .Throws<ArgumentException>(); - - Note that the return value from the compiler matcher is irrelevant. - This method will never be called, and is just used to satisfy the - compiler and to signal Moq that this is not a method that we want - to be invoked at runtime. - - - - Runtime matcher - - The runtime matcher is the one that will actually perform evaluation - when the test is run, and is defined by convention to have the - same signature as the compiler matcher, but where the return - value is the first argument to the call, which contains the - object received by the actual invocation at runtime: - - public static bool Contains(IEnumerable<Order> orders, Order order) - { - return orders.Contains(order); - } - - At runtime, the mocked method will be invoked with a specific - list of orders. This value will be passed to this runtime - matcher as the first argument, while the second argument is the - one specified in the setup (x.Save(Orders.Contains(order))). - - The boolean returned determines whether the given argument has been - matched. If all arguments to the expected method are matched, then - the setup matches and is evaluated. - - - - - - Using this extensible infrastructure, you can easily replace the entire - set of matchers with your own. You can also avoid the - typical (and annoying) lengthy expressions that result when you have - multiple arguments that use generics. - - - The following is the complete example explained above: - - public static class Orders - { - [Matcher] - public static IEnumerable<Order> Contains(Order order) - { - return null; - } - - public static bool Contains(IEnumerable<Order> orders, Order order) - { - return orders.Contains(order); - } - } - - And the concrete test using this matcher: - - var order = new Order { ... }; - var mock = new Mock<IRepository<Order>>(); - - mock.Setup(x => x.Save(Orders.Contains(order))) - .Throws<ArgumentException>(); - - // use mock, invoke Save, and have the matcher filter. - - - - - - Provides a mock implementation of . - - Any interface type can be used for mocking, but for classes, only abstract and virtual members can be mocked. - - The behavior of the mock with regards to the setups and the actual calls is determined - by the optional that can be passed to the - constructor. - - Type to mock, which can be an interface or a class. - The following example shows establishing setups with specific values - for method invocations: - - // Arrange - var order = new Order(TALISKER, 50); - var mock = new Mock<IWarehouse>(); - - mock.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true); - - // Act - order.Fill(mock.Object); - - // Assert - Assert.True(order.IsFilled); - - The following example shows how to use the class - to specify conditions for arguments instead of specific values: - - // Arrange - var order = new Order(TALISKER, 50); - var mock = new Mock<IWarehouse>(); - - // shows how to expect a value within a range - mock.Setup(x => x.HasInventory( - It.IsAny<string>(), - It.IsInRange(0, 100, Range.Inclusive))) - .Returns(false); - - // shows how to throw for unexpected calls. - mock.Setup(x => x.Remove( - It.IsAny<string>(), - It.IsAny<int>())) - .Throws(new InvalidOperationException()); - - // Act - order.Fill(mock.Object); - - // Assert - Assert.False(order.IsFilled); - - - - - - Obsolete. - - - - - Obsolete. - - - - - Obsolete. - - - - - Obsolete. - - - - - Obsolete. - - - - - Ctor invoked by AsTInterface exclusively. - - - - - Initializes an instance of the mock with default behavior. - - var mock = new Mock<IFormatProvider>(); - - - - - Initializes an instance of the mock with default behavior and with - the given constructor arguments for the class. (Only valid when is a class) - - The mock will try to find the best match constructor given the constructor arguments, and invoke that - to initialize the instance. This applies only for classes, not interfaces. - - var mock = new Mock<MyProvider>(someArgument, 25); - Optional constructor arguments if the mocked type is a class. - - - - Initializes an instance of the mock with the specified behavior. - - var mock = new Mock<IFormatProvider>(MockBehavior.Relaxed); - Behavior of the mock. - - - - Initializes an instance of the mock with a specific behavior with - the given constructor arguments for the class. - - The mock will try to find the best match constructor given the constructor arguments, and invoke that - to initialize the instance. This applies only to classes, not interfaces. - - var mock = new Mock<MyProvider>(someArgument, 25); - Behavior of the mock.Optional constructor arguments if the mocked type is a class. - - - - Returns the mocked object value. - - - - - Specifies a setup on the mocked type for a call to - to a void method. - - If more than one setup is specified for the same method or property, - the latest one wins and is the one that will be executed. - Lambda expression that specifies the expected method invocation. - - var mock = new Mock<IProcessor>(); - mock.Setup(x => x.Execute("ping")); - - - - - - Specifies a setup on the mocked type for a call to - to a value returning method. - Type of the return value. Typically omitted as it can be inferred from the expression. - If more than one setup is specified for the same method or property, - the latest one wins and is the one that will be executed. - Lambda expression that specifies the method invocation. - - mock.Setup(x => x.HasInventory("Talisker", 50)).Returns(true); - - - - - - Specifies a setup on the mocked type for a call to - to a property getter. - - If more than one setup is set for the same property getter, - the latest one wins and is the one that will be executed. - Type of the property. Typically omitted as it can be inferred from the expression.Lambda expression that specifies the property getter. - - mock.SetupGet(x => x.Suspended) - .Returns(true); - - - - - - Specifies a setup on the mocked type for a call to - to a property setter. - - If more than one setup is set for the same property setter, - the latest one wins and is the one that will be executed. - - This overloads allows the use of a callback already - typed for the property type. - - Type of the property. Typically omitted as it can be inferred from the expression.The Lambda expression that sets a property to a value. - - mock.SetupSet(x => x.Suspended = true); - - - - - - Specifies a setup on the mocked type for a call to - to a property setter. - - If more than one setup is set for the same property setter, - the latest one wins and is the one that will be executed. - Lambda expression that sets a property to a value. - - mock.SetupSet(x => x.Suspended = true); - - - - - - Specifies that the given property should have "property behavior", - meaning that setting its value will cause it to be saved and - later returned when the property is requested. (this is also - known as "stubbing"). - - Type of the property, inferred from the property - expression (does not need to be specified). - Property expression to stub. - If you have an interface with an int property Value, you might - stub it using the following straightforward call: - - var mock = new Mock<IHaveValue>(); - mock.Stub(v => v.Value); - - After the Stub call has been issued, setting and - retrieving the object value will behave as expected: - - IHaveValue v = mock.Object; - - v.Value = 5; - Assert.Equal(5, v.Value); - - - - - - Specifies that the given property should have "property behavior", - meaning that setting its value will cause it to be saved and - later returned when the property is requested. This overload - allows setting the initial value for the property. (this is also - known as "stubbing"). - - Type of the property, inferred from the property - expression (does not need to be specified). - Property expression to stub.Initial value for the property. - If you have an interface with an int property Value, you might - stub it using the following straightforward call: - - var mock = new Mock<IHaveValue>(); - mock.SetupProperty(v => v.Value, 5); - - After the SetupProperty call has been issued, setting and - retrieving the object value will behave as expected: - - IHaveValue v = mock.Object; - // Initial value was stored - Assert.Equal(5, v.Value); - - // New value set which changes the initial value - v.Value = 6; - Assert.Equal(6, v.Value); - - - - - - Specifies that the all properties on the mock should have "property behavior", - meaning that setting its value will cause it to be saved and - later returned when the property is requested. (this is also - known as "stubbing"). The default value for each property will be the - one generated as specified by the property for the mock. - - If the mock is set to , - the mocked default values will also get all properties setup recursively. - - - - - - - - Verifies that a specific invocation matching the given expression was performed on the mock. Use - in conjuntion with the default . - - This example assumes that the mock has been used, and later we want to verify that a given - invocation with specific parameters was performed: - - var mock = new Mock<IProcessor>(); - // exercise mock - //... - // Will throw if the test code didn't call Execute with a "ping" string argument. - mock.Verify(proc => proc.Execute("ping")); - - The invocation was not performed on the mock.Expression to verify. - - - - Verifies that a specific invocation matching the given expression was performed on the mock. Use - in conjuntion with the default . - - The invocation was not call the times specified by - . - Expression to verify.The number of times a method is allowed to be called. - - - - Verifies that a specific invocation matching the given expression was performed on the mock, - specifying a failure error message. Use in conjuntion with the default - . - - This example assumes that the mock has been used, and later we want to verify that a given - invocation with specific parameters was performed: - - var mock = new Mock<IProcessor>(); - // exercise mock - //... - // Will throw if the test code didn't call Execute with a "ping" string argument. - mock.Verify(proc => proc.Execute("ping")); - - The invocation was not performed on the mock.Expression to verify.Message to show if verification fails. - - - - Verifies that a specific invocation matching the given expression was performed on the mock, - specifying a failure error message. Use in conjuntion with the default - . - - The invocation was not call the times specified by - . - Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails. - - - - Verifies that a specific invocation matching the given expression was performed on the mock. Use - in conjuntion with the default . - - This example assumes that the mock has been used, and later we want to verify that a given - invocation with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't call HasInventory. - mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50)); - - The invocation was not performed on the mock.Expression to verify.Type of return value from the expression. - - - - Verifies that a specific invocation matching the given - expression was performed on the mock. Use in conjuntion - with the default . - - The invocation was not call the times specified by - . - Expression to verify.The number of times a method is allowed to be called.Type of return value from the expression. - - - - Verifies that a specific invocation matching the given - expression was performed on the mock, specifying a failure - error message. - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't call HasInventory. - mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50), "When filling orders, inventory has to be checked"); - - The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.Type of return value from the expression. - - - - Verifies that a specific invocation matching the given - expression was performed on the mock, specifying a failure - error message. - - The invocation was not call the times specified by - . - Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails.Type of return value from the expression. - - - - Verifies that a property was read on the mock. - - This example assumes that the mock has been used, - and later we want to verify that a given property - was retrieved from it: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't retrieve the IsClosed property. - mock.VerifyGet(warehouse => warehouse.IsClosed); - - The invocation was not performed on the mock.Expression to verify. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - - Verifies that a property was read on the mock. - - The invocation was not call the times specified by - . - The number of times a method is allowed to be called.Expression to verify. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - - Verifies that a property was read on the mock, specifying a failure - error message. - - This example assumes that the mock has been used, - and later we want to verify that a given property - was retrieved from it: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't retrieve the IsClosed property. - mock.VerifyGet(warehouse => warehouse.IsClosed); - - The invocation was not performed on the mock.Expression to verify.Message to show if verification fails. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - - Verifies that a property was read on the mock, specifying a failure - error message. - - The invocation was not call the times specified by - . - The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - - Verifies that a property was set on the mock. - - This example assumes that the mock has been used, - and later we want to verify that a given property - was set on it: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed = true); - - The invocation was not performed on the mock.Expression to verify. - - - - Verifies that a property was set on the mock. - - The invocation was not call the times specified by - . - The number of times a method is allowed to be called.Expression to verify. - - - - Verifies that a property was set on the mock, specifying - a failure message. - - This example assumes that the mock has been used, - and later we want to verify that a given property - was set on it: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed = true, "Warehouse should always be closed after the action"); - - The invocation was not performed on the mock.Expression to verify.Message to show if verification fails. - - - - Verifies that a property was set on the mock, specifying - a failure message. - - The invocation was not call the times specified by - . - The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails. - - - - Raises the event referenced in using - the given argument. - - The argument is - invalid for the target event invocation, or the is - not an event attach or detach expression. - - The following example shows how to raise a event: - - var mock = new Mock<IViewModel>(); - - mock.Raise(x => x.PropertyChanged -= null, new PropertyChangedEventArgs("Name")); - - - This example shows how to invoke an event with a custom event arguments - class in a view that will cause its corresponding presenter to - react by changing its state: - - var mockView = new Mock<IOrdersView>(); - var presenter = new OrdersPresenter(mockView.Object); - - // Check that the presenter has no selection by default - Assert.Null(presenter.SelectedOrder); - - // Raise the event with a specific arguments data - mockView.Raise(v => v.SelectionChanged += null, new OrderEventArgs { Order = new Order("moq", 500) }); - - // Now the presenter reacted to the event, and we have a selected order - Assert.NotNull(presenter.SelectedOrder); - Assert.Equal("moq", presenter.SelectedOrder.ProductName); - - - - - - Raises the event referenced in using - the given argument for a non-EventHandler typed event. - - The arguments are - invalid for the target event invocation, or the is - not an event attach or detach expression. - - The following example shows how to raise a custom event that does not adhere to - the standard EventHandler: - - var mock = new Mock<IViewModel>(); - - mock.Raise(x => x.MyEvent -= null, "Name", bool, 25); - - - - - - Exposes the mocked object instance. - - - - - Provides legacy API members as extensions so that - existing code continues to compile, but new code - doesn't see then. - - - - - Obsolete. - - - - - Obsolete. - - - - - Obsolete. - - - - - Provides additional methods on mocks. - - - Provided as extension methods as they confuse the compiler - with the overloads taking Action. - - - - - Specifies a setup on the mocked type for a call to - to a property setter, regardless of its value. - - - If more than one setup is set for the same property setter, - the latest one wins and is the one that will be executed. - - Type of the property. Typically omitted as it can be inferred from the expression. - Type of the mock. - The target mock for the setup. - Lambda expression that specifies the property setter. - - - mock.SetupSet(x => x.Suspended); - - - - This method is not legacy, but must be on an extension method to avoid - confusing the compiler with the new Action syntax. - - - - - Verifies that a property has been set on the mock, regarless of its value. - - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed); - - - The invocation was not performed on the mock. - Expression to verify. - The mock instance. - Mocked type. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Verifies that a property has been set on the mock, specifying a failure - error message. - - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed); - - - The invocation was not performed on the mock. - Expression to verify. - Message to show if verification fails. - The mock instance. - Mocked type. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Verifies that a property has been set on the mock, regardless - of the value but only the specified number of times. - - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed); - - - The invocation was not performed on the mock. - The invocation was not call the times specified by - . - The mock instance. - Mocked type. - The number of times a method is allowed to be called. - Expression to verify. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Verifies that a property has been set on the mock, regardless - of the value but only the specified number of times, and specifying a failure - error message. - - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed); - - - The invocation was not performed on the mock. - The invocation was not call the times specified by - . - The mock instance. - Mocked type. - The number of times a method is allowed to be called. - Message to show if verification fails. - Expression to verify. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Helper for sequencing return values in the same method. - - - - - Return a sequence of values, once per call. - - - - - Casts the expression to a lambda expression, removing - a cast if there's any. - - - - - Casts the body of the lambda expression to a . - - If the body is not a method call. - - - - Converts the body of the lambda expression into the referenced by it. - - - - - Checks whether the body of the lambda expression is a property access. - - - - - Checks whether the expression is a property access. - - - - - Checks whether the body of the lambda expression is a property indexer, which is true - when the expression is an whose - has - equal to . - - - - - Checks whether the expression is a property indexer, which is true - when the expression is an whose - has - equal to . - - - - - Creates an expression that casts the given expression to the - type. - - - - - TODO: remove this code when https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=331583 - is fixed. - - - - - Provides partial evaluation of subtrees, whenever they can be evaluated locally. - - Matt Warren: http://blogs.msdn.com/mattwar - Documented by InSTEDD: http://www.instedd.org - - - - Performs evaluation and replacement of independent sub-trees - - The root of the expression tree. - A function that decides whether a given expression - node can be part of the local function. - A new tree with sub-trees evaluated and replaced. - - - - Performs evaluation and replacement of independent sub-trees - - The root of the expression tree. - A new tree with sub-trees evaluated and replaced. - - - - Evaluates and replaces sub-trees when first candidate is reached (top-down) - - - - - Performs bottom-up analysis to determine which nodes can possibly - be part of an evaluated sub-tree. - - - - - Ensures the given is not null. - Throws otherwise. - - - - - Ensures the given string is not null or empty. - Throws in the first case, or - in the latter. - - - - - Checks an argument to ensure it is in the specified range including the edges. - - Type of the argument to check, it must be an type. - - The expression containing the name of the argument. - The argument value to check. - The minimun allowed value for the argument. - The maximun allowed value for the argument. - - - - Checks an argument to ensure it is in the specified range excluding the edges. - - Type of the argument to check, it must be an type. - - The expression containing the name of the argument. - The argument value to check. - The minimun allowed value for the argument. - The maximun allowed value for the argument. - - - - Implemented by all generated mock object instances. - - - - - Implemented by all generated mock object instances. - - - - - Reference the Mock that contains this as the mock.Object value. - - - - - Reference the Mock that contains this as the mock.Object value. - - - - - Implements the actual interception and method invocation for - all mocks. - - - - - Get an eventInfo for a given event name. Search type ancestors depth first if necessary. - - Name of the event, with the set_ or get_ prefix already removed - - - - Given a type return all of its ancestors, both types and interfaces. - - The type to find immediate ancestors of - - - - Implements the fluent API. - - - - - Defines the Callback verb for property setter setups. - - Type of the property. - - - - Specifies a callback to invoke when the property is set that receives the - property value being set. - - Callback method to invoke. - - Invokes the given callback with the property value being set. - - mock.SetupSet(x => x.Suspended) - .Callback((bool state) => Console.WriteLine(state)); - - - - - - Allows the specification of a matching condition for an - argument in a method invocation, rather than a specific - argument value. "It" refers to the argument being matched. - - This class allows the setup to match a method invocation - with an arbitrary value, with a value in a specified range, or - even one that matches a given predicate. - - - - - Matches any value of the given type. - - Typically used when the actual argument value for a method - call is not relevant. - - - // Throws an exception for a call to Remove with any string value. - mock.Setup(x => x.Remove(It.IsAny<string>())).Throws(new InvalidOperationException()); - - Type of the value. - - - - Matches any value that satisfies the given predicate. - Type of the argument to check.The predicate used to match the method argument. - Allows the specification of a predicate to perform matching - of method call arguments. - - This example shows how to return the value 1 whenever the argument to the - Do method is an even number. - - mock.Setup(x => x.Do(It.Is<int>(i => i % 2 == 0))) - .Returns(1); - - This example shows how to throw an exception if the argument to the - method is a negative number: - - mock.Setup(x => x.GetUser(It.Is<int>(i => i < 0))) - .Throws(new ArgumentException()); - - - - - - Matches any value that is in the range specified. - Type of the argument to check.The lower bound of the range.The upper bound of the range. - The kind of range. See . - - The following example shows how to expect a method call - with an integer argument within the 0..100 range. - - mock.Setup(x => x.HasInventory( - It.IsAny<string>(), - It.IsInRange(0, 100, Range.Inclusive))) - .Returns(false); - - - - - - Matches a string argument if it matches the given regular expression pattern. - The pattern to use to match the string argument value. - The following example shows how to expect a call to a method where the - string argument matches the given regular expression: - - mock.Setup(x => x.Check(It.IsRegex("[a-z]+"))).Returns(1); - - - - - - Matches a string argument if it matches the given regular expression pattern. - The pattern to use to match the string argument value.The options used to interpret the pattern. - The following example shows how to expect a call to a method where the - string argument matches the given regular expression, in a case insensitive way: - - mock.Setup(x => x.Check(It.IsRegex("[a-z]+", RegexOptions.IgnoreCase))).Returns(1); - - - - - - Matcher to treat static functions as matchers. - - mock.Setup(x => x.StringMethod(A.MagicString())); - - public static class A - { - [Matcher] - public static string MagicString() { return null; } - public static bool MagicString(string arg) - { - return arg == "magic"; - } - } - - Will succeed if: mock.Object.StringMethod("magic"); - and fail with any other call. - - - - - Options to customize the behavior of the mock. - - - - - Causes the mock to always throw - an exception for invocations that don't have a - corresponding setup. - - - - - Will never throw exceptions, returning default - values when necessary (null for reference types, - zero for value types or empty enumerables and arrays). - - - - - Default mock behavior, which equals . - - - - - Exception thrown by mocks when setups are not matched, - the mock is not properly setup, etc. - - - A distinct exception type is provided so that exceptions - thrown by the mock can be differentiated in tests that - expect other exceptions to be thrown (i.e. ArgumentException). - - Richer exception hierarchy/types are not provided as - tests typically should not catch or expect exceptions - from the mocks. These are typically the result of changes - in the tested class or its collaborators implementation, and - result in fixes in the mock setup so that they dissapear and - allow the test to pass. - - - - - - Supports the serialization infrastructure. - - Serialization information. - Streaming context. - - - - Supports the serialization infrastructure. - - Serialization information. - Streaming context. - - - - Made internal as it's of no use for - consumers, but it's important for - our own tests. - - - - - Used by the mock factory to accumulate verification - failures. - - - - - Supports the serialization infrastructure. - - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - - Returns the cached ResourceManager instance used by this class. - - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - - Looks up a localized string similar to Mock type has already been initialized by accessing its Object property. Adding interfaces must be done before that.. - - - - - Looks up a localized string similar to Value cannot be an empty string.. - - - - - Looks up a localized string similar to Can only add interfaces to the mock.. - - - - - Looks up a localized string similar to Can't set return value for void method {0}.. - - - - - Looks up a localized string similar to Constructor arguments cannot be passed for interface mocks.. - - - - - Looks up a localized string similar to A matching constructor for the given arguments was not found on the mocked type.. - - - - - Looks up a localized string similar to Could not locate event for attach or detach method {0}.. - - - - - Looks up a localized string similar to Expression {0} involves a field access, which is not supported. Use properties instead.. - - - - - Looks up a localized string similar to Type to mock must be an interface or an abstract or non-sealed class. . - - - - - Looks up a localized string similar to Cannot retrieve a mock with the given object type {0} as it's not the main type of the mock or any of its additional interfaces. - Please cast the argument to one of the supported types: {1}. - Remember that there's no generics covariance in the CLR, so your object must be one of these types in order for the call to succeed.. - - - - - Looks up a localized string similar to The equals ("==" or "=" in VB) and the conditional 'and' ("&&" or "AndAlso" in VB) operators are the only ones supported in the query specification expression. Unsupported expression: {0}. - - - - - Looks up a localized string similar to LINQ method '{0}' not supported.. - - - - - Looks up a localized string similar to Expression contains a call to a method which is not virtual (overridable in VB) or abstract. Unsupported expression: {0}. - - - - - Looks up a localized string similar to Member {0}.{1} does not exist.. - - - - - Looks up a localized string similar to Method {0}.{1} is public. Use strong-typed Expect overload instead: - mock.Setup(x => x.{1}()); - . - - - - - Looks up a localized string similar to {0} invocation failed with mock behavior {1}. - {2}. - - - - - Looks up a localized string similar to Expected only {0} calls to {1}.. - - - - - Looks up a localized string similar to Expected only one call to {0}.. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock at least {2} times, but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock at least once, but was never performed: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock at most {3} times, but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock at most once, but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock between {2} and {3} times (Exclusive), but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock between {2} and {3} times (Inclusive), but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock exactly {2} times, but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock should never have been performed, but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock once, but was {4} times: {1}. - - - - - Looks up a localized string similar to All invocations on the mock must have a corresponding setup.. - - - - - Looks up a localized string similar to Object instance was not created by Moq.. - - - - - Looks up a localized string similar to Out expression must evaluate to a constant value.. - - - - - Looks up a localized string similar to Property {0}.{1} does not have a getter.. - - - - - Looks up a localized string similar to Property {0}.{1} does not exist.. - - - - - Looks up a localized string similar to Property {0}.{1} is write-only.. - - - - - Looks up a localized string similar to Property {0}.{1} is read-only.. - - - - - Looks up a localized string similar to Property {0}.{1} does not have a setter.. - - - - - Looks up a localized string similar to Cannot raise a mocked event unless it has been associated (attached) to a concrete event in a mocked object.. - - - - - Looks up a localized string similar to Ref expression must evaluate to a constant value.. - - - - - Looks up a localized string similar to Invocation needs to return a value and therefore must have a corresponding setup that provides it.. - - - - - Looks up a localized string similar to A lambda expression is expected as the argument to It.Is<T>.. - - - - - Looks up a localized string similar to Invocation {0} should not have been made.. - - - - - Looks up a localized string similar to Expression is not a method invocation: {0}. - - - - - Looks up a localized string similar to Expression is not a property access: {0}. - - - - - Looks up a localized string similar to Expression is not a property setter invocation.. - - - - - Looks up a localized string similar to Expression references a method that does not belong to the mocked object: {0}. - - - - - Looks up a localized string similar to Invalid setup on a non-virtual (overridable in VB) member: {0}. - - - - - Looks up a localized string similar to Type {0} does not implement required interface {1}. - - - - - Looks up a localized string similar to Type {0} does not from required type {1}. - - - - - Looks up a localized string similar to To specify a setup for public property {0}.{1}, use the typed overloads, such as: - mock.Setup(x => x.{1}).Returns(value); - mock.SetupGet(x => x.{1}).Returns(value); //equivalent to previous one - mock.SetupSet(x => x.{1}).Callback(callbackDelegate); - . - - - - - Looks up a localized string similar to Unsupported expression: {0}. - - - - - Looks up a localized string similar to Only property accesses are supported in intermediate invocations on a setup. Unsupported expression {0}.. - - - - - Looks up a localized string similar to Expression contains intermediate property access {0}.{1} which is of type {2} and cannot be mocked. Unsupported expression {3}.. - - - - - Looks up a localized string similar to Setter expression cannot use argument matchers that receive parameters.. - - - - - Looks up a localized string similar to Member {0} is not supported for protected mocking.. - - - - - Looks up a localized string similar to Setter expression can only use static custom matchers.. - - - - - Looks up a localized string similar to The following setups were not matched: - {0}. - - - - - Looks up a localized string similar to Invalid verify on a non-virtual (overridable in VB) member: {0}. - - - - - Allows setups to be specified for protected members by using their - name as a string, rather than strong-typing them which is not possible - due to their visibility. - - - - - Specifies a setup for a void method invocation with the given - , optionally specifying arguments for the method call. - - The name of the void method to be invoked. - The optional arguments for the invocation. If argument matchers are used, - remember to use rather than . - - - - Specifies a setup for an invocation on a property or a non void method with the given - , optionally specifying arguments for the method call. - - The name of the method or property to be invoked. - The optional arguments for the invocation. If argument matchers are used, - remember to use rather than . - The return type of the method or property. - - - - Specifies a setup for an invocation on a property getter with the given - . - - The name of the property. - The type of the property. - - - - Specifies a setup for an invocation on a property setter with the given - . - - The name of the property. - The property value. If argument matchers are used, - remember to use rather than . - The type of the property. - - - - Specifies a verify for a void method with the given , - optionally specifying arguments for the method call. Use in conjuntion with the default - . - - The invocation was not call the times specified by - . - The name of the void method to be verified. - The number of times a method is allowed to be called. - The optional arguments for the invocation. If argument matchers are used, - remember to use rather than . - - - - Specifies a verify for an invocation on a property or a non void method with the given - , optionally specifying arguments for the method call. - - The invocation was not call the times specified by - . - The name of the method or property to be invoked. - The optional arguments for the invocation. If argument matchers are used, - remember to use rather than . - The number of times a method is allowed to be called. - The type of return value from the expression. - - - - Specifies a verify for an invocation on a property getter with the given - . - The invocation was not call the times specified by - . - - The name of the property. - The number of times a method is allowed to be called. - The type of the property. - - - - Specifies a setup for an invocation on a property setter with the given - . - - The invocation was not call the times specified by - . - The name of the property. - The number of times a method is allowed to be called. - The property value. - The type of the property. If argument matchers are used, - remember to use rather than . - - - - Allows the specification of a matching condition for an - argument in a protected member setup, rather than a specific - argument value. "ItExpr" refers to the argument being matched. - - - Use this variant of argument matching instead of - for protected setups. - This class allows the setup to match a method invocation - with an arbitrary value, with a value in a specified range, or - even one that matches a given predicate, or null. - - - - - Matches a null value of the given type. - - - Required for protected mocks as the null value cannot be used - directly as it prevents proper method overload selection. - - - - // Throws an exception for a call to Remove with a null string value. - mock.Protected() - .Setup("Remove", ItExpr.IsNull<string>()) - .Throws(new InvalidOperationException()); - - - Type of the value. - - - - Matches any value of the given type. - - - Typically used when the actual argument value for a method - call is not relevant. - - - - // Throws an exception for a call to Remove with any string value. - mock.Protected() - .Setup("Remove", ItExpr.IsAny<string>()) - .Throws(new InvalidOperationException()); - - - Type of the value. - - - - Matches any value that satisfies the given predicate. - - Type of the argument to check. - The predicate used to match the method argument. - - Allows the specification of a predicate to perform matching - of method call arguments. - - - This example shows how to return the value 1 whenever the argument to the - Do method is an even number. - - mock.Protected() - .Setup("Do", ItExpr.Is<int>(i => i % 2 == 0)) - .Returns(1); - - This example shows how to throw an exception if the argument to the - method is a negative number: - - mock.Protected() - .Setup("GetUser", ItExpr.Is<int>(i => i < 0)) - .Throws(new ArgumentException()); - - - - - - Matches any value that is in the range specified. - - Type of the argument to check. - The lower bound of the range. - The upper bound of the range. - The kind of range. See . - - The following example shows how to expect a method call - with an integer argument within the 0..100 range. - - mock.Protected() - .Setup("HasInventory", - ItExpr.IsAny<string>(), - ItExpr.IsInRange(0, 100, Range.Inclusive)) - .Returns(false); - - - - - - Matches a string argument if it matches the given regular expression pattern. - - The pattern to use to match the string argument value. - - The following example shows how to expect a call to a method where the - string argument matches the given regular expression: - - mock.Protected() - .Setup("Check", ItExpr.IsRegex("[a-z]+")) - .Returns(1); - - - - - - Matches a string argument if it matches the given regular expression pattern. - - The pattern to use to match the string argument value. - The options used to interpret the pattern. - - The following example shows how to expect a call to a method where the - string argument matches the given regular expression, in a case insensitive way: - - mock.Protected() - .Setup("Check", ItExpr.IsRegex("[a-z]+", RegexOptions.IgnoreCase)) - .Returns(1); - - - - - - Enables the Protected() method on , - allowing setups to be set for protected members by using their - name as a string, rather than strong-typing them which is not possible - due to their visibility. - - - - - Enable protected setups for the mock. - - Mocked object type. Typically omitted as it can be inferred from the mock instance. - The mock to set the protected setups on. - - - - - - - - - - - - Kind of range to use in a filter specified through - . - - - - - The range includes the to and - from values. - - - - - The range does not include the to and - from values. - - - - - Determines the way default values are generated - calculated for loose mocks. - - - - - Default behavior, which generates empty values for - value types (i.e. default(int)), empty array and - enumerables, and nulls for all other reference types. - - - - - Whenever the default value generated by - is null, replaces this value with a mock (if the type - can be mocked). - - - For sealed classes, a null value will be generated. - - - - - A default implementation of IQueryable for use with QueryProvider - - - - - The is a - static method that returns an IQueryable of Mocks of T which is used to - apply the linq specification to. - - - - - Allows creation custom value matchers that can be used on setups and verification, - completely replacing the built-in class with your own argument - matching rules. - - See also . - - - - - Provided for the sole purpose of rendering the delegate passed to the - matcher constructor if no friendly render lambda is provided. - - - - - Initializes the match with the condition that - will be checked in order to match invocation - values. - The condition to match against actual values. - - - - - - - - - This method is used to set an expression as the last matcher invoked, - which is used in the SetupSet to allow matchers in the prop = value - delegate expression. This delegate is executed in "fluent" mode in - order to capture the value being set, and construct the corresponding - methodcall. - This is also used in the MatcherFactory for each argument expression. - This method ensures that when we execute the delegate, we - also track the matcher that was invoked, so that when we create the - methodcall we build the expression using it, rather than the null/default - value returned from the actual invocation. - - - - - Allows creation custom value matchers that can be used on setups and verification, - completely replacing the built-in class with your own argument - matching rules. - Type of the value to match. - The argument matching is used to determine whether a concrete - invocation in the mock matches a given setup. This - matching mechanism is fully extensible. - - Creating a custom matcher is straightforward. You just need to create a method - that returns a value from a call to with - your matching condition and optional friendly render expression: - - [Matcher] - public Order IsBigOrder() - { - return Match<Order>.Create( - o => o.GrandTotal >= 5000, - /* a friendly expression to render on failures */ - () => IsBigOrder()); - } - - This method can be used in any mock setup invocation: - - mock.Setup(m => m.Submit(IsBigOrder()).Throws<UnauthorizedAccessException>(); - - At runtime, Moq knows that the return value was a matcher (note that the method MUST be - annotated with the [Matcher] attribute in order to determine this) and - evaluates your predicate with the actual value passed into your predicate. - - Another example might be a case where you want to match a lists of orders - that contains a particular one. You might create matcher like the following: - - - public static class Orders - { - [Matcher] - public static IEnumerable<Order> Contains(Order order) - { - return Match<IEnumerable<Order>>.Create(orders => orders.Contains(order)); - } - } - - Now we can invoke this static method instead of an argument in an - invocation: - - var order = new Order { ... }; - var mock = new Mock<IRepository<Order>>(); - - mock.Setup(x => x.Save(Orders.Contains(order))) - .Throws<ArgumentException>(); - - - - - - Tracks the current mock and interception context. - - - - - Having an active fluent mock context means that the invocation - is being performed in "trial" mode, just to gather the - target method and arguments that need to be matched later - when the actual invocation is made. - - - - - A that returns an empty default value - for non-mockeable types, and mocks for all other types (interfaces and - non-sealed classes) that can be mocked. - - - - - Allows querying the universe of mocks for those that behave - according to the LINQ query specification. - - - This entry-point into Linq to Mocks is the only one in the root Moq - namespace to ease discovery. But to get all the mocking extension - methods on Object, a using of Moq.Linq must be done, so that the - polluting of the intellisense for all objects is an explicit opt-in. - - - - - Access the universe of mocks of the given type, to retrieve those - that behave according to the LINQ query specification. - - The type of the mocked object to query. - - - - Access the universe of mocks of the given type, to retrieve those - that behave according to the LINQ query specification. - - The predicate with the setup expressions. - The type of the mocked object to query. - - - - Creates an mock object of the indicated type. - - The type of the mocked object. - The mocked object created. - - - - Creates an mock object of the indicated type. - - The predicate with the setup expressions. - The type of the mocked object. - The mocked object created. - - - - Creates the mock query with the underlying queriable implementation. - - - - - Wraps the enumerator inside a queryable. - - - - - Method that is turned into the actual call from .Query{T}, to - transform the queryable query into a normal enumerable query. - This method is never used directly by consumers. - - - - - Extension method used to support Linq-like setup properties that are not virtual but do have - a getter and a setter, thereby allowing the use of Linq to Mocks to quickly initialize Dtos too :) - - - - - Helper extensions that are used by the query translator. - - - - - Retrieves a fluent mock from the given setup expression. - - - - - Defines the number of invocations allowed by a mocked method. - - - - - Specifies that a mocked method should be invoked times as minimum. - The minimun number of times.An object defining the allowed number of invocations. - - - - Specifies that a mocked method should be invoked one time as minimum. - An object defining the allowed number of invocations. - - - - Specifies that a mocked method should be invoked time as maximun. - The maximun number of times.An object defining the allowed number of invocations. - - - - Specifies that a mocked method should be invoked one time as maximun. - An object defining the allowed number of invocations. - - - - Specifies that a mocked method should be invoked between and - times. - The minimun number of times.The maximun number of times. - The kind of range. See . - An object defining the allowed number of invocations. - - - - Specifies that a mocked method should be invoked exactly times. - The times that a method or property can be called.An object defining the allowed number of invocations. - - - - Specifies that a mocked method should not be invoked. - An object defining the allowed number of invocations. - - - - Specifies that a mocked method should be invoked exactly one time. - An object defining the allowed number of invocations. - - - - Determines whether the specified is equal to this instance. - - The to compare with this instance. - - true if the specified is equal to this instance; otherwise, false. - - - - - Returns a hash code for this instance. - - A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. - - - - - Determines whether two specified objects have the same value. - - The first . - - The second . - - true if the value of left is the same as the value of right; otherwise, false. - - - - - Determines whether two specified objects have different values. - - The first . - - The second . - - true if the value of left is different from the value of right; otherwise, false. - - - - diff --git a/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.Test.dll b/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.Test.dll deleted file mode 100644 index ff627a1..0000000 Binary files a/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.Test.dll and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.Test.dll.VisualState.xml b/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.Test.dll.VisualState.xml deleted file mode 100644 index af0e7ab..0000000 --- a/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.Test.dll.VisualState.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - [0-1066]C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\Mvc.Mailer.Test.dll - [0-1056]Mvc.Mailer.Test.MailerBaseTest.PopuateBody_should_populate_with_alternate_view_when_html_present_with_linked_resources - false - - - - - - - - - - \ No newline at end of file diff --git a/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.Test.pdb b/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.Test.pdb deleted file mode 100644 index 9ab76c4..0000000 Binary files a/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.Test.pdb and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.dll b/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.dll deleted file mode 100644 index 4b85bfb..0000000 Binary files a/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.dll and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.pdb b/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.pdb deleted file mode 100644 index 3f364c0..0000000 Binary files a/Mvc.Mailer.Test/bin/Debug/Mvc.Mailer.pdb and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Debug/TestResult.xml b/Mvc.Mailer.Test/bin/Debug/TestResult.xml deleted file mode 100644 index 50a3a94..0000000 --- a/Mvc.Mailer.Test/bin/Debug/TestResult.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Mvc.Mailer.Test/bin/Debug/content/web.config.transform b/Mvc.Mailer.Test/bin/Debug/content/web.config.transform deleted file mode 100644 index ad7aab0..0000000 --- a/Mvc.Mailer.Test/bin/Debug/content/web.config.transform +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/Mvc.Mailer.Test/bin/Debug/nunit.framework.dll b/Mvc.Mailer.Test/bin/Debug/nunit.framework.dll deleted file mode 100644 index 875e098..0000000 Binary files a/Mvc.Mailer.Test/bin/Debug/nunit.framework.dll and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Debug/nunit.framework.xml b/Mvc.Mailer.Test/bin/Debug/nunit.framework.xml deleted file mode 100644 index 1cccec3..0000000 --- a/Mvc.Mailer.Test/bin/Debug/nunit.framework.xml +++ /dev/null @@ -1,10385 +0,0 @@ - - - - nunit.framework - - - - - Attribute used to apply a category to a test - - - - - The name of the category - - - - - Construct attribute for a given category based on - a name. The name may not contain the characters ',', - '+', '-' or '!'. However, this is not checked in the - constructor since it would cause an error to arise at - as the test was loaded without giving a clear indication - of where the problem is located. The error is handled - in NUnitFramework.cs by marking the test as not - runnable. - - The name of the category - - - - Protected constructor uses the Type name as the name - of the category. - - - - - The name of the category - - - - - Used to mark a field for use as a datapoint when executing a theory - within the same fixture that requires an argument of the field's Type. - - - - - Used to mark an array as containing a set of datapoints to be used - executing a theory within the same fixture that requires an argument - of the Type of the array elements. - - - - - Attribute used to provide descriptive text about a - test case or fixture. - - - - - Construct the attribute - - Text describing the test - - - - Gets the test description - - - - - Enumeration indicating how the expected message parameter is to be used - - - - Expect an exact match - - - Expect a message containing the parameter string - - - Match the regular expression provided as a parameter - - - Expect a message that starts with the parameter string - - - - ExpectedExceptionAttribute - - - - - - Constructor for a non-specific exception - - - - - Constructor for a given type of exception - - The type of the expected exception - - - - Constructor for a given exception name - - The full name of the expected exception - - - - Gets or sets the expected exception type - - - - - Gets or sets the full Type name of the expected exception - - - - - Gets or sets the expected message text - - - - - Gets or sets the user message displayed in case of failure - - - - - Gets or sets the type of match to be performed on the expected message - - - - - Gets the name of a method to be used as an exception handler - - - - - ExplicitAttribute marks a test or test fixture so that it will - only be run if explicitly executed from the gui or command line - or if it is included by use of a filter. The test will not be - run simply because an enclosing suite is run. - - - - - Default constructor - - - - - Constructor with a reason - - The reason test is marked explicit - - - - The reason test is marked explicit - - - - - Attribute used to mark a test that is to be ignored. - Ignored tests result in a warning message when the - tests are run. - - - - - Constructs the attribute without giving a reason - for ignoring the test. - - - - - Constructs the attribute giving a reason for ignoring the test - - The reason for ignoring the test - - - - The reason for ignoring a test - - - - - Abstract base for Attributes that are used to include tests - in the test run based on environmental settings. - - - - - Constructor with no included items specified, for use - with named property syntax. - - - - - Constructor taking one or more included items - - Comma-delimited list of included items - - - - Name of the item that is needed in order for - a test to run. Multiple itemss may be given, - separated by a comma. - - - - - Name of the item to be excluded. Multiple items - may be given, separated by a comma. - - - - - The reason for including or excluding the test - - - - - PlatformAttribute is used to mark a test fixture or an - individual method as applying to a particular platform only. - - - - - Constructor with no platforms specified, for use - with named property syntax. - - - - - Constructor taking one or more platforms - - Comma-deliminted list of platforms - - - - CultureAttribute is used to mark a test fixture or an - individual method as applying to a particular Culture only. - - - - - Constructor with no cultures specified, for use - with named property syntax. - - - - - Constructor taking one or more cultures - - Comma-deliminted list of cultures - - - - Marks a test to use a combinatorial join of any argument data - provided. NUnit will create a test case for every combination of - the arguments provided. This can result in a large number of test - cases and so should be used judiciously. This is the default join - type, so the attribute need not be used except as documentation. - - - - - PropertyAttribute is used to attach information to a test as a name/value pair.. - - - - - Construct a PropertyAttribute with a name and string value - - The name of the property - The property value - - - - Construct a PropertyAttribute with a name and int value - - The name of the property - The property value - - - - Construct a PropertyAttribute with a name and double value - - The name of the property - The property value - - - - Constructor for derived classes that set the - property dictionary directly. - - - - - Constructor for use by derived classes that use the - name of the type as the property name. Derived classes - must ensure that the Type of the property value is - a standard type supported by the BCL. Any custom - types will cause a serialization Exception when - in the client. - - - - - Gets the property dictionary for this attribute - - - - - Default constructor - - - - - Marks a test to use pairwise join of any argument data provided. - NUnit will attempt too excercise every pair of argument values at - least once, using as small a number of test cases as it can. With - only two arguments, this is the same as a combinatorial join. - - - - - Default constructor - - - - - Marks a test to use a sequential join of any argument data - provided. NUnit will use arguements for each parameter in - sequence, generating test cases up to the largest number - of argument values provided and using null for any arguments - for which it runs out of values. Normally, this should be - used with the same number of arguments for each parameter. - - - - - Default constructor - - - - - Summary description for MaxTimeAttribute. - - - - - Construct a MaxTimeAttribute, given a time in milliseconds. - - The maximum elapsed time in milliseconds - - - - RandomAttribute is used to supply a set of random values - to a single parameter of a parameterized test. - - - - - ValuesAttribute is used to provide literal arguments for - an individual parameter of a test. - - - - - Abstract base class for attributes that apply to parameters - and supply data for the parameter. - - - - - Gets the data to be provided to the specified parameter - - - - - The collection of data to be returned. Must - be set by any derived attribute classes. - We use an object[] so that the individual - elements may have their type changed in GetData - if necessary. - - - - - Construct with one argument - - - - - - Construct with two arguments - - - - - - - Construct with three arguments - - - - - - - - Construct with an array of arguments - - - - - - Get the collection of values to be used as arguments - - - - - Construct a set of doubles from 0.0 to 1.0, - specifying only the count. - - - - - - Construct a set of doubles from min to max - - - - - - - - Construct a set of ints from min to max - - - - - - - - Get the collection of values to be used as arguments - - - - - RangeAttribute is used to supply a range of values to an - individual parameter of a parameterized test. - - - - - Construct a range of ints using default step of 1 - - - - - - - Construct a range of ints specifying the step size - - - - - - - - Construct a range of longs - - - - - - - - Construct a range of doubles - - - - - - - - Construct a range of floats - - - - - - - - RepeatAttribute may be applied to test case in order - to run it multiple times. - - - - - Construct a RepeatAttribute - - The number of times to run the test - - - - RequiredAddinAttribute may be used to indicate the names of any addins - that must be present in order to run some or all of the tests in an - assembly. If the addin is not loaded, the entire assembly is marked - as NotRunnable. - - - - - Initializes a new instance of the class. - - The required addin. - - - - Gets the name of required addin. - - The required addin name. - - - - Summary description for SetCultureAttribute. - - - - - Construct given the name of a culture - - - - - - Summary description for SetUICultureAttribute. - - - - - Construct given the name of a culture - - - - - - Attribute used to mark a class that contains one-time SetUp - and/or TearDown methods that apply to all the tests in a - namespace or an assembly. - - - - - SetUpFixtureAttribute is used to identify a SetUpFixture - - - - - Attribute used to mark a static (shared in VB) property - that returns a list of tests. - - - - - Attribute used to identify a method that is called - immediately after each test is run. The method is - guaranteed to be called, even if an exception is thrown. - - - - - Adding this attribute to a method within a - class makes the method callable from the NUnit test runner. There is a property - called Description which is optional which you can provide a more detailed test - description. This class cannot be inherited. - - - - [TestFixture] - public class Fixture - { - [Test] - public void MethodToTest() - {} - - [Test(Description = "more detailed description")] - publc void TestDescriptionMethod() - {} - } - - - - - - Descriptive text for this test - - - - - TestCaseAttribute is used to mark parameterized test cases - and provide them with their arguments. - - - - - The ITestCaseData interface is implemented by a class - that is able to return complete testcases for use by - a parameterized test method. - - NOTE: This interface is used in both the framework - and the core, even though that results in two different - types. However, sharing the source code guarantees that - the various implementations will be compatible and that - the core is able to reflect successfully over the - framework implementations of ITestCaseData. - - - - - Gets the argument list to be provided to the test - - - - - Gets the expected result - - - - - Gets the expected exception Type - - - - - Gets the FullName of the expected exception - - - - - Gets the name to be used for the test - - - - - Gets the description of the test - - - - - Gets a value indicating whether this is ignored. - - true if ignored; otherwise, false. - - - - Gets the ignore reason. - - The ignore reason. - - - - Construct a TestCaseAttribute with a list of arguments. - This constructor is not CLS-Compliant - - - - - - Construct a TestCaseAttribute with a single argument - - - - - - Construct a TestCaseAttribute with a two arguments - - - - - - - Construct a TestCaseAttribute with a three arguments - - - - - - - - Gets the list of arguments to a test case - - - - - Gets or sets the expected result. - - The result. - - - - Gets or sets the expected exception. - - The expected exception. - - - - Gets or sets the name the expected exception. - - The expected name of the exception. - - - - Gets or sets the expected message of the expected exception - - The expected message of the exception. - - - - Gets or sets the type of match to be performed on the expected message - - - - - Gets or sets the description. - - The description. - - - - Gets or sets the name of the test. - - The name of the test. - - - - Gets or sets the ignored status of the test - - - - - Gets or sets the ignored status of the test - - - - - Gets the ignore reason. - - The ignore reason. - - - - FactoryAttribute indicates the source to be used to - provide test cases for a test method. - - - - - Construct with the name of the factory - for use with languages - that don't support params arrays. - - An array of the names of the factories that will provide data - - - - Construct with a Type and name - for use with languages - that don't support params arrays. - - The Type that will provide data - The name of the method, property or field that will provide data - - - - The name of a the method, property or fiend to be used as a source - - - - - A Type to be used as a source - - - - - [TestFixture] - public class ExampleClass - {} - - - - - Default constructor - - - - - Construct with a object[] representing a set of arguments. - In .NET 2.0, the arguments may later be separated into - type arguments and constructor arguments. - - - - - - Descriptive text for this fixture - - - - - The arguments originally provided to the attribute - - - - - Gets or sets a value indicating whether this should be ignored. - - true if ignore; otherwise, false. - - - - Gets or sets the ignore reason. May set Ignored as a side effect. - - The ignore reason. - - - - Get or set the type arguments. If not set - explicitly, any leading arguments that are - Types are taken as type arguments. - - - - - Attribute used to identify a method that is - called before any tests in a fixture are run. - - - - - Attribute used to identify a method that is called after - all the tests in a fixture have run. The method is - guaranteed to be called, even if an exception is thrown. - - - - - Adding this attribute to a method within a - class makes the method callable from the NUnit test runner. There is a property - called Description which is optional which you can provide a more detailed test - description. This class cannot be inherited. - - - - [TestFixture] - public class Fixture - { - [Test] - public void MethodToTest() - {} - - [Test(Description = "more detailed description")] - publc void TestDescriptionMethod() - {} - } - - - - - - WUsed on a method, marks the test with a timeout value in milliseconds. - The test will be run in a separate thread and is cancelled if the timeout - is exceeded. Used on a method or assembly, sets the default timeout - for all contained test methods. - - - - - Construct a TimeoutAttribute given a time in milliseconds - - The timeout value in milliseconds - - - - Marks a test that must run in the STA, causing it - to run in a separate thread if necessary. - - On methods, you may also use STAThreadAttribute - to serve the same purpose. - - - - - Construct a RequiresSTAAttribute - - - - - Marks a test that must run in the MTA, causing it - to run in a separate thread if necessary. - - On methods, you may also use MTAThreadAttribute - to serve the same purpose. - - - - - Construct a RequiresMTAAttribute - - - - - Marks a test that must run on a separate thread. - - - - - Construct a RequiresThreadAttribute - - - - - Construct a RequiresThreadAttribute, specifying the apartment - - - - - ValueSourceAttribute indicates the source to be used to - provide data for one parameter of a test method. - - - - - Construct with the name of the factory - for use with languages - that don't support params arrays. - - The name of the data source to be used - - - - Construct with a Type and name - for use with languages - that don't support params arrays. - - The Type that will provide data - The name of the method, property or field that will provide data - - - - The name of a the method, property or fiend to be used as a source - - - - - A Type to be used as a source - - - - - AttributeExistsConstraint tests for the presence of a - specified attribute on a Type. - - - - - The Constraint class is the base of all built-in constraints - within NUnit. It provides the operator overloads used to combine - constraints. - - - - - The IConstraintExpression interface is implemented by all - complete and resolvable constraints and expressions. - - - - - Return the top-level constraint for this expression - - - - - - Static UnsetObject used to detect derived constraints - failing to set the actual value. - - - - - The actual value being tested against a constraint - - - - - The display name of this Constraint for use by ToString() - - - - - Argument fields used by ToString(); - - - - - The builder holding this constraint - - - - - Construct a constraint with no arguments - - - - - Construct a constraint with one argument - - - - - Construct a constraint with two arguments - - - - - Sets the ConstraintBuilder holding this constraint - - - - - Write the failure message to the MessageWriter provided - as an argument. The default implementation simply passes - the constraint and the actual value to the writer, which - then displays the constraint description and the value. - - Constraints that need to provide additional details, - such as where the error occured can override this. - - The MessageWriter on which to display the message - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Test whether the constraint is satisfied by an - ActualValueDelegate that returns the value to be tested. - The default implementation simply evaluates the delegate - but derived classes may override it to provide for delayed - processing. - - An ActualValueDelegate - True for success, false for failure - - - - Test whether the constraint is satisfied by a given reference. - The default implementation simply dereferences the value but - derived classes may override it to provide for delayed processing. - - A reference to the value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Default override of ToString returns the constraint DisplayName - followed by any arguments within angle brackets. - - - - - - Returns the string representation of this constraint - - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - This operator creates a constraint that is satisfied if either - of the argument constraints is satisfied. - - - - - This operator creates a constraint that is satisfied if the - argument constraint is not satisfied. - - - - - Returns a DelayedConstraint with the specified delay time. - - The delay in milliseconds. - - - - - Returns a DelayedConstraint with the specified delay time - and polling interval. - - The delay in milliseconds. - The interval at which to test the constraint. - - - - - The display name of this Constraint for use by ToString(). - The default value is the name of the constraint with - trailing "Constraint" removed. Derived classes may set - this to another name in their constructors. - - - - - Returns a ConstraintExpression by appending And - to the current constraint. - - - - - Returns a ConstraintExpression by appending And - to the current constraint. - - - - - Returns a ConstraintExpression by appending Or - to the current constraint. - - - - - Class used to detect any derived constraints - that fail to set the actual value in their - Matches override. - - - - - Constructs an AttributeExistsConstraint for a specific attribute Type - - - - - - Tests whether the object provides the expected attribute. - - A Type, MethodInfo, or other ICustomAttributeProvider - True if the expected attribute is present, otherwise false - - - - Writes the description of the constraint to the specified writer - - - - - AttributeConstraint tests that a specified attribute is present - on a Type or other provider and that the value of the attribute - satisfies some other constraint. - - - - - Abstract base class used for prefixes - - - - - The base constraint - - - - - Construct given a base constraint - - - - - - Constructs an AttributeConstraint for a specified attriute - Type and base constraint. - - - - - - - Determines whether the Type or other provider has the - expected attribute and if its value matches the - additional constraint specified. - - - - - Writes a description of the attribute to the specified writer. - - - - - Writes the actual value supplied to the specified writer. - - - - - Returns a string representation of the constraint. - - - - - BasicConstraint is the abstract base for constraints that - perform a simple comparison to a constant value. - - - - - Initializes a new instance of the class. - - The expected. - The description. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - NullConstraint tests that the actual value is null - - - - - Initializes a new instance of the class. - - - - - TrueConstraint tests that the actual value is true - - - - - Initializes a new instance of the class. - - - - - FalseConstraint tests that the actual value is false - - - - - Initializes a new instance of the class. - - - - - NaNConstraint tests that the actual value is a double or float NaN - - - - - Test that the actual value is an NaN - - - - - - - Write the constraint description to a specified writer - - - - - - BinaryConstraint is the abstract base of all constraints - that combine two other constraints in some fashion. - - - - - The first constraint being combined - - - - - The second constraint being combined - - - - - Construct a BinaryConstraint from two other constraints - - The first constraint - The second constraint - - - - AndConstraint succeeds only if both members succeed. - - - - - Create an AndConstraint from two other constraints - - The first constraint - The second constraint - - - - Apply both member constraints to an actual value, succeeding - succeeding only if both of them succeed. - - The actual value - True if the constraints both succeeded - - - - Write a description for this contraint to a MessageWriter - - The MessageWriter to receive the description - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - OrConstraint succeeds if either member succeeds - - - - - Create an OrConstraint from two other constraints - - The first constraint - The second constraint - - - - Apply the member constraints to an actual value, succeeding - succeeding as soon as one of them succeeds. - - The actual value - True if either constraint succeeded - - - - Write a description for this contraint to a MessageWriter - - The MessageWriter to receive the description - - - - CollectionConstraint is the abstract base class for - constraints that operate on collections. - - - - - Construct an empty CollectionConstraint - - - - - Construct a CollectionConstraint - - - - - - Determines whether the specified enumerable is empty. - - The enumerable. - - true if the specified enumerable is empty; otherwise, false. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Protected method to be implemented by derived classes - - - - - - - CollectionItemsEqualConstraint is the abstract base class for all - collection constraints that apply some notion of item equality - as a part of their operation. - - - - - Construct an empty CollectionConstraint - - - - - Construct a CollectionConstraint - - - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied Comparison object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Compares two collection members for equality - - - - - Return a new CollectionTally for use in making tests - - The collection to be included in the tally - - - - Flag the constraint to ignore case and return self. - - - - - EmptyCollectionConstraint tests whether a collection is empty. - - - - - Check that the collection is empty - - - - - - - Write the constraint description to a MessageWriter - - - - - - UniqueItemsConstraint tests whether all the items in a - collection are unique. - - - - - Check that all items are unique. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionContainsConstraint is used to test whether a collection - contains an expected object as a member. - - - - - Construct a CollectionContainsConstraint - - - - - - Test whether the expected item is contained in the collection - - - - - - - Write a descripton of the constraint to a MessageWriter - - - - - - CollectionEquivalentCOnstraint is used to determine whether two - collections are equivalent. - - - - - Construct a CollectionEquivalentConstraint - - - - - - Test whether two collections are equivalent - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionSubsetConstraint is used to determine whether - one collection is a subset of another - - - - - Construct a CollectionSubsetConstraint - - The collection that the actual value is expected to be a subset of - - - - Test whether the actual collection is a subset of - the expected collection provided. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionOrderedConstraint is used to test whether a collection is ordered. - - - - - Construct a CollectionOrderedConstraint - - - - - Modifies the constraint to use an IComparer and returns self. - - - - - Modifies the constraint to use an IComparer<T> and returns self. - - - - - Modifies the constraint to use a Comparison<T> and returns self. - - - - - Modifies the constraint to test ordering by the value of - a specified property and returns self. - - - - - Test whether the collection is ordered - - - - - - - Write a description of the constraint to a MessageWriter - - - - - - Returns the string representation of the constraint. - - - - - - If used performs a reverse comparison - - - - - CollectionTally counts (tallies) the number of - occurences of each object in one or more enumerations. - - - - - Construct a CollectionTally object from a comparer and a collection - - - - - Try to remove an object from the tally - - The object to remove - True if successful, false if the object was not found - - - - Try to remove a set of objects from the tally - - The objects to remove - True if successful, false if any object was not found - - - - The number of objects remaining in the tally - - - - - ComparisonAdapter class centralizes all comparisons of - values in NUnit, adapting to the use of any provided - IComparer, IComparer<T> or Comparison<T> - - - - - Returns a ComparisonAdapter that wraps an IComparer - - - - - Returns a ComparisonAdapter that wraps an IComparer<T> - - - - - Returns a ComparisonAdapter that wraps a Comparison<T> - - - - - Compares two objects - - - - - Gets the default ComparisonAdapter, which wraps an - NUnitComparer object. - - - - - Construct a ComparisonAdapter for an IComparer - - - - - Compares two objects - - - - - - - - Construct a default ComparisonAdapter - - - - - ComparisonAdapter<T> extends ComparisonAdapter and - allows use of an IComparer<T> or Comparison<T> - to actually perform the comparison. - - - - - Construct a ComparisonAdapter for an IComparer<T> - - - - - Compare a Type T to an object - - - - - Construct a ComparisonAdapter for a Comparison<T> - - - - - Compare a Type T to an object - - - - - Abstract base class for constraints that compare values to - determine if one is greater than, equal to or less than - the other. - - - - - The value against which a comparison is to be made - - - - - If true, less than returns success - - - - - if true, equal returns success - - - - - if true, greater than returns success - - - - - The predicate used as a part of the description - - - - - ComparisonAdapter to be used in making the comparison - - - - - Initializes a new instance of the class. - - The value against which to make a comparison. - if set to true less succeeds. - if set to true equal succeeds. - if set to true greater succeeds. - String used in describing the constraint. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Modifies the constraint to use an IComparer and returns self - - - - - Modifies the constraint to use an IComparer<T> and returns self - - - - - Modifies the constraint to use a Comparison<T> and returns self - - - - - Tests whether a value is greater than the value supplied to its constructor - - - - - Initializes a new instance of the class. - - The expected value. - - - - Tests whether a value is greater than or equal to the value supplied to its constructor - - - - - Initializes a new instance of the class. - - The expected value. - - - - Tests whether a value is less than the value supplied to its constructor - - - - - Initializes a new instance of the class. - - The expected value. - - - - Tests whether a value is less than or equal to the value supplied to its constructor - - - - - Initializes a new instance of the class. - - The expected value. - - - - Delegate used to delay evaluation of the actual value - to be used in evaluating a constraint - - - - - ConstraintBuilder maintains the stacks that are used in - processing a ConstraintExpression. An OperatorStack - is used to hold operators that are waiting for their - operands to be reognized. a ConstraintStack holds - input constraints as well as the results of each - operator applied. - - - - - Initializes a new instance of the class. - - - - - Appends the specified operator to the expression by first - reducing the operator stack and then pushing the new - operator on the stack. - - The operator to push. - - - - Appends the specified constraint to the expresson by pushing - it on the constraint stack. - - The constraint to push. - - - - Sets the top operator right context. - - The right context. - - - - Reduces the operator stack until the topmost item - precedence is greater than or equal to the target precedence. - - The target precedence. - - - - Resolves this instance, returning a Constraint. If the builder - is not currently in a resolvable state, an exception is thrown. - - The resolved constraint - - - - Gets a value indicating whether this instance is resolvable. - - - true if this instance is resolvable; otherwise, false. - - - - - OperatorStack is a type-safe stack for holding ConstraintOperators - - - - - Initializes a new instance of the class. - - The builder. - - - - Pushes the specified operator onto the stack. - - The op. - - - - Pops the topmost operator from the stack. - - - - - - Gets a value indicating whether this is empty. - - true if empty; otherwise, false. - - - - Gets the topmost operator without modifying the stack. - - The top. - - - - ConstraintStack is a type-safe stack for holding Constraints - - - - - Initializes a new instance of the class. - - The builder. - - - - Pushes the specified constraint. As a side effect, - the constraint's builder field is set to the - ConstraintBuilder owning this stack. - - The constraint. - - - - Pops this topmost constrait from the stack. - As a side effect, the constraint's builder - field is set to null. - - - - - - Gets a value indicating whether this is empty. - - true if empty; otherwise, false. - - - - Gets the topmost constraint without modifying the stack. - - The topmost constraint - - - - ConstraintExpression represents a compound constraint in the - process of being constructed from a series of syntactic elements. - - Individual elements are appended to the expression as they are - reognized. Once an actual Constraint is appended, the expression - returns a resolvable Constraint. - - - - - ConstraintExpressionBase is the abstract base class for the - generated ConstraintExpression class, which represents a - compound constraint in the process of being constructed - from a series of syntactic elements. - - NOTE: ConstraintExpressionBase is aware of some of its - derived classes, which is an apparent violation of - encapsulation. Ideally, these classes would be a - single class, but they must be separated in order to - allow parts to be generated under .NET 1.x and to - provide proper user feedback in syntactically - aware IDEs. - - - - - The ConstraintBuilder holding the elements recognized so far - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the - class passing in a ConstraintBuilder, which may be pre-populated. - - The builder. - - - - Returns a string representation of the expression as it - currently stands. This should only be used for testing, - since it has the side-effect of resolving the expression. - - - - - - Appends an operator to the expression and returns the - resulting expression itself. - - - - - Appends a self-resolving operator to the expression and - returns a new ResolvableConstraintExpression. - - - - - Appends a constraint to the expression and returns that - constraint, which is associated with the current state - of the expression being built. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the - class passing in a ConstraintBuilder, which may be pre-populated. - - The builder. - - - - Returns a new PropertyConstraintExpression, which will either - test for the existence of the named property on the object - being tested or apply any following constraint to that property. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns the constraint provided as an argument - used to allow custom - custom constraints to easily participate in the syntax. - - - - - Returns the constraint provided as an argument - used to allow custom - custom constraints to easily participate in the syntax. - - - - - Returns a constraint that tests two items for equality - - - - - Returns a constraint that tests that two references are the same object - - - - - Returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a collection containing the same elements as the - collection supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a subset of the collection supplied as an argument. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new ContainsConstraint. This constraint - will, in turn, make use of the appropriate second-level - constraint, depending on the type of the actual argument. - This overload is only used if the item sought is a string, - since any other type implies that we are looking for a - collection member. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that tests whether the path provided - is the same as an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the actual value falls - within a specified range. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if at least one of them succeeds. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them fail. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Length property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Count property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Message property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the InnerException property of the object being tested. - - - - - With is currently a NOP - reserved for future use. - - - - - Returns a constraint that tests for null - - - - - Returns a constraint that tests for True - - - - - Returns a constraint that tests for False - - - - - Returns a constraint that tests for NaN - - - - - Returns a constraint that tests for empty - - - - - Returns a constraint that tests whether a collection - contains all unique items. - - - - - Returns a constraint that tests whether an object graph is serializable in binary format. - - - - - Returns a constraint that tests whether an object graph is serializable in xml format. - - - - - Returns a constraint that tests whether a collection is ordered - - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - Returns a new PropertyConstraintExpression, which will either - test for the existence of the named property on the object - being tested or apply any following constraint to that property. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a constraint that tests two items for equality - - - - - Returns a constraint that tests that two references are the same object - - - - - Returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a collection containing the same elements as the - collection supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a subset of the collection supplied as an argument. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new ContainsConstraint. This constraint - will, in turn, make use of the appropriate second-level - constraint, depending on the type of the actual argument. - This overload is only used if the item sought is a string, - since any other type implies that we are looking for a - collection member. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that fails if the actual - value matches the pattern supplied as an argument. - - - - - Returns a constraint that tests whether the path provided - is the same as an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the actual value falls - within a specified range. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if at least one of them succeeds. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them fail. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Length property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Count property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Message property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the InnerException property of the object being tested. - - - - - Returns a constraint that tests for null - - - - - Returns a constraint that tests for True - - - - - Returns a constraint that tests for False - - - - - Returns a constraint that tests for NaN - - - - - Returns a constraint that tests for empty - - - - - Returns a constraint that tests whether a collection - contains all unique items. - - - - - Returns a constraint that tests whether an object graph is serializable in binary format. - - - - - Returns a constraint that tests whether an object graph is serializable in xml format. - - - - - Returns a constraint that tests whether a collection is ordered - - - - - The ConstraintOperator class is used internally by a - ConstraintBuilder to represent an operator that - modifies or combines constraints. - - Constraint operators use left and right precedence - values to determine whether the top operator on the - stack should be reduced before pushing a new operator. - - - - - The precedence value used when the operator - is about to be pushed to the stack. - - - - - The precedence value used when the operator - is on the top of the stack. - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - The syntax element preceding this operator - - - - - The syntax element folowing this operator - - - - - The precedence value used when the operator - is about to be pushed to the stack. - - - - - The precedence value used when the operator - is on the top of the stack. - - - - - PrefixOperator takes a single constraint and modifies - it's action in some way. - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - Returns the constraint created by applying this - prefix to another constraint. - - - - - - - Negates the test of the constraint it wraps. - - - - - Constructs a new NotOperator - - - - - Returns a NotConstraint applied to its argument. - - - - - Abstract base for operators that indicate how to - apply a constraint to items in a collection. - - - - - Constructs a CollectionOperator - - - - - Represents a constraint that succeeds if all the - members of a collection match a base constraint. - - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - they all succeed. - - - - - Represents a constraint that succeeds if any of the - members of a collection match a base constraint. - - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - any of them succeed. - - - - - Represents a constraint that succeeds if none of the - members of a collection match a base constraint. - - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - none of them succeed. - - - - - Represents a constraint that simply wraps the - constraint provided as an argument, without any - further functionality, but which modifes the - order of evaluation because of its precedence. - - - - - Constructor for the WithOperator - - - - - Returns a constraint that wraps its argument - - - - - Abstract base class for operators that are able to reduce to a - constraint whether or not another syntactic element follows. - - - - - Operator used to test for the presence of a named Property - on an object and optionally apply further tests to the - value of that property. - - - - - Constructs a PropOperator for a particular named property - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - Gets the name of the property to which the operator applies - - - - - Operator that tests for the presence of a particular attribute - on a type and optionally applies further tests to the attribute. - - - - - Construct an AttributeOperator for a particular Type - - The Type of attribute tested - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - Operator that tests that an exception is thrown and - optionally applies further tests to the exception. - - - - - Construct a ThrowsOperator - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - Abstract base class for all binary operators - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - Abstract method that produces a constraint by applying - the operator to its left and right constraint arguments. - - - - - Gets the left precedence of the operator - - - - - Gets the right precedence of the operator - - - - - Operator that requires both it's arguments to succeed - - - - - Construct an AndOperator - - - - - Apply the operator to produce an AndConstraint - - - - - Operator that requires at least one of it's arguments to succeed - - - - - Construct an OrOperator - - - - - Apply the operator to produce an OrConstraint - - - - - ContainsConstraint tests a whether a string contains a substring - or a collection contains an object. It postpones the decision of - which test to use until the type of the actual argument is known. - This allows testing whether a string is contained in a collection - or as a substring of another string using the same syntax. - - - - - Initializes a new instance of the class. - - The expected. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied Comparison object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to ignore case and return self. - - - - - Applies a delay to the match so that a match can be evaluated in the future. - - - - - Creates a new DelayedConstraint - - The inner constraint two decorate - The time interval after which the match is performed - If the value of is less than 0 - - - - Creates a new DelayedConstraint - - The inner constraint two decorate - The time interval after which the match is performed - The time interval used for polling - If the value of is less than 0 - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for if the base constraint fails, false if it succeeds - - - - Test whether the constraint is satisfied by a delegate - - The delegate whose value is to be tested - True for if the base constraint fails, false if it succeeds - - - - Test whether the constraint is satisfied by a given reference. - Overridden to wait for the specified delay period before - calling the base constraint with the dereferenced value. - - A reference to the value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a MessageWriter. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - EmptyDirectoryConstraint is used to test that a directory is empty - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - EmptyConstraint tests a whether a string or collection is empty, - postponing the decision about which test is applied until the - type of the actual argument is known. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - EqualConstraint is able to compare an actual value with the - expected value provided in its constructor. Two objects are - considered equal if both are null, or if both have the same - value. NUnit has special semantics for some object types. - - - - - If true, strings in error messages will be clipped - - - - - NUnitEqualityComparer used to test equality. - - - - - Initializes a new instance of the class. - - The expected value. - - - - Flag the constraint to use a tolerance when determining equality. - - Tolerance value to be used - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied Comparison object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write a failure message. Overridden to provide custom - failure messages for EqualConstraint. - - The MessageWriter to write to - - - - Write description of this constraint - - The MessageWriter to write to - - - - Display the failure information for two collections that did not match. - - The MessageWriter on which to display - The expected collection. - The actual collection - The depth of this failure in a set of nested collections - - - - Displays a single line showing the types and sizes of the expected - and actual collections or arrays. If both are identical, the value is - only shown once. - - The MessageWriter on which to display - The expected collection or array - The actual collection or array - The indentation level for the message line - - - - Displays a single line showing the point in the expected and actual - arrays at which the comparison failed. If the arrays have different - structures or dimensions, both values are shown. - - The MessageWriter on which to display - The expected array - The actual array - Index of the failure point in the underlying collections - The indentation level for the message line - - - - Flag the constraint to ignore case and return self. - - - - - Flag the constraint to suppress string clipping - and return self. - - - - - Flag the constraint to compare arrays as collections - and return self. - - - - - Switches the .Within() modifier to interpret its tolerance as - a distance in representable values (see remarks). - - Self. - - Ulp stands for "unit in the last place" and describes the minimum - amount a given value can change. For any integers, an ulp is 1 whole - digit. For floating point values, the accuracy of which is better - for smaller numbers and worse for larger numbers, an ulp depends - on the size of the number. Using ulps for comparison of floating - point results instead of fixed tolerances is safer because it will - automatically compensate for the added inaccuracy of larger numbers. - - - - - Switches the .Within() modifier to interpret its tolerance as - a percentage that the actual values is allowed to deviate from - the expected value. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in days. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in hours. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in minutes. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in seconds. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in milliseconds. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in clock ticks. - - Self - - - - EqualityAdapter class handles all equality comparisons - that use an IEqualityComparer, IEqualityComparer<T> - or a ComparisonAdapter. - - - - - Compares two objects, returning true if they are equal - - - - - Returns an EqualityAdapter that wraps an IComparer. - - - - - Returns an EqualityAdapter that wraps an IEqualityComparer. - - - - - Returns an EqualityAdapter that wraps an IEqualityComparer<T>. - - - - - Returns an EqualityAdapter that wraps an IComparer<T>. - - - - - Returns an EqualityAdapter that wraps a Comparison<T>. - - - - Helper routines for working with floating point numbers - - - The floating point comparison code is based on this excellent article: - http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm - - - "ULP" means Unit in the Last Place and in the context of this library refers to - the distance between two adjacent floating point numbers. IEEE floating point - numbers can only represent a finite subset of natural numbers, with greater - accuracy for smaller numbers and lower accuracy for very large numbers. - - - If a comparison is allowed "2 ulps" of deviation, that means the values are - allowed to deviate by up to 2 adjacent floating point values, which might be - as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. - - - - - Compares two floating point values for equality - First floating point value to be compared - Second floating point value t be compared - - Maximum number of representable floating point values that are allowed to - be between the left and the right floating point values - - True if both numbers are equal or close to being equal - - - Floating point values can only represent a finite subset of natural numbers. - For example, the values 2.00000000 and 2.00000024 can be stored in a float, - but nothing inbetween them. - - - This comparison will count how many possible floating point values are between - the left and the right number. If the number of possible values between both - numbers is less than or equal to maxUlps, then the numbers are considered as - being equal. - - - Implementation partially follows the code outlined here: - http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ - - - - - Compares two double precision floating point values for equality - First double precision floating point value to be compared - Second double precision floating point value t be compared - - Maximum number of representable double precision floating point values that are - allowed to be between the left and the right double precision floating point values - - True if both numbers are equal or close to being equal - - - Double precision floating point values can only represent a limited series of - natural numbers. For example, the values 2.0000000000000000 and 2.0000000000000004 - can be stored in a double, but nothing inbetween them. - - - This comparison will count how many possible double precision floating point - values are between the left and the right number. If the number of possible - values between both numbers is less than or equal to maxUlps, then the numbers - are considered as being equal. - - - Implementation partially follows the code outlined here: - http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ - - - - - - Reinterprets the memory contents of a floating point value as an integer value - - - Floating point value whose memory contents to reinterpret - - - The memory contents of the floating point value interpreted as an integer - - - - - Reinterprets the memory contents of a double precision floating point - value as an integer value - - - Double precision floating point value whose memory contents to reinterpret - - - The memory contents of the double precision floating point value - interpreted as an integer - - - - - Reinterprets the memory contents of an integer as a floating point value - - Integer value whose memory contents to reinterpret - - The memory contents of the integer value interpreted as a floating point value - - - - - Reinterprets the memory contents of an integer value as a double precision - floating point value - - Integer whose memory contents to reinterpret - - The memory contents of the integer interpreted as a double precision - floating point value - - - - Union of a floating point variable and an integer - - - The union's value as a floating point variable - - - The union's value as an integer - - - The union's value as an unsigned integer - - - Union of a double precision floating point variable and a long - - - The union's value as a double precision floating point variable - - - The union's value as a long - - - The union's value as an unsigned long - - - - MessageWriter is the abstract base for classes that write - constraint descriptions and messages in some form. The - class has separate methods for writing various components - of a message, allowing implementations to tailor the - presentation as needed. - - - - - Construct a MessageWriter given a culture - - - - - Method to write single line message with optional args, usually - written to precede the general failure message. - - The message to be written - Any arguments used in formatting the message - - - - Method to write single line message with optional args, usually - written to precede the general failure message, at a givel - indentation level. - - The indentation level of the message - The message to be written - Any arguments used in formatting the message - - - - Display Expected and Actual lines for a constraint. This - is called by MessageWriter's default implementation of - WriteMessageTo and provides the generic two-line display. - - The constraint that failed - - - - Display Expected and Actual lines for given values. This - method may be called by constraints that need more control over - the display of actual and expected values than is provided - by the default implementation. - - The expected value - The actual value causing the failure - - - - Display Expected and Actual lines for given values, including - a tolerance value on the Expected line. - - The expected value - The actual value causing the failure - The tolerance within which the test was made - - - - Display the expected and actual string values on separate lines. - If the mismatch parameter is >=0, an additional line is displayed - line containing a caret that points to the mismatch point. - - The expected string value - The actual string value - The point at which the strings don't match or -1 - If true, case is ignored in locating the point where the strings differ - If true, the strings should be clipped to fit the line - - - - Writes the text for a connector. - - The connector. - - - - Writes the text for a predicate. - - The predicate. - - - - Writes the text for an expected value. - - The expected value. - - - - Writes the text for a modifier - - The modifier. - - - - Writes the text for an actual value. - - The actual value. - - - - Writes the text for a generalized value. - - The value. - - - - Writes the text for a collection value, - starting at a particular point, to a max length - - The collection containing elements to write. - The starting point of the elements to write - The maximum number of elements to write - - - - Abstract method to get the max line length - - - - - Static methods used in creating messages - - - - - Static string used when strings are clipped - - - - - Returns the representation of a type as used in NUnitLite. - This is the same as Type.ToString() except for arrays, - which are displayed with their declared sizes. - - - - - - - Converts any control characters in a string - to their escaped representation. - - The string to be converted - The converted string - - - - Return the a string representation for a set of indices into an array - - Array of indices for which a string is needed - - - - Get an array of indices representing the point in a collection or - array corresponding to a single int index into the collection. - - The collection to which the indices apply - Index in the collection - Array of indices - - - - Clip a string to a given length, starting at a particular offset, returning the clipped - string with ellipses representing the removed parts - - The string to be clipped - The maximum permitted length of the result string - The point at which to start clipping - The clipped string - - - - Clip the expected and actual strings in a coordinated fashion, - so that they may be displayed together. - - - - - - - - - Shows the position two strings start to differ. Comparison - starts at the start index. - - The expected string - The actual string - The index in the strings at which comparison should start - Boolean indicating whether case should be ignored - -1 if no mismatch found, or the index where mismatch found - - - - The Numerics class contains common operations on numeric values. - - - - - Checks the type of the object, returning true if - the object is a numeric type. - - The object to check - true if the object is a numeric type - - - - Checks the type of the object, returning true if - the object is a floating point numeric type. - - The object to check - true if the object is a floating point numeric type - - - - Checks the type of the object, returning true if - the object is a fixed point numeric type. - - The object to check - true if the object is a fixed point numeric type - - - - Test two numeric values for equality, performing the usual numeric - conversions and using a provided or default tolerance. If the tolerance - provided is Empty, this method may set it to a default tolerance. - - The expected value - The actual value - A reference to the tolerance in effect - True if the values are equal - - - - Compare two numeric values, performing the usual numeric conversions. - - The expected value - The actual value - The relationship of the values to each other - - - - NUnitComparer encapsulates NUnit's default behavior - in comparing two objects. - - - - - Compares two objects - - - - - - - - Returns the default NUnitComparer. - - - - - NUnitEqualityComparer encapsulates NUnit's handling of - equality tests between objects. - - - - - If true, all string comparisons will ignore case - - - - - If true, arrays will be treated as collections, allowing - those of different dimensions to be compared - - - - - If non-zero, equality comparisons within the specified - tolerance will succeed. - - - - - Comparison object used in comparisons for some constraints. - - - - - Compares two objects for equality. - - - - - Helper method to compare two arrays - - - - - Method to compare two DirectoryInfo objects - - first directory to compare - second directory to compare - true if equivalent, false if not - - - - Returns the default NUnitEqualityComparer - - - - - Gets and sets a flag indicating whether case should - be ignored in determining equality. - - - - - Gets and sets a flag indicating that arrays should be - compared as collections, without regard to their shape. - - - - - Gets and sets an external comparer to be used to - test for equality. It is applied to members of - collections, in place of NUnit's own logic. - - - - - Gets and sets a tolerance used to compare objects of - certin types. - - - - - Gets the list of failure points for the last Match performed. - - - - - PathConstraint serves as the abstract base of constraints - that operate on paths and provides several helper methods. - - - - - The expected path used in the constraint - - - - - The actual path being tested - - - - - Flag indicating whether a caseInsensitive comparison should be made - - - - - Construct a PathConstraint for a give expected path - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Returns true if the expected path and actual path match - - - - - Returns the string representation of this constraint - - - - - Canonicalize the provided path - - - The path in standardized form - - - - Test whether two paths are the same - - The first path - The second path - Indicates whether case should be ignored - - - - - Test whether one path is under another path - - The first path - supposed to be the parent path - The second path - supposed to be the child path - Indicates whether case should be ignored - - - - - Test whether one path is the same as or under another path - - The first path - supposed to be the parent path - The second path - supposed to be the child path - - - - - Modifies the current instance to be case-insensitve - and returns it. - - - - - Modifies the current instance to be case-sensitve - and returns it. - - - - - Summary description for SamePathConstraint. - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SubPathConstraint tests that the actual path is under the expected path - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SamePathOrUnderConstraint tests that one path is under another - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Predicate constraint wraps a Predicate in a constraint, - returning success if the predicate is true. - - - - - Construct a PredicateConstraint from a predicate - - - - - Determines whether the predicate succeeds when applied - to the actual value. - - - - - Writes the description to a MessageWriter - - - - - NotConstraint negates the effect of some other constraint - - - - - Initializes a new instance of the class. - - The base constraint to be negated. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for if the base constraint fails, false if it succeeds - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a MessageWriter. - - The writer on which the actual value is displayed - - - - AllItemsConstraint applies another constraint to each - item in a collection, succeeding if they all succeed. - - - - - Construct an AllItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - SomeItemsConstraint applies another constraint to each - item in a collection, succeeding if any of them succeeds. - - - - - Construct a SomeItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - succeeding if any item succeeds. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - NoItemConstraint applies another constraint to each - item in a collection, failing if any of them succeeds. - - - - - Construct a SomeItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - PropertyExistsConstraint tests that a named property - exists on the object provided through Match. - - Originally, PropertyConstraint provided this feature - in addition to making optional tests on the vaue - of the property. The two constraints are now separate. - - - - - Initializes a new instance of the class. - - The name of the property. - - - - Test whether the property exists for a given object - - The object to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - - PropertyConstraint extracts a named property and uses - its value as the actual value for a chained constraint. - - - - - Initializes a new instance of the class. - - The name. - The constraint to apply to the property. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - - RangeConstraint tests whethe two values are within a - specified range. - - - - - Initializes a new instance of the class. - - From. - To. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Modifies the constraint to use an IComparer and returns self. - - - - - Modifies the constraint to use an IComparer<T> and returns self. - - - - - Modifies the constraint to use a Comparison<T> and returns self. - - - - - ResolvableConstraintExpression is used to represent a compound - constraint being constructed at a point where the last operator - may either terminate the expression or may have additional - qualifying constraints added to it. - - It is used, for example, for a Property element or for - an Exception element, either of which may be optionally - followed by constraints that apply to the property or - exception. - - - - - Create a new instance of ResolvableConstraintExpression - - - - - Create a new instance of ResolvableConstraintExpression, - passing in a pre-populated ConstraintBuilder. - - - - - Resolve the current expression to a Constraint - - - - - Appends an And Operator to the expression - - - - - Appends an Or operator to the expression. - - - - - ReusableConstraint wraps a resolved constraint so that it - may be saved and reused as needed. - - - - - Construct a ReusableConstraint - - The constraint or expression to be reused - - - - Conversion operator from a normal constraint to a ReusableConstraint. - - The original constraint to be wrapped as a ReusableConstraint - - - - - Returns the string representation of the constraint. - - A string representing the constraint - - - - Resolves the ReusableConstraint by returning the constraint - that it originally wrapped. - - A resolved constraint - - - - SameAsConstraint tests whether an object is identical to - the object passed to its constructor - - - - - Initializes a new instance of the class. - - The expected object. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - BinarySerializableConstraint tests whether - an object is serializable in binary format. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation - - - - - BinarySerializableConstraint tests whether - an object is serializable in binary format. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation of this constraint - - - - - StringConstraint is the abstract base for constraints - that operate on strings. It supports the IgnoreCase - modifier for string operations. - - - - - The expected value - - - - - Indicates whether tests should be case-insensitive - - - - - Constructs a StringConstraint given an expected value - - The expected value - - - - Modify the constraint to ignore case in matching. - - - - - EmptyStringConstraint tests whether a string is empty. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - NullEmptyStringConstraint tests whether a string is either null or empty. - - - - - Constructs a new NullOrEmptyStringConstraint - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SubstringConstraint can test whether a string contains - the expected substring. - - - - - Initializes a new instance of the class. - - The expected. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - StartsWithConstraint can test whether a string starts - with an expected substring. - - - - - Initializes a new instance of the class. - - The expected string - - - - Test whether the constraint is matched by the actual value. - This is a template method, which calls the IsMatch method - of the derived class. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - EndsWithConstraint can test whether a string ends - with an expected substring. - - - - - Initializes a new instance of the class. - - The expected string - - - - Test whether the constraint is matched by the actual value. - This is a template method, which calls the IsMatch method - of the derived class. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - RegexConstraint can test whether a string matches - the pattern provided. - - - - - Initializes a new instance of the class. - - The pattern. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - ThrowsConstraint is used to test the exception thrown by - a delegate by applying a constraint to it. - - - - - Initializes a new instance of the class, - using a constraint to be applied to the exception. - - A constraint to apply to the caught exception. - - - - Executes the code of the delegate and captures any exception. - If a non-null base constraint was provided, it applies that - constraint to the exception. - - A delegate representing the code to be tested - True if an exception is thrown and the constraint succeeds, otherwise false - - - - Converts an ActualValueDelegate to a TestDelegate - before calling the primary overload. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation of this constraint - - - - - Get the actual exception thrown - used by Assert.Throws. - - - - - ThrowsNothingConstraint tests that a delegate does not - throw an exception. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True if no exception is thrown, otherwise false - - - - Converts an ActualValueDelegate to a TestDelegate - before calling the primary overload. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Modes in which the tolerance value for a comparison can - be interpreted. - - - - - The tolerance was created with a value, without specifying - how the value would be used. This is used to prevent setting - the mode more than once and is generally changed to Linear - upon execution of the test. - - - - - The tolerance is used as a numeric range within which - two compared values are considered to be equal. - - - - - Interprets the tolerance as the percentage by which - the two compared values my deviate from each other. - - - - - Compares two values based in their distance in - representable numbers. - - - - - The Tolerance class generalizes the notion of a tolerance - within which an equality test succeeds. Normally, it is - used with numeric types, but it can be used with any - type that supports taking a difference between two - objects and comparing that difference to a value. - - - - - Constructs a linear tolerance of a specdified amount - - - - - Constructs a tolerance given an amount and ToleranceMode - - - - - Tests that the current Tolerance is linear with a - numeric value, throwing an exception if it is not. - - - - - Returns an empty Tolerance object, equivalent to - specifying an exact match. - - - - - Gets the ToleranceMode for the current Tolerance - - - - - Gets the value of the current Tolerance instance. - - - - - Returns a new tolerance, using the current amount as a percentage. - - - - - Returns a new tolerance, using the current amount in Ulps. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of days. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of hours. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of minutes. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of seconds. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of milliseconds. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of clock ticks. - - - - - Returns true if the current tolerance is empty. - - - - - TypeConstraint is the abstract base for constraints - that take a Type as their expected value. - - - - - The expected Type used by the constraint - - - - - Construct a TypeConstraint for a given Type - - - - - - Write the actual value for a failing constraint test to a - MessageWriter. TypeConstraints override this method to write - the name of the type. - - The writer on which the actual value is displayed - - - - ExactTypeConstraint is used to test that an object - is of the exact type provided in the constructor - - - - - Construct an ExactTypeConstraint for a given Type - - The expected Type. - - - - Test that an object is of the exact type specified - - The actual value. - True if the tested object is of the exact type provided, otherwise false. - - - - Write the description of this constraint to a MessageWriter - - The MessageWriter to use - - - - InstanceOfTypeConstraint is used to test that an object - is of the same type provided or derived from it. - - - - - Construct an InstanceOfTypeConstraint for the type provided - - The expected Type - - - - Test whether an object is of the specified type or a derived type - - The object to be tested - True if the object is of the provided type or derives from it, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - AssignableFromConstraint is used to test that an object - can be assigned from a given Type. - - - - - Construct an AssignableFromConstraint for the type provided - - - - - - Test whether an object can be assigned from the specified type - - The object to be tested - True if the object can be assigned a value of the expected Type, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - AssignableToConstraint is used to test that an object - can be assigned to a given Type. - - - - - Construct an AssignableToConstraint for the type provided - - - - - - Test whether an object can be assigned to the specified type - - The object to be tested - True if the object can be assigned a value of the expected Type, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - Thrown when an assertion failed. - - - - - The error message that explains - the reason for the exception - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Thrown when an assertion failed. - - - - - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Thrown when a test executes inconclusively. - - - - - The error message that explains - the reason for the exception - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Thrown when an assertion failed. - - - - - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Delegate used by tests that execute code and - capture any thrown exception. - - - - - The Assert class contains a collection of static methods that - implement the most common assertions used in NUnit. - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Helper for Assert.AreEqual(double expected, double actual, ...) - allowing code generation to work consistently. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Throws a with the message and arguments - that are passed in. This allows a test to be cut short, with a result - of success returned to NUnit. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws a with the message and arguments - that are passed in. This allows a test to be cut short, with a result - of success returned to NUnit. - - The message to initialize the with. - - - - Throws a with the message and arguments - that are passed in. This allows a test to be cut short, with a result - of success returned to NUnit. - - - - - Throws an with the message and arguments - that are passed in. This is used by the other Assert functions. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This is used by the other Assert functions. - - The message to initialize the with. - - - - Throws an . - This is used by the other Assert functions. - - - - - Throws an with the message and arguments - that are passed in. This causes the test to be reported as ignored. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This causes the test to be reported as ignored. - - The message to initialize the with. - - - - Throws an . - This causes the test to be reported as ignored. - - - - - Throws an with the message and arguments - that are passed in. This causes the test to be reported as inconclusive. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This causes the test to be reported as inconclusive. - - The message to initialize the with. - - - - Throws an . - This causes the test to be reported as Inconclusive. - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that the code represented by a delegate throws an exception - that satisfies the constraint provided. - - A TestDelegate to be executed - A ThrowsConstraint used in the test - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestSnippet delegate - - - - Verifies that a delegate throws a particular exception when called. - - The exception Type expected - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - The exception Type expected - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - The exception Type expected - A TestSnippet delegate - - - - Verifies that a delegate throws a particular exception when called. - - Type of the expected exception - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - Type of the expected exception - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - Type of the expected exception - A TestSnippet delegate - - - - Verifies that a delegate throws an exception when called - and returns it. - - A TestDelegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws an exception when called - and returns it. - - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws an exception when called - and returns it. - - A TestDelegate - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - - - - Verifies that a delegate does not throw an exception - - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate does not throw an exception. - - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate does not throw an exception. - - A TestSnippet delegate - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - - - - Assert that a string is not null or empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is not null or empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is not null or empty - - The string to be tested - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are not equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are not equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are not equal an is thrown. - - The value that is expected - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two objects are not equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two objects are not equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - - - - Verifies that two objects are not equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are equal an is thrown. - - The value that is expected - The actual value - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - The message to display in case of failure - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - - - - Gets the number of assertions executed so far and - resets the counter to zero. - - - - - AssertionHelper is an optional base class for user tests, - allowing the use of shorter names for constraints and - asserts and avoiding conflict with the definition of - , from which it inherits much of its - behavior, in certain mock object frameworks. - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to - . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to - . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to . - - The evaluated condition - - - - Asserts that the code represented by a delegate throws an exception - that satisfies the constraint provided. - - A TestDelegate to be executed - A ThrowsConstraint used in the test - - - - Returns a ListMapper based on a collection. - - The original collection - - - - - Provides static methods to express the assumptions - that must be met for a test to give a meaningful - result. If an assumption is not met, the test - should produce an inconclusive result. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the - method throws an . - - The evaluated condition - - - - Asserts that the code represented by a delegate throws an exception - that satisfies the constraint provided. - - A TestDelegate to be executed - A ThrowsConstraint used in the test - - - - A set of Assert methods operationg on one or more collections - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - The message that will be displayed on failure - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable containing objects to be considered - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable containing objects to be considered - The message that will be displayed on failure - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - The message that will be displayed on failure - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - The message that will be displayed on failure - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array,list or other collection is empty - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array,list or other collection is empty - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - A custom comparer to perform the comparisons - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - A custom comparer to perform the comparisons - The message to be displayed on failure - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - A custom comparer to perform the comparisons - - - - Static helper class used in the constraint-based syntax - - - - - Creates a new SubstringConstraint - - The value of the substring - A SubstringConstraint - - - - Creates a new CollectionContainsConstraint. - - The item that should be found. - A new CollectionContainsConstraint - - - - Summary description for DirectoryAssert - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are not equal - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are equal - Arguments to be used in formatting the message - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are equal - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Summary description for FileAssert. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - The message to display if objects are not equal - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if objects are not equal - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if objects are not equal - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - The message to be displayed when the two Stream are the same. - Arguments to be used in formatting the message - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - The message to be displayed when the Streams are the same. - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if objects are not equal - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if objects are not equal - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - - - - GlobalSettings is a place for setting default values used - by the framework in performing asserts. - - - - - Default tolerance for floating point equality - - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - Returns a new PropertyConstraintExpression, which will either - test for the existence of the named property on the object - being tested or apply any following constraint to that property. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if at least one of them succeeds. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them fail. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Length property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Count property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Message property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the InnerException property of the object being tested. - - - - - Interface implemented by a user fixture in order to - validate any expected exceptions. It is only called - for test methods marked with the ExpectedException - attribute. - - - - - Method to handle an expected exception - - The exception to be handled - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - Returns a constraint that tests two items for equality - - - - - Returns a constraint that tests that two references are the same object - - - - - Returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a collection containing the same elements as the - collection supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a subset of the collection supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that tests whether the path provided - is the same as an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the actual value falls - within a specified range. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a constraint that tests for null - - - - - Returns a constraint that tests for True - - - - - Returns a constraint that tests for False - - - - - Returns a constraint that tests for NaN - - - - - Returns a constraint that tests for empty - - - - - Returns a constraint that tests whether a collection - contains all unique items. - - - - - Returns a constraint that tests whether an object graph is serializable in binary format. - - - - - Returns a constraint that tests whether an object graph is serializable in xml format. - - - - - Returns a constraint that tests whether a collection is ordered - - - - - The Iz class is a synonym for Is intended for use in VB, - which regards Is as a keyword. - - - - - The List class is a helper class with properties and methods - that supply a number of constraints used with lists and collections. - - - - - List.Map returns a ListMapper, which can be used to map - the original collection to another collection. - - - - - - - ListMapper is used to transform a collection used as an actual argument - producing another collection to be used in the assertion. - - - - - Construct a ListMapper based on a collection - - The collection to be transformed - - - - Produces a collection containing all the values of a property - - The collection of property values - - - - - Randomizer returns a set of random values in a repeatable - way, to allow re-running of tests if necessary. - - - - - Get a randomizer for a particular member, returning - one that has already been created if it exists. - This ensures that the same values are generated - each time the tests are reloaded. - - - - - Get a randomizer for a particular parameter, returning - one that has already been created if it exists. - This ensures that the same values are generated - each time the tests are reloaded. - - - - - Construct a randomizer using a random seed - - - - - Construct a randomizer using a specified seed - - - - - Return an array of random doubles between 0.0 and 1.0. - - - - - - - Return an array of random doubles with values in a specified range. - - - - - Return an array of random ints with values in a specified range. - - - - - Get a random seed for use in creating a randomizer. - - - - - The SpecialValue enum is used to represent TestCase arguments - that cannot be used as arguments to an Attribute. - - - - - Null represents a null value, which cannot be used as an - argument to an attriute under .NET 1.x - - - - - Basic Asserts on strings. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - - - - Asserts that a string is not found within another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - - - - Asserts that a string does not start with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string does not start with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string does not start with another string. - - The expected string - The string to be examined - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - - - - Asserts that a string does not end with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string does not end with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string does not end with another string. - - The expected string - The string to be examined - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - - - - Asserts that two strings are not equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that two strings are Notequal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - - - - Asserts that two strings are not equal, without regard to case. - - The expected string - The actual string - - - - Asserts that a string matches an expected regular expression pattern. - - The regex pattern to be matched - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string matches an expected regular expression pattern. - - The regex pattern to be matched - The actual string - The message to display in case of failure - - - - Asserts that a string matches an expected regular expression pattern. - - The regex pattern to be matched - The actual string - - - - Asserts that a string does not match an expected regular expression pattern. - - The regex pattern to be used - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string does not match an expected regular expression pattern. - - The regex pattern to be used - The actual string - The message to display in case of failure - - - - Asserts that a string does not match an expected regular expression pattern. - - The regex pattern to be used - The actual string - - - - The TestCaseData class represents a set of arguments - and other parameter info to be used for a parameterized - test case. It provides a number of instance modifiers - for use in initializing the test case. - - Note: Instance modifiers are getters that return - the same instance after modifying it's state. - - - - - The argument list to be provided to the test - - - - - The expected result to be returned - - - - - The expected exception Type - - - - - The FullName of the expected exception - - - - - The name to be used for the test - - - - - The description of the test - - - - - A dictionary of properties, used to add information - to tests without requiring the class to change. - - - - - If true, indicates that the test case is to be ignored - - - - - The reason for ignoring a test case - - - - - Initializes a new instance of the class. - - The arguments. - - - - Initializes a new instance of the class. - - The argument. - - - - Initializes a new instance of the class. - - The first argument. - The second argument. - - - - Initializes a new instance of the class. - - The first argument. - The second argument. - The third argument. - - - - Sets the expected result for the test - - The expected result - A modified TestCaseData - - - - Sets the expected exception type for the test - - Type of the expected exception. - The modified TestCaseData instance - - - - Sets the expected exception type for the test - - FullName of the expected exception. - The modified TestCaseData instance - - - - Sets the name of the test case - - The modified TestCaseData instance - - - - Sets the description for the test case - being constructed. - - The description. - The modified TestCaseData instance. - - - - Applies a category to the test - - - - - - - Applies a named property to the test - - - - - - - - Applies a named property to the test - - - - - - - - Applies a named property to the test - - - - - - - - Ignores this TestCase. - - - - - - Ignores this TestCase, specifying the reason. - - The reason. - - - - - Gets the argument list to be provided to the test - - - - - Gets the expected result - - - - - Gets the expected exception Type - - - - - Gets the FullName of the expected exception - - - - - Gets the name to be used for the test - - - - - Gets the description of the test - - - - - Gets a value indicating whether this is ignored. - - true if ignored; otherwise, false. - - - - Gets the ignore reason. - - The ignore reason. - - - - Gets a list of categories associated with this test. - - - - - Gets the property dictionary for this test - - - - - Provide the context information of the current test - - - - - Constructs a TestContext using the provided context dictionary - - A context dictionary - - - - Get the current test context. This is created - as needed. The user may save the context for - use within a test, but it should not be used - outside the test for which it is created. - - - - - Gets a TestAdapter representing the currently executing test in this context. - - - - - Gets a ResultAdapter representing the current result for the test - executing in this context. - - - - - Gets the current directory for this TestContext - - - - - TestAdapter adapts a Test for consumption by - the user test code. - - - - - Constructs a TestAdapter for this context - - The context dictionary - - - - The name of the test. - - - - - The FullName of the test - - - - - The properties of the test. - - - - - ResultAdapter adapts a TestResult for consumption by - the user test code. - - - - - Construct a ResultAdapter for a context - - The context holding the result - - - - The TestState of current test. This maps to the ResultState - used in nunit.core and is subject to change in the future. - - - - - The TestStatus of current test. This enum will be used - in future versions of NUnit and so is to be preferred - to the TestState value. - - - - - The ResultState enum indicates the result of running a test - - - - - The result is inconclusive - - - - - The test was not runnable. - - - - - The test has been skipped. - - - - - The test has been ignored. - - - - - The test succeeded - - - - - The test failed - - - - - The test encountered an unexpected exception - - - - - The test was cancelled by the user - - - - - The TestStatus enum indicates the result of running a test - - - - - The test was inconclusive - - - - - The test has skipped - - - - - The test succeeded - - - - - The test failed - - - - - Helper class with static methods used to supply constraints - that operate on strings. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that fails if the actual - value matches the pattern supplied as an argument. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - TextMessageWriter writes constraint descriptions and messages - in displayable form as a text stream. It tailors the display - of individual message components to form the standard message - format of NUnit assertion failure messages. - - - - - Prefix used for the expected value line of a message - - - - - Prefix used for the actual value line of a message - - - - - Length of a message prefix - - - - - Construct a TextMessageWriter - - - - - Construct a TextMessageWriter, specifying a user message - and optional formatting arguments. - - - - - - - Method to write single line message with optional args, usually - written to precede the general failure message, at a givel - indentation level. - - The indentation level of the message - The message to be written - Any arguments used in formatting the message - - - - Display Expected and Actual lines for a constraint. This - is called by MessageWriter's default implementation of - WriteMessageTo and provides the generic two-line display. - - The constraint that failed - - - - Display Expected and Actual lines for given values. This - method may be called by constraints that need more control over - the display of actual and expected values than is provided - by the default implementation. - - The expected value - The actual value causing the failure - - - - Display Expected and Actual lines for given values, including - a tolerance value on the expected line. - - The expected value - The actual value causing the failure - The tolerance within which the test was made - - - - Display the expected and actual string values on separate lines. - If the mismatch parameter is >=0, an additional line is displayed - line containing a caret that points to the mismatch point. - - The expected string value - The actual string value - The point at which the strings don't match or -1 - If true, case is ignored in string comparisons - If true, clip the strings to fit the max line length - - - - Writes the text for a connector. - - The connector. - - - - Writes the text for a predicate. - - The predicate. - - - - Write the text for a modifier. - - The modifier. - - - - Writes the text for an expected value. - - The expected value. - - - - Writes the text for an actual value. - - The actual value. - - - - Writes the text for a generalized value. - - The value. - - - - Writes the text for a collection value, - starting at a particular point, to a max length - - The collection containing elements to write. - The starting point of the elements to write - The maximum number of elements to write - - - - Write the generic 'Expected' line for a constraint - - The constraint that failed - - - - Write the generic 'Expected' line for a given value - - The expected value - - - - Write the generic 'Expected' line for a given value - and tolerance. - - The expected value - The tolerance within which the test was made - - - - Write the generic 'Actual' line for a constraint - - The constraint for which the actual value is to be written - - - - Write the generic 'Actual' line for a given value - - The actual value causing a failure - - - - Gets or sets the maximum line length for this writer - - - - - Helper class with properties and methods that supply - constraints that operate on exceptions. - - - - - Creates a constraint specifying the exact type of exception expected - - - - - Creates a constraint specifying the exact type of exception expected - - - - - Creates a constraint specifying the type of exception expected - - - - - Creates a constraint specifying the type of exception expected - - - - - Creates a constraint specifying an expected exception - - - - - Creates a constraint specifying an exception with a given InnerException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying that no exception is thrown - - - - diff --git a/Mvc.Mailer.Test/bin/Release/Chrysanthemum.jpg b/Mvc.Mailer.Test/bin/Release/Chrysanthemum.jpg deleted file mode 100644 index 757c2a6..0000000 Binary files a/Mvc.Mailer.Test/bin/Release/Chrysanthemum.jpg and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Release/Moq.dll b/Mvc.Mailer.Test/bin/Release/Moq.dll deleted file mode 100644 index 3a3e653..0000000 Binary files a/Mvc.Mailer.Test/bin/Release/Moq.dll and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Release/Moq.pdb b/Mvc.Mailer.Test/bin/Release/Moq.pdb deleted file mode 100644 index 03cca56..0000000 Binary files a/Mvc.Mailer.Test/bin/Release/Moq.pdb and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Release/Moq.xml b/Mvc.Mailer.Test/bin/Release/Moq.xml deleted file mode 100644 index 13b8804..0000000 --- a/Mvc.Mailer.Test/bin/Release/Moq.xml +++ /dev/null @@ -1,5120 +0,0 @@ - - - - Moq - - - - - Implements the fluent API. - - - - - The expectation will be considered only in the former condition. - - - - - - - The expectation will be considered only in the former condition. - - - - - - - - Setups the get. - - The type of the property. - The expression. - - - - - Setups the set. - - The type of the property. - The setter expression. - - - - - Setups the set. - - The setter expression. - - - - - Defines the Callback verb and overloads. - - - - - Helper interface used to hide the base - members from the fluent API to make it much cleaner - in Visual Studio intellisense. - - - - - - - - - - - - - - - - - Specifies a callback to invoke when the method is called. - - The callback method to invoke. - - The following example specifies a callback to set a boolean - value that can be used later: - - var called = false; - mock.Setup(x => x.Execute()) - .Callback(() => called = true); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The argument type of the invoked method. - The callback method to invoke. - - Invokes the given callback with the concrete invocation argument value. - - Notice how the specific string argument is retrieved by simply declaring - it as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute(It.IsAny<string>())) - .Callback((string command) => Console.WriteLine(command)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3) => Console.WriteLine(arg1 + arg2 + arg3)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The type of the fifteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15)); - - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The type of the fifteenth argument of the invoked method. - The type of the sixteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16)); - - - - - - Defines the Callback verb and overloads for callbacks on - setups that return a value. - - Mocked type. - Type of the return value of the setup. - - - - Specifies a callback to invoke when the method is called. - - The callback method to invoke. - - The following example specifies a callback to set a boolean value that can be used later: - - var called = false; - mock.Setup(x => x.Execute()) - .Callback(() => called = true) - .Returns(true); - - Note that in the case of value-returning methods, after the Callback - call you can still specify the return value. - - - - - Specifies a callback to invoke when the method is called that receives the original arguments. - - The type of the argument of the invoked method. - Callback method to invoke. - - Invokes the given callback with the concrete invocation argument value. - - Notice how the specific string argument is retrieved by simply declaring - it as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute(It.IsAny<string>())) - .Callback(command => Console.WriteLine(command)) - .Returns(true); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2) => Console.WriteLine(arg1 + arg2)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3) => Console.WriteLine(arg1 + arg2 + arg3)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The type of the fifteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15)); - - - - - - Specifies a callback to invoke when the method is called that receives the original - arguments. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The type of the fifteenth argument of the invoked method. - The type of the sixteenth argument of the invoked method. - The callback method to invoke. - A reference to interface. - - Invokes the given callback with the concrete invocation arguments values. - - Notice how the specific arguments are retrieved by simply declaring - them as part of the lambda expression for the callback: - - - mock.Setup(x => x.Execute( - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>(), - It.IsAny<string>())) - .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16)); - - - - - - Defines the Raises verb. - - - - - Specifies the event that will be raised - when the setup is met. - - An expression that represents an event attach or detach action. - The event arguments to pass for the raised event. - - The following example shows how to raise an event when - the setup is met: - - var mock = new Mock<IContainer>(); - - mock.Setup(add => add.Add(It.IsAny<string>(), It.IsAny<object>())) - .Raises(add => add.Added += null, EventArgs.Empty); - - - - - - Specifies the event that will be raised - when the setup is matched. - - An expression that represents an event attach or detach action. - A function that will build the - to pass when raising the event. - - - - - Specifies the custom event that will be raised - when the setup is matched. - - An expression that represents an event attach or detach action. - The arguments to pass to the custom delegate (non EventHandler-compatible). - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - The type of the eleventh argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - The type of the eleventh argument received by the expected invocation. - The type of the twelfth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - The type of the eleventh argument received by the expected invocation. - The type of the twelfth argument received by the expected invocation. - The type of the thirteenth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - The type of the eleventh argument received by the expected invocation. - The type of the twelfth argument received by the expected invocation. - The type of the thirteenth argument received by the expected invocation. - The type of the fourteenth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - The type of the eleventh argument received by the expected invocation. - The type of the twelfth argument received by the expected invocation. - The type of the thirteenth argument received by the expected invocation. - The type of the fourteenth argument received by the expected invocation. - The type of the fifteenth argument received by the expected invocation. - - - - - Specifies the event that will be raised when the setup is matched. - - The expression that represents an event attach or detach action. - The function that will build the - to pass when raising the event. - The type of the first argument received by the expected invocation. - The type of the second argument received by the expected invocation. - The type of the third argument received by the expected invocation. - The type of the fourth argument received by the expected invocation. - The type of the fifth argument received by the expected invocation. - The type of the sixth argument received by the expected invocation. - The type of the seventh argument received by the expected invocation. - The type of the eighth argument received by the expected invocation. - The type of the nineth argument received by the expected invocation. - The type of the tenth argument received by the expected invocation. - The type of the eleventh argument received by the expected invocation. - The type of the twelfth argument received by the expected invocation. - The type of the thirteenth argument received by the expected invocation. - The type of the fourteenth argument received by the expected invocation. - The type of the fifteenth argument received by the expected invocation. - The type of the sixteenth argument received by the expected invocation. - - - - - Defines the Returns verb. - - Mocked type. - Type of the return value from the expression. - - - - Specifies the value to return. - - The value to return, or . - - Return a true value from the method call: - - mock.Setup(x => x.Execute("ping")) - .Returns(true); - - - - - - Specifies a function that will calculate the value to return from the method. - - The function that will calculate the return value. - - Return a calculated value when the method is called: - - mock.Setup(x => x.Execute("ping")) - .Returns(() => returnValues[0]); - - The lambda expression to retrieve the return value is lazy-executed, - meaning that its value may change depending on the moment the method - is executed and the value the returnValues array has at - that moment. - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the argument of the invoked method. - The function that will calculate the return value. - - Return a calculated value which is evaluated lazily at the time of the invocation. - - The lookup list can change between invocations and the setup - will return different values accordingly. Also, notice how the specific - string argument is retrieved by simply declaring it as part of the lambda - expression: - - - mock.Setup(x => x.Execute(It.IsAny<string>())) - .Returns((string command) => returnValues[command]); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2) => arg1 + arg2); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3) => arg1 + arg2 + arg3); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4) => arg1 + arg2 + arg3 + arg4); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5) => arg1 + arg2 + arg3 + arg4 + arg5); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The type of the fifteenth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15); - - - - - - Specifies a function that will calculate the value to return from the method, - retrieving the arguments for the invocation. - - The type of the first argument of the invoked method. - The type of the second argument of the invoked method. - The type of the third argument of the invoked method. - The type of the fourth argument of the invoked method. - The type of the fifth argument of the invoked method. - The type of the sixth argument of the invoked method. - The type of the seventh argument of the invoked method. - The type of the eighth argument of the invoked method. - The type of the nineth argument of the invoked method. - The type of the tenth argument of the invoked method. - The type of the eleventh argument of the invoked method. - The type of the twelfth argument of the invoked method. - The type of the thirteenth argument of the invoked method. - The type of the fourteenth argument of the invoked method. - The type of the fifteenth argument of the invoked method. - The type of the sixteenth argument of the invoked method. - The function that will calculate the return value. - Returns a calculated value which is evaluated lazily at the time of the invocation. - - - The return value is calculated from the value of the actual method invocation arguments. - Notice how the arguments are retrieved by simply declaring them as part of the lambda - expression: - - - mock.Setup(x => x.Execute( - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>(), - It.IsAny<int>())) - .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16); - - - - - - Language for ReturnSequence - - - - - Returns value - - - - - Throws an exception - - - - - Throws an exception - - - - - The first method call or member access will be the - last segment of the expression (depth-first traversal), - which is the one we have to Setup rather than FluentMock. - And the last one is the one we have to Mock.Get rather - than FluentMock. - - - - - Base class for mocks and static helper class with methods that - apply to mocked objects, such as to - retrieve a from an object instance. - - - - - Creates an mock object of the indicated type. - - The type of the mocked object. - The mocked object created. - - - - Creates an mock object of the indicated type. - - The predicate with the specification of how the mocked object should behave. - The type of the mocked object. - The mocked object created. - - - - Initializes a new instance of the class. - - - - - Retrieves the mock object for the given object instance. - - Type of the mock to retrieve. Can be omitted as it's inferred - from the object instance passed in as the instance. - The instance of the mocked object.The mock associated with the mocked object. - The received instance - was not created by Moq. - - The following example shows how to add a new setup to an object - instance which is not the original but rather - the object associated with it: - - // Typed instance, not the mock, is retrieved from some test API. - HttpContextBase context = GetMockContext(); - - // context.Request is the typed object from the "real" API - // so in order to add a setup to it, we need to get - // the mock that "owns" it - Mock<HttpRequestBase> request = Mock.Get(context.Request); - mock.Setup(req => req.AppRelativeCurrentExecutionFilePath) - .Returns(tempUrl); - - - - - - Returns the mocked object value. - - - - - Verifies that all verifiable expectations have been met. - - This example sets up an expectation and marks it as verifiable. After - the mock is used, a Verify() call is issued on the mock - to ensure the method in the setup was invoked: - - var mock = new Mock<IWarehouse>(); - this.Setup(x => x.HasInventory(TALISKER, 50)).Verifiable().Returns(true); - ... - // other test code - ... - // Will throw if the test code has didn't call HasInventory. - this.Verify(); - - Not all verifiable expectations were met. - - - - Verifies all expectations regardless of whether they have - been flagged as verifiable. - - This example sets up an expectation without marking it as verifiable. After - the mock is used, a call is issued on the mock - to ensure that all expectations are met: - - var mock = new Mock<IWarehouse>(); - this.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true); - ... - // other test code - ... - // Will throw if the test code has didn't call HasInventory, even - // that expectation was not marked as verifiable. - this.VerifyAll(); - - At least one expectation was not met. - - - - Gets the interceptor target for the given expression and root mock, - building the intermediate hierarchy of mock objects if necessary. - - - - - Raises the associated event with the given - event argument data. - - - - - Raises the associated event with the given - event argument data. - - - - - Adds an interface implementation to the mock, - allowing setups to be specified for it. - - This method can only be called before the first use - of the mock property, at which - point the runtime type has already been generated - and no more interfaces can be added to it. - - Also, must be an - interface and not a class, which must be specified - when creating the mock instead. - - - The mock type - has already been generated by accessing the property. - - The specified - is not an interface. - - The following example creates a mock for the main interface - and later adds to it to verify - it's called by the consumer code: - - var mock = new Mock<IProcessor>(); - mock.Setup(x => x.Execute("ping")); - - // add IDisposable interface - var disposable = mock.As<IDisposable>(); - disposable.Setup(d => d.Dispose()).Verifiable(); - - Type of interface to cast the mock to. - - - - - - - Behavior of the mock, according to the value set in the constructor. - - - - - Whether the base member virtual implementation will be called - for mocked classes if no setup is matched. Defaults to . - - - - - Specifies the behavior to use when returning default values for - unexpected invocations on loose mocks. - - - - - Gets the mocked object instance. - - - - - Retrieves the type of the mocked object, its generic type argument. - This is used in the auto-mocking of hierarchy access. - - - - - Specifies the class that will determine the default - value to return when invocations are made that - have no setups and need to return a default - value (for loose mocks). - - - - - Exposes the list of extra interfaces implemented by the mock. - - - - - Utility repository class to use to construct multiple - mocks when consistent verification is - desired for all of them. - - - If multiple mocks will be created during a test, passing - the desired (if different than the - or the one - passed to the repository constructor) and later verifying each - mock can become repetitive and tedious. - - This repository class helps in that scenario by providing a - simplified creation of multiple mocks with a default - (unless overriden by calling - ) and posterior verification. - - - - The following is a straightforward example on how to - create and automatically verify strict mocks using a : - - var repository = new MockRepository(MockBehavior.Strict); - - var foo = repository.Create<IFoo>(); - var bar = repository.Create<IBar>(); - - // no need to call Verifiable() on the setup - // as we'll be validating all of them anyway. - foo.Setup(f => f.Do()); - bar.Setup(b => b.Redo()); - - // exercise the mocks here - - repository.VerifyAll(); - // At this point all setups are already checked - // and an optional MockException might be thrown. - // Note also that because the mocks are strict, any invocation - // that doesn't have a matching setup will also throw a MockException. - - The following examples shows how to setup the repository - to create loose mocks and later verify only verifiable setups: - - var repository = new MockRepository(MockBehavior.Loose); - - var foo = repository.Create<IFoo>(); - var bar = repository.Create<IBar>(); - - // this setup will be verified when we verify the repository - foo.Setup(f => f.Do()).Verifiable(); - - // this setup will NOT be verified - foo.Setup(f => f.Calculate()); - - // this setup will be verified when we verify the repository - bar.Setup(b => b.Redo()).Verifiable(); - - // exercise the mocks here - // note that because the mocks are Loose, members - // called in the interfaces for which no matching - // setups exist will NOT throw exceptions, - // and will rather return default values. - - repository.Verify(); - // At this point verifiable setups are already checked - // and an optional MockException might be thrown. - - The following examples shows how to setup the repository with a - default strict behavior, overriding that default for a - specific mock: - - var repository = new MockRepository(MockBehavior.Strict); - - // this particular one we want loose - var foo = repository.Create<IFoo>(MockBehavior.Loose); - var bar = repository.Create<IBar>(); - - // specify setups - - // exercise the mocks here - - repository.Verify(); - - - - - - - Utility factory class to use to construct multiple - mocks when consistent verification is - desired for all of them. - - - If multiple mocks will be created during a test, passing - the desired (if different than the - or the one - passed to the factory constructor) and later verifying each - mock can become repetitive and tedious. - - This factory class helps in that scenario by providing a - simplified creation of multiple mocks with a default - (unless overriden by calling - ) and posterior verification. - - - - The following is a straightforward example on how to - create and automatically verify strict mocks using a : - - var factory = new MockFactory(MockBehavior.Strict); - - var foo = factory.Create<IFoo>(); - var bar = factory.Create<IBar>(); - - // no need to call Verifiable() on the setup - // as we'll be validating all of them anyway. - foo.Setup(f => f.Do()); - bar.Setup(b => b.Redo()); - - // exercise the mocks here - - factory.VerifyAll(); - // At this point all setups are already checked - // and an optional MockException might be thrown. - // Note also that because the mocks are strict, any invocation - // that doesn't have a matching setup will also throw a MockException. - - The following examples shows how to setup the factory - to create loose mocks and later verify only verifiable setups: - - var factory = new MockFactory(MockBehavior.Loose); - - var foo = factory.Create<IFoo>(); - var bar = factory.Create<IBar>(); - - // this setup will be verified when we verify the factory - foo.Setup(f => f.Do()).Verifiable(); - - // this setup will NOT be verified - foo.Setup(f => f.Calculate()); - - // this setup will be verified when we verify the factory - bar.Setup(b => b.Redo()).Verifiable(); - - // exercise the mocks here - // note that because the mocks are Loose, members - // called in the interfaces for which no matching - // setups exist will NOT throw exceptions, - // and will rather return default values. - - factory.Verify(); - // At this point verifiable setups are already checked - // and an optional MockException might be thrown. - - The following examples shows how to setup the factory with a - default strict behavior, overriding that default for a - specific mock: - - var factory = new MockFactory(MockBehavior.Strict); - - // this particular one we want loose - var foo = factory.Create<IFoo>(MockBehavior.Loose); - var bar = factory.Create<IBar>(); - - // specify setups - - // exercise the mocks here - - factory.Verify(); - - - - - - - Initializes the factory with the given - for newly created mocks from the factory. - - The behavior to use for mocks created - using the factory method if not overriden - by using the overload. - - - - Creates a new mock with the default - specified at factory construction time. - - Type to mock. - A new . - - - var factory = new MockFactory(MockBehavior.Strict); - - var foo = factory.Create<IFoo>(); - // use mock on tests - - factory.VerifyAll(); - - - - - - Creates a new mock with the default - specified at factory construction time and with the - the given constructor arguments for the class. - - - The mock will try to find the best match constructor given the - constructor arguments, and invoke that to initialize the instance. - This applies only to classes, not interfaces. - - Type to mock. - Constructor arguments for mocked classes. - A new . - - - var factory = new MockFactory(MockBehavior.Default); - - var mock = factory.Create<MyBase>("Foo", 25, true); - // use mock on tests - - factory.Verify(); - - - - - - Creates a new mock with the given . - - Type to mock. - Behavior to use for the mock, which overrides - the default behavior specified at factory construction time. - A new . - - The following example shows how to create a mock with a different - behavior to that specified as the default for the factory: - - var factory = new MockFactory(MockBehavior.Strict); - - var foo = factory.Create<IFoo>(MockBehavior.Loose); - - - - - - Creates a new mock with the given - and with the the given constructor arguments for the class. - - - The mock will try to find the best match constructor given the - constructor arguments, and invoke that to initialize the instance. - This applies only to classes, not interfaces. - - Type to mock. - Behavior to use for the mock, which overrides - the default behavior specified at factory construction time. - Constructor arguments for mocked classes. - A new . - - The following example shows how to create a mock with a different - behavior to that specified as the default for the factory, passing - constructor arguments: - - var factory = new MockFactory(MockBehavior.Default); - - var mock = factory.Create<MyBase>(MockBehavior.Strict, "Foo", 25, true); - - - - - - Implements creation of a new mock within the factory. - - Type to mock. - The behavior for the new mock. - Optional arguments for the construction of the mock. - - - - Verifies all verifiable expectations on all mocks created - by this factory. - - - One or more mocks had expectations that were not satisfied. - - - - Verifies all verifiable expectations on all mocks created - by this factory. - - - One or more mocks had expectations that were not satisfied. - - - - Invokes for each mock - in , and accumulates the resulting - that might be - thrown from the action. - - The action to execute against - each mock. - - - - Whether the base member virtual implementation will be called - for mocked classes if no setup is matched. Defaults to . - - - - - Specifies the behavior to use when returning default values for - unexpected invocations on loose mocks. - - - - - Gets the mocks that have been created by this factory and - that will get verified together. - - - - - Access the universe of mocks of the given type, to retrieve those - that behave according to the LINQ query specification. - - The type of the mocked object to query. - - - - Access the universe of mocks of the given type, to retrieve those - that behave according to the LINQ query specification. - - The predicate with the setup expressions. - The type of the mocked object to query. - - - - Creates an mock object of the indicated type. - - The type of the mocked object. - The mocked object created. - - - - Creates an mock object of the indicated type. - - The predicate with the setup expressions. - The type of the mocked object. - The mocked object created. - - - - Creates the mock query with the underlying queriable implementation. - - - - - Wraps the enumerator inside a queryable. - - - - - Method that is turned into the actual call from .Query{T}, to - transform the queryable query into a normal enumerable query. - This method is never used directly by consumers. - - - - - Initializes the repository with the given - for newly created mocks from the repository. - - The behavior to use for mocks created - using the repository method if not overriden - by using the overload. - - - - A that returns an empty default value - for invocations that do not have setups or return values, with loose mocks. - This is the default behavior for a mock. - - - - - Interface to be implemented by classes that determine the - default value of non-expected invocations. - - - - - Defines the default value to return in all the methods returning . - The type of the return value.The value to set as default. - - - - Provides a value for the given member and arguments. - - The member to provide a default value for. - - - - - The intention of is to create a more readable - string representation for the failure message. - - - - - Implements the fluent API. - - - - - Defines the Throws verb. - - - - - Specifies the exception to throw when the method is invoked. - - Exception instance to throw. - - This example shows how to throw an exception when the method is - invoked with an empty string argument: - - mock.Setup(x => x.Execute("")) - .Throws(new ArgumentException()); - - - - - - Specifies the type of exception to throw when the method is invoked. - - Type of exception to instantiate and throw when the setup is matched. - - This example shows how to throw an exception when the method is - invoked with an empty string argument: - - mock.Setup(x => x.Execute("")) - .Throws<ArgumentException>(); - - - - - - Implements the fluent API. - - - - - Defines occurrence members to constraint setups. - - - - - The expected invocation can happen at most once. - - - - var mock = new Mock<ICommand>(); - mock.Setup(foo => foo.Execute("ping")) - .AtMostOnce(); - - - - - - The expected invocation can happen at most specified number of times. - - The number of times to accept calls. - - - var mock = new Mock<ICommand>(); - mock.Setup(foo => foo.Execute("ping")) - .AtMost( 5 ); - - - - - - Defines the Verifiable verb. - - - - - Marks the expectation as verifiable, meaning that a call - to will check if this particular - expectation was met. - - - The following example marks the expectation as verifiable: - - mock.Expect(x => x.Execute("ping")) - .Returns(true) - .Verifiable(); - - - - - - Marks the expectation as verifiable, meaning that a call - to will check if this particular - expectation was met, and specifies a message for failures. - - - The following example marks the expectation as verifiable: - - mock.Expect(x => x.Execute("ping")) - .Returns(true) - .Verifiable("Ping should be executed always!"); - - - - - - Implements the fluent API. - - - - - We need this non-generics base class so that - we can use from - generic code. - - - - - Implements the fluent API. - - - - - Implements the fluent API. - - - - - Implements the fluent API. - - - - - Defines the Callback verb for property getter setups. - - - Mocked type. - Type of the property. - - - - Specifies a callback to invoke when the property is retrieved. - - Callback method to invoke. - - Invokes the given callback with the property value being set. - - mock.SetupGet(x => x.Suspended) - .Callback(() => called = true) - .Returns(true); - - - - - - Implements the fluent API. - - - - - Defines the Returns verb for property get setups. - - Mocked type. - Type of the property. - - - - Specifies the value to return. - - The value to return, or . - - Return a true value from the property getter call: - - mock.SetupGet(x => x.Suspended) - .Returns(true); - - - - - - Specifies a function that will calculate the value to return for the property. - - The function that will calculate the return value. - - Return a calculated value when the property is retrieved: - - mock.SetupGet(x => x.Suspended) - .Returns(() => returnValues[0]); - - The lambda expression to retrieve the return value is lazy-executed, - meaning that its value may change depending on the moment the property - is retrieved and the value the returnValues array has at - that moment. - - - - - Implements the fluent API. - - - - - Helper class to setup a full trace between many mocks - - - - - Initialize a trace setup - - - - - Allow sequence to be repeated - - - - - define nice api - - - - - Perform an expectation in the trace. - - - - - Marks a method as a matcher, which allows complete replacement - of the built-in class with your own argument - matching rules. - - - This feature has been deprecated in favor of the new - and simpler . - - - The argument matching is used to determine whether a concrete - invocation in the mock matches a given setup. This - matching mechanism is fully extensible. - - - There are two parts of a matcher: the compiler matcher - and the runtime matcher. - - - Compiler matcher - Used to satisfy the compiler requirements for the - argument. Needs to be a method optionally receiving any arguments - you might need for the matching, but with a return type that - matches that of the argument. - - Let's say I want to match a lists of orders that contains - a particular one. I might create a compiler matcher like the following: - - - public static class Orders - { - [Matcher] - public static IEnumerable<Order> Contains(Order order) - { - return null; - } - } - - Now we can invoke this static method instead of an argument in an - invocation: - - var order = new Order { ... }; - var mock = new Mock<IRepository<Order>>(); - - mock.Setup(x => x.Save(Orders.Contains(order))) - .Throws<ArgumentException>(); - - Note that the return value from the compiler matcher is irrelevant. - This method will never be called, and is just used to satisfy the - compiler and to signal Moq that this is not a method that we want - to be invoked at runtime. - - - - Runtime matcher - - The runtime matcher is the one that will actually perform evaluation - when the test is run, and is defined by convention to have the - same signature as the compiler matcher, but where the return - value is the first argument to the call, which contains the - object received by the actual invocation at runtime: - - public static bool Contains(IEnumerable<Order> orders, Order order) - { - return orders.Contains(order); - } - - At runtime, the mocked method will be invoked with a specific - list of orders. This value will be passed to this runtime - matcher as the first argument, while the second argument is the - one specified in the setup (x.Save(Orders.Contains(order))). - - The boolean returned determines whether the given argument has been - matched. If all arguments to the expected method are matched, then - the setup matches and is evaluated. - - - - - - Using this extensible infrastructure, you can easily replace the entire - set of matchers with your own. You can also avoid the - typical (and annoying) lengthy expressions that result when you have - multiple arguments that use generics. - - - The following is the complete example explained above: - - public static class Orders - { - [Matcher] - public static IEnumerable<Order> Contains(Order order) - { - return null; - } - - public static bool Contains(IEnumerable<Order> orders, Order order) - { - return orders.Contains(order); - } - } - - And the concrete test using this matcher: - - var order = new Order { ... }; - var mock = new Mock<IRepository<Order>>(); - - mock.Setup(x => x.Save(Orders.Contains(order))) - .Throws<ArgumentException>(); - - // use mock, invoke Save, and have the matcher filter. - - - - - - Provides a mock implementation of . - - Any interface type can be used for mocking, but for classes, only abstract and virtual members can be mocked. - - The behavior of the mock with regards to the setups and the actual calls is determined - by the optional that can be passed to the - constructor. - - Type to mock, which can be an interface or a class. - The following example shows establishing setups with specific values - for method invocations: - - // Arrange - var order = new Order(TALISKER, 50); - var mock = new Mock<IWarehouse>(); - - mock.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true); - - // Act - order.Fill(mock.Object); - - // Assert - Assert.True(order.IsFilled); - - The following example shows how to use the class - to specify conditions for arguments instead of specific values: - - // Arrange - var order = new Order(TALISKER, 50); - var mock = new Mock<IWarehouse>(); - - // shows how to expect a value within a range - mock.Setup(x => x.HasInventory( - It.IsAny<string>(), - It.IsInRange(0, 100, Range.Inclusive))) - .Returns(false); - - // shows how to throw for unexpected calls. - mock.Setup(x => x.Remove( - It.IsAny<string>(), - It.IsAny<int>())) - .Throws(new InvalidOperationException()); - - // Act - order.Fill(mock.Object); - - // Assert - Assert.False(order.IsFilled); - - - - - - Obsolete. - - - - - Obsolete. - - - - - Obsolete. - - - - - Obsolete. - - - - - Obsolete. - - - - - Ctor invoked by AsTInterface exclusively. - - - - - Initializes an instance of the mock with default behavior. - - var mock = new Mock<IFormatProvider>(); - - - - - Initializes an instance of the mock with default behavior and with - the given constructor arguments for the class. (Only valid when is a class) - - The mock will try to find the best match constructor given the constructor arguments, and invoke that - to initialize the instance. This applies only for classes, not interfaces. - - var mock = new Mock<MyProvider>(someArgument, 25); - Optional constructor arguments if the mocked type is a class. - - - - Initializes an instance of the mock with the specified behavior. - - var mock = new Mock<IFormatProvider>(MockBehavior.Relaxed); - Behavior of the mock. - - - - Initializes an instance of the mock with a specific behavior with - the given constructor arguments for the class. - - The mock will try to find the best match constructor given the constructor arguments, and invoke that - to initialize the instance. This applies only to classes, not interfaces. - - var mock = new Mock<MyProvider>(someArgument, 25); - Behavior of the mock.Optional constructor arguments if the mocked type is a class. - - - - Returns the mocked object value. - - - - - Specifies a setup on the mocked type for a call to - to a void method. - - If more than one setup is specified for the same method or property, - the latest one wins and is the one that will be executed. - Lambda expression that specifies the expected method invocation. - - var mock = new Mock<IProcessor>(); - mock.Setup(x => x.Execute("ping")); - - - - - - Specifies a setup on the mocked type for a call to - to a value returning method. - Type of the return value. Typically omitted as it can be inferred from the expression. - If more than one setup is specified for the same method or property, - the latest one wins and is the one that will be executed. - Lambda expression that specifies the method invocation. - - mock.Setup(x => x.HasInventory("Talisker", 50)).Returns(true); - - - - - - Specifies a setup on the mocked type for a call to - to a property getter. - - If more than one setup is set for the same property getter, - the latest one wins and is the one that will be executed. - Type of the property. Typically omitted as it can be inferred from the expression.Lambda expression that specifies the property getter. - - mock.SetupGet(x => x.Suspended) - .Returns(true); - - - - - - Specifies a setup on the mocked type for a call to - to a property setter. - - If more than one setup is set for the same property setter, - the latest one wins and is the one that will be executed. - - This overloads allows the use of a callback already - typed for the property type. - - Type of the property. Typically omitted as it can be inferred from the expression.The Lambda expression that sets a property to a value. - - mock.SetupSet(x => x.Suspended = true); - - - - - - Specifies a setup on the mocked type for a call to - to a property setter. - - If more than one setup is set for the same property setter, - the latest one wins and is the one that will be executed. - Lambda expression that sets a property to a value. - - mock.SetupSet(x => x.Suspended = true); - - - - - - Specifies that the given property should have "property behavior", - meaning that setting its value will cause it to be saved and - later returned when the property is requested. (this is also - known as "stubbing"). - - Type of the property, inferred from the property - expression (does not need to be specified). - Property expression to stub. - If you have an interface with an int property Value, you might - stub it using the following straightforward call: - - var mock = new Mock<IHaveValue>(); - mock.Stub(v => v.Value); - - After the Stub call has been issued, setting and - retrieving the object value will behave as expected: - - IHaveValue v = mock.Object; - - v.Value = 5; - Assert.Equal(5, v.Value); - - - - - - Specifies that the given property should have "property behavior", - meaning that setting its value will cause it to be saved and - later returned when the property is requested. This overload - allows setting the initial value for the property. (this is also - known as "stubbing"). - - Type of the property, inferred from the property - expression (does not need to be specified). - Property expression to stub.Initial value for the property. - If you have an interface with an int property Value, you might - stub it using the following straightforward call: - - var mock = new Mock<IHaveValue>(); - mock.SetupProperty(v => v.Value, 5); - - After the SetupProperty call has been issued, setting and - retrieving the object value will behave as expected: - - IHaveValue v = mock.Object; - // Initial value was stored - Assert.Equal(5, v.Value); - - // New value set which changes the initial value - v.Value = 6; - Assert.Equal(6, v.Value); - - - - - - Specifies that the all properties on the mock should have "property behavior", - meaning that setting its value will cause it to be saved and - later returned when the property is requested. (this is also - known as "stubbing"). The default value for each property will be the - one generated as specified by the property for the mock. - - If the mock is set to , - the mocked default values will also get all properties setup recursively. - - - - - - - - Verifies that a specific invocation matching the given expression was performed on the mock. Use - in conjuntion with the default . - - This example assumes that the mock has been used, and later we want to verify that a given - invocation with specific parameters was performed: - - var mock = new Mock<IProcessor>(); - // exercise mock - //... - // Will throw if the test code didn't call Execute with a "ping" string argument. - mock.Verify(proc => proc.Execute("ping")); - - The invocation was not performed on the mock.Expression to verify. - - - - Verifies that a specific invocation matching the given expression was performed on the mock. Use - in conjuntion with the default . - - The invocation was not call the times specified by - . - Expression to verify.The number of times a method is allowed to be called. - - - - Verifies that a specific invocation matching the given expression was performed on the mock, - specifying a failure error message. Use in conjuntion with the default - . - - This example assumes that the mock has been used, and later we want to verify that a given - invocation with specific parameters was performed: - - var mock = new Mock<IProcessor>(); - // exercise mock - //... - // Will throw if the test code didn't call Execute with a "ping" string argument. - mock.Verify(proc => proc.Execute("ping")); - - The invocation was not performed on the mock.Expression to verify.Message to show if verification fails. - - - - Verifies that a specific invocation matching the given expression was performed on the mock, - specifying a failure error message. Use in conjuntion with the default - . - - The invocation was not call the times specified by - . - Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails. - - - - Verifies that a specific invocation matching the given expression was performed on the mock. Use - in conjuntion with the default . - - This example assumes that the mock has been used, and later we want to verify that a given - invocation with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't call HasInventory. - mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50)); - - The invocation was not performed on the mock.Expression to verify.Type of return value from the expression. - - - - Verifies that a specific invocation matching the given - expression was performed on the mock. Use in conjuntion - with the default . - - The invocation was not call the times specified by - . - Expression to verify.The number of times a method is allowed to be called.Type of return value from the expression. - - - - Verifies that a specific invocation matching the given - expression was performed on the mock, specifying a failure - error message. - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't call HasInventory. - mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50), "When filling orders, inventory has to be checked"); - - The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.Type of return value from the expression. - - - - Verifies that a specific invocation matching the given - expression was performed on the mock, specifying a failure - error message. - - The invocation was not call the times specified by - . - Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails.Type of return value from the expression. - - - - Verifies that a property was read on the mock. - - This example assumes that the mock has been used, - and later we want to verify that a given property - was retrieved from it: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't retrieve the IsClosed property. - mock.VerifyGet(warehouse => warehouse.IsClosed); - - The invocation was not performed on the mock.Expression to verify. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - - Verifies that a property was read on the mock. - - The invocation was not call the times specified by - . - The number of times a method is allowed to be called.Expression to verify. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - - Verifies that a property was read on the mock, specifying a failure - error message. - - This example assumes that the mock has been used, - and later we want to verify that a given property - was retrieved from it: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't retrieve the IsClosed property. - mock.VerifyGet(warehouse => warehouse.IsClosed); - - The invocation was not performed on the mock.Expression to verify.Message to show if verification fails. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - - Verifies that a property was read on the mock, specifying a failure - error message. - - The invocation was not call the times specified by - . - The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - - Verifies that a property was set on the mock. - - This example assumes that the mock has been used, - and later we want to verify that a given property - was set on it: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed = true); - - The invocation was not performed on the mock.Expression to verify. - - - - Verifies that a property was set on the mock. - - The invocation was not call the times specified by - . - The number of times a method is allowed to be called.Expression to verify. - - - - Verifies that a property was set on the mock, specifying - a failure message. - - This example assumes that the mock has been used, - and later we want to verify that a given property - was set on it: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed = true, "Warehouse should always be closed after the action"); - - The invocation was not performed on the mock.Expression to verify.Message to show if verification fails. - - - - Verifies that a property was set on the mock, specifying - a failure message. - - The invocation was not call the times specified by - . - The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails. - - - - Raises the event referenced in using - the given argument. - - The argument is - invalid for the target event invocation, or the is - not an event attach or detach expression. - - The following example shows how to raise a event: - - var mock = new Mock<IViewModel>(); - - mock.Raise(x => x.PropertyChanged -= null, new PropertyChangedEventArgs("Name")); - - - This example shows how to invoke an event with a custom event arguments - class in a view that will cause its corresponding presenter to - react by changing its state: - - var mockView = new Mock<IOrdersView>(); - var presenter = new OrdersPresenter(mockView.Object); - - // Check that the presenter has no selection by default - Assert.Null(presenter.SelectedOrder); - - // Raise the event with a specific arguments data - mockView.Raise(v => v.SelectionChanged += null, new OrderEventArgs { Order = new Order("moq", 500) }); - - // Now the presenter reacted to the event, and we have a selected order - Assert.NotNull(presenter.SelectedOrder); - Assert.Equal("moq", presenter.SelectedOrder.ProductName); - - - - - - Raises the event referenced in using - the given argument for a non-EventHandler typed event. - - The arguments are - invalid for the target event invocation, or the is - not an event attach or detach expression. - - The following example shows how to raise a custom event that does not adhere to - the standard EventHandler: - - var mock = new Mock<IViewModel>(); - - mock.Raise(x => x.MyEvent -= null, "Name", bool, 25); - - - - - - Exposes the mocked object instance. - - - - - Provides legacy API members as extensions so that - existing code continues to compile, but new code - doesn't see then. - - - - - Obsolete. - - - - - Obsolete. - - - - - Obsolete. - - - - - Provides additional methods on mocks. - - - Provided as extension methods as they confuse the compiler - with the overloads taking Action. - - - - - Specifies a setup on the mocked type for a call to - to a property setter, regardless of its value. - - - If more than one setup is set for the same property setter, - the latest one wins and is the one that will be executed. - - Type of the property. Typically omitted as it can be inferred from the expression. - Type of the mock. - The target mock for the setup. - Lambda expression that specifies the property setter. - - - mock.SetupSet(x => x.Suspended); - - - - This method is not legacy, but must be on an extension method to avoid - confusing the compiler with the new Action syntax. - - - - - Verifies that a property has been set on the mock, regarless of its value. - - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed); - - - The invocation was not performed on the mock. - Expression to verify. - The mock instance. - Mocked type. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Verifies that a property has been set on the mock, specifying a failure - error message. - - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed); - - - The invocation was not performed on the mock. - Expression to verify. - Message to show if verification fails. - The mock instance. - Mocked type. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Verifies that a property has been set on the mock, regardless - of the value but only the specified number of times. - - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed); - - - The invocation was not performed on the mock. - The invocation was not call the times specified by - . - The mock instance. - Mocked type. - The number of times a method is allowed to be called. - Expression to verify. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Verifies that a property has been set on the mock, regardless - of the value but only the specified number of times, and specifying a failure - error message. - - - This example assumes that the mock has been used, - and later we want to verify that a given invocation - with specific parameters was performed: - - var mock = new Mock<IWarehouse>(); - // exercise mock - //... - // Will throw if the test code didn't set the IsClosed property. - mock.VerifySet(warehouse => warehouse.IsClosed); - - - The invocation was not performed on the mock. - The invocation was not call the times specified by - . - The mock instance. - Mocked type. - The number of times a method is allowed to be called. - Message to show if verification fails. - Expression to verify. - Type of the property to verify. Typically omitted as it can - be inferred from the expression's return type. - - - - Helper for sequencing return values in the same method. - - - - - Return a sequence of values, once per call. - - - - - Casts the expression to a lambda expression, removing - a cast if there's any. - - - - - Casts the body of the lambda expression to a . - - If the body is not a method call. - - - - Converts the body of the lambda expression into the referenced by it. - - - - - Checks whether the body of the lambda expression is a property access. - - - - - Checks whether the expression is a property access. - - - - - Checks whether the body of the lambda expression is a property indexer, which is true - when the expression is an whose - has - equal to . - - - - - Checks whether the expression is a property indexer, which is true - when the expression is an whose - has - equal to . - - - - - Creates an expression that casts the given expression to the - type. - - - - - TODO: remove this code when https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=331583 - is fixed. - - - - - Provides partial evaluation of subtrees, whenever they can be evaluated locally. - - Matt Warren: http://blogs.msdn.com/mattwar - Documented by InSTEDD: http://www.instedd.org - - - - Performs evaluation and replacement of independent sub-trees - - The root of the expression tree. - A function that decides whether a given expression - node can be part of the local function. - A new tree with sub-trees evaluated and replaced. - - - - Performs evaluation and replacement of independent sub-trees - - The root of the expression tree. - A new tree with sub-trees evaluated and replaced. - - - - Evaluates and replaces sub-trees when first candidate is reached (top-down) - - - - - Performs bottom-up analysis to determine which nodes can possibly - be part of an evaluated sub-tree. - - - - - Ensures the given is not null. - Throws otherwise. - - - - - Ensures the given string is not null or empty. - Throws in the first case, or - in the latter. - - - - - Checks an argument to ensure it is in the specified range including the edges. - - Type of the argument to check, it must be an type. - - The expression containing the name of the argument. - The argument value to check. - The minimun allowed value for the argument. - The maximun allowed value for the argument. - - - - Checks an argument to ensure it is in the specified range excluding the edges. - - Type of the argument to check, it must be an type. - - The expression containing the name of the argument. - The argument value to check. - The minimun allowed value for the argument. - The maximun allowed value for the argument. - - - - Implemented by all generated mock object instances. - - - - - Implemented by all generated mock object instances. - - - - - Reference the Mock that contains this as the mock.Object value. - - - - - Reference the Mock that contains this as the mock.Object value. - - - - - Implements the actual interception and method invocation for - all mocks. - - - - - Get an eventInfo for a given event name. Search type ancestors depth first if necessary. - - Name of the event, with the set_ or get_ prefix already removed - - - - Given a type return all of its ancestors, both types and interfaces. - - The type to find immediate ancestors of - - - - Implements the fluent API. - - - - - Defines the Callback verb for property setter setups. - - Type of the property. - - - - Specifies a callback to invoke when the property is set that receives the - property value being set. - - Callback method to invoke. - - Invokes the given callback with the property value being set. - - mock.SetupSet(x => x.Suspended) - .Callback((bool state) => Console.WriteLine(state)); - - - - - - Allows the specification of a matching condition for an - argument in a method invocation, rather than a specific - argument value. "It" refers to the argument being matched. - - This class allows the setup to match a method invocation - with an arbitrary value, with a value in a specified range, or - even one that matches a given predicate. - - - - - Matches any value of the given type. - - Typically used when the actual argument value for a method - call is not relevant. - - - // Throws an exception for a call to Remove with any string value. - mock.Setup(x => x.Remove(It.IsAny<string>())).Throws(new InvalidOperationException()); - - Type of the value. - - - - Matches any value that satisfies the given predicate. - Type of the argument to check.The predicate used to match the method argument. - Allows the specification of a predicate to perform matching - of method call arguments. - - This example shows how to return the value 1 whenever the argument to the - Do method is an even number. - - mock.Setup(x => x.Do(It.Is<int>(i => i % 2 == 0))) - .Returns(1); - - This example shows how to throw an exception if the argument to the - method is a negative number: - - mock.Setup(x => x.GetUser(It.Is<int>(i => i < 0))) - .Throws(new ArgumentException()); - - - - - - Matches any value that is in the range specified. - Type of the argument to check.The lower bound of the range.The upper bound of the range. - The kind of range. See . - - The following example shows how to expect a method call - with an integer argument within the 0..100 range. - - mock.Setup(x => x.HasInventory( - It.IsAny<string>(), - It.IsInRange(0, 100, Range.Inclusive))) - .Returns(false); - - - - - - Matches a string argument if it matches the given regular expression pattern. - The pattern to use to match the string argument value. - The following example shows how to expect a call to a method where the - string argument matches the given regular expression: - - mock.Setup(x => x.Check(It.IsRegex("[a-z]+"))).Returns(1); - - - - - - Matches a string argument if it matches the given regular expression pattern. - The pattern to use to match the string argument value.The options used to interpret the pattern. - The following example shows how to expect a call to a method where the - string argument matches the given regular expression, in a case insensitive way: - - mock.Setup(x => x.Check(It.IsRegex("[a-z]+", RegexOptions.IgnoreCase))).Returns(1); - - - - - - Matcher to treat static functions as matchers. - - mock.Setup(x => x.StringMethod(A.MagicString())); - - public static class A - { - [Matcher] - public static string MagicString() { return null; } - public static bool MagicString(string arg) - { - return arg == "magic"; - } - } - - Will succeed if: mock.Object.StringMethod("magic"); - and fail with any other call. - - - - - Options to customize the behavior of the mock. - - - - - Causes the mock to always throw - an exception for invocations that don't have a - corresponding setup. - - - - - Will never throw exceptions, returning default - values when necessary (null for reference types, - zero for value types or empty enumerables and arrays). - - - - - Default mock behavior, which equals . - - - - - Exception thrown by mocks when setups are not matched, - the mock is not properly setup, etc. - - - A distinct exception type is provided so that exceptions - thrown by the mock can be differentiated in tests that - expect other exceptions to be thrown (i.e. ArgumentException). - - Richer exception hierarchy/types are not provided as - tests typically should not catch or expect exceptions - from the mocks. These are typically the result of changes - in the tested class or its collaborators implementation, and - result in fixes in the mock setup so that they dissapear and - allow the test to pass. - - - - - - Supports the serialization infrastructure. - - Serialization information. - Streaming context. - - - - Supports the serialization infrastructure. - - Serialization information. - Streaming context. - - - - Made internal as it's of no use for - consumers, but it's important for - our own tests. - - - - - Used by the mock factory to accumulate verification - failures. - - - - - Supports the serialization infrastructure. - - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - - Returns the cached ResourceManager instance used by this class. - - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - - Looks up a localized string similar to Mock type has already been initialized by accessing its Object property. Adding interfaces must be done before that.. - - - - - Looks up a localized string similar to Value cannot be an empty string.. - - - - - Looks up a localized string similar to Can only add interfaces to the mock.. - - - - - Looks up a localized string similar to Can't set return value for void method {0}.. - - - - - Looks up a localized string similar to Constructor arguments cannot be passed for interface mocks.. - - - - - Looks up a localized string similar to A matching constructor for the given arguments was not found on the mocked type.. - - - - - Looks up a localized string similar to Could not locate event for attach or detach method {0}.. - - - - - Looks up a localized string similar to Expression {0} involves a field access, which is not supported. Use properties instead.. - - - - - Looks up a localized string similar to Type to mock must be an interface or an abstract or non-sealed class. . - - - - - Looks up a localized string similar to Cannot retrieve a mock with the given object type {0} as it's not the main type of the mock or any of its additional interfaces. - Please cast the argument to one of the supported types: {1}. - Remember that there's no generics covariance in the CLR, so your object must be one of these types in order for the call to succeed.. - - - - - Looks up a localized string similar to The equals ("==" or "=" in VB) and the conditional 'and' ("&&" or "AndAlso" in VB) operators are the only ones supported in the query specification expression. Unsupported expression: {0}. - - - - - Looks up a localized string similar to LINQ method '{0}' not supported.. - - - - - Looks up a localized string similar to Expression contains a call to a method which is not virtual (overridable in VB) or abstract. Unsupported expression: {0}. - - - - - Looks up a localized string similar to Member {0}.{1} does not exist.. - - - - - Looks up a localized string similar to Method {0}.{1} is public. Use strong-typed Expect overload instead: - mock.Setup(x => x.{1}()); - . - - - - - Looks up a localized string similar to {0} invocation failed with mock behavior {1}. - {2}. - - - - - Looks up a localized string similar to Expected only {0} calls to {1}.. - - - - - Looks up a localized string similar to Expected only one call to {0}.. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock at least {2} times, but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock at least once, but was never performed: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock at most {3} times, but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock at most once, but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock between {2} and {3} times (Exclusive), but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock between {2} and {3} times (Inclusive), but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock exactly {2} times, but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock should never have been performed, but was {4} times: {1}. - - - - - Looks up a localized string similar to {0} - Expected invocation on the mock once, but was {4} times: {1}. - - - - - Looks up a localized string similar to All invocations on the mock must have a corresponding setup.. - - - - - Looks up a localized string similar to Object instance was not created by Moq.. - - - - - Looks up a localized string similar to Out expression must evaluate to a constant value.. - - - - - Looks up a localized string similar to Property {0}.{1} does not have a getter.. - - - - - Looks up a localized string similar to Property {0}.{1} does not exist.. - - - - - Looks up a localized string similar to Property {0}.{1} is write-only.. - - - - - Looks up a localized string similar to Property {0}.{1} is read-only.. - - - - - Looks up a localized string similar to Property {0}.{1} does not have a setter.. - - - - - Looks up a localized string similar to Cannot raise a mocked event unless it has been associated (attached) to a concrete event in a mocked object.. - - - - - Looks up a localized string similar to Ref expression must evaluate to a constant value.. - - - - - Looks up a localized string similar to Invocation needs to return a value and therefore must have a corresponding setup that provides it.. - - - - - Looks up a localized string similar to A lambda expression is expected as the argument to It.Is<T>.. - - - - - Looks up a localized string similar to Invocation {0} should not have been made.. - - - - - Looks up a localized string similar to Expression is not a method invocation: {0}. - - - - - Looks up a localized string similar to Expression is not a property access: {0}. - - - - - Looks up a localized string similar to Expression is not a property setter invocation.. - - - - - Looks up a localized string similar to Expression references a method that does not belong to the mocked object: {0}. - - - - - Looks up a localized string similar to Invalid setup on a non-virtual (overridable in VB) member: {0}. - - - - - Looks up a localized string similar to Type {0} does not implement required interface {1}. - - - - - Looks up a localized string similar to Type {0} does not from required type {1}. - - - - - Looks up a localized string similar to To specify a setup for public property {0}.{1}, use the typed overloads, such as: - mock.Setup(x => x.{1}).Returns(value); - mock.SetupGet(x => x.{1}).Returns(value); //equivalent to previous one - mock.SetupSet(x => x.{1}).Callback(callbackDelegate); - . - - - - - Looks up a localized string similar to Unsupported expression: {0}. - - - - - Looks up a localized string similar to Only property accesses are supported in intermediate invocations on a setup. Unsupported expression {0}.. - - - - - Looks up a localized string similar to Expression contains intermediate property access {0}.{1} which is of type {2} and cannot be mocked. Unsupported expression {3}.. - - - - - Looks up a localized string similar to Setter expression cannot use argument matchers that receive parameters.. - - - - - Looks up a localized string similar to Member {0} is not supported for protected mocking.. - - - - - Looks up a localized string similar to Setter expression can only use static custom matchers.. - - - - - Looks up a localized string similar to The following setups were not matched: - {0}. - - - - - Looks up a localized string similar to Invalid verify on a non-virtual (overridable in VB) member: {0}. - - - - - Allows setups to be specified for protected members by using their - name as a string, rather than strong-typing them which is not possible - due to their visibility. - - - - - Specifies a setup for a void method invocation with the given - , optionally specifying arguments for the method call. - - The name of the void method to be invoked. - The optional arguments for the invocation. If argument matchers are used, - remember to use rather than . - - - - Specifies a setup for an invocation on a property or a non void method with the given - , optionally specifying arguments for the method call. - - The name of the method or property to be invoked. - The optional arguments for the invocation. If argument matchers are used, - remember to use rather than . - The return type of the method or property. - - - - Specifies a setup for an invocation on a property getter with the given - . - - The name of the property. - The type of the property. - - - - Specifies a setup for an invocation on a property setter with the given - . - - The name of the property. - The property value. If argument matchers are used, - remember to use rather than . - The type of the property. - - - - Specifies a verify for a void method with the given , - optionally specifying arguments for the method call. Use in conjuntion with the default - . - - The invocation was not call the times specified by - . - The name of the void method to be verified. - The number of times a method is allowed to be called. - The optional arguments for the invocation. If argument matchers are used, - remember to use rather than . - - - - Specifies a verify for an invocation on a property or a non void method with the given - , optionally specifying arguments for the method call. - - The invocation was not call the times specified by - . - The name of the method or property to be invoked. - The optional arguments for the invocation. If argument matchers are used, - remember to use rather than . - The number of times a method is allowed to be called. - The type of return value from the expression. - - - - Specifies a verify for an invocation on a property getter with the given - . - The invocation was not call the times specified by - . - - The name of the property. - The number of times a method is allowed to be called. - The type of the property. - - - - Specifies a setup for an invocation on a property setter with the given - . - - The invocation was not call the times specified by - . - The name of the property. - The number of times a method is allowed to be called. - The property value. - The type of the property. If argument matchers are used, - remember to use rather than . - - - - Allows the specification of a matching condition for an - argument in a protected member setup, rather than a specific - argument value. "ItExpr" refers to the argument being matched. - - - Use this variant of argument matching instead of - for protected setups. - This class allows the setup to match a method invocation - with an arbitrary value, with a value in a specified range, or - even one that matches a given predicate, or null. - - - - - Matches a null value of the given type. - - - Required for protected mocks as the null value cannot be used - directly as it prevents proper method overload selection. - - - - // Throws an exception for a call to Remove with a null string value. - mock.Protected() - .Setup("Remove", ItExpr.IsNull<string>()) - .Throws(new InvalidOperationException()); - - - Type of the value. - - - - Matches any value of the given type. - - - Typically used when the actual argument value for a method - call is not relevant. - - - - // Throws an exception for a call to Remove with any string value. - mock.Protected() - .Setup("Remove", ItExpr.IsAny<string>()) - .Throws(new InvalidOperationException()); - - - Type of the value. - - - - Matches any value that satisfies the given predicate. - - Type of the argument to check. - The predicate used to match the method argument. - - Allows the specification of a predicate to perform matching - of method call arguments. - - - This example shows how to return the value 1 whenever the argument to the - Do method is an even number. - - mock.Protected() - .Setup("Do", ItExpr.Is<int>(i => i % 2 == 0)) - .Returns(1); - - This example shows how to throw an exception if the argument to the - method is a negative number: - - mock.Protected() - .Setup("GetUser", ItExpr.Is<int>(i => i < 0)) - .Throws(new ArgumentException()); - - - - - - Matches any value that is in the range specified. - - Type of the argument to check. - The lower bound of the range. - The upper bound of the range. - The kind of range. See . - - The following example shows how to expect a method call - with an integer argument within the 0..100 range. - - mock.Protected() - .Setup("HasInventory", - ItExpr.IsAny<string>(), - ItExpr.IsInRange(0, 100, Range.Inclusive)) - .Returns(false); - - - - - - Matches a string argument if it matches the given regular expression pattern. - - The pattern to use to match the string argument value. - - The following example shows how to expect a call to a method where the - string argument matches the given regular expression: - - mock.Protected() - .Setup("Check", ItExpr.IsRegex("[a-z]+")) - .Returns(1); - - - - - - Matches a string argument if it matches the given regular expression pattern. - - The pattern to use to match the string argument value. - The options used to interpret the pattern. - - The following example shows how to expect a call to a method where the - string argument matches the given regular expression, in a case insensitive way: - - mock.Protected() - .Setup("Check", ItExpr.IsRegex("[a-z]+", RegexOptions.IgnoreCase)) - .Returns(1); - - - - - - Enables the Protected() method on , - allowing setups to be set for protected members by using their - name as a string, rather than strong-typing them which is not possible - due to their visibility. - - - - - Enable protected setups for the mock. - - Mocked object type. Typically omitted as it can be inferred from the mock instance. - The mock to set the protected setups on. - - - - - - - - - - - - Kind of range to use in a filter specified through - . - - - - - The range includes the to and - from values. - - - - - The range does not include the to and - from values. - - - - - Determines the way default values are generated - calculated for loose mocks. - - - - - Default behavior, which generates empty values for - value types (i.e. default(int)), empty array and - enumerables, and nulls for all other reference types. - - - - - Whenever the default value generated by - is null, replaces this value with a mock (if the type - can be mocked). - - - For sealed classes, a null value will be generated. - - - - - A default implementation of IQueryable for use with QueryProvider - - - - - The is a - static method that returns an IQueryable of Mocks of T which is used to - apply the linq specification to. - - - - - Allows creation custom value matchers that can be used on setups and verification, - completely replacing the built-in class with your own argument - matching rules. - - See also . - - - - - Provided for the sole purpose of rendering the delegate passed to the - matcher constructor if no friendly render lambda is provided. - - - - - Initializes the match with the condition that - will be checked in order to match invocation - values. - The condition to match against actual values. - - - - - - - - - This method is used to set an expression as the last matcher invoked, - which is used in the SetupSet to allow matchers in the prop = value - delegate expression. This delegate is executed in "fluent" mode in - order to capture the value being set, and construct the corresponding - methodcall. - This is also used in the MatcherFactory for each argument expression. - This method ensures that when we execute the delegate, we - also track the matcher that was invoked, so that when we create the - methodcall we build the expression using it, rather than the null/default - value returned from the actual invocation. - - - - - Allows creation custom value matchers that can be used on setups and verification, - completely replacing the built-in class with your own argument - matching rules. - Type of the value to match. - The argument matching is used to determine whether a concrete - invocation in the mock matches a given setup. This - matching mechanism is fully extensible. - - Creating a custom matcher is straightforward. You just need to create a method - that returns a value from a call to with - your matching condition and optional friendly render expression: - - [Matcher] - public Order IsBigOrder() - { - return Match<Order>.Create( - o => o.GrandTotal >= 5000, - /* a friendly expression to render on failures */ - () => IsBigOrder()); - } - - This method can be used in any mock setup invocation: - - mock.Setup(m => m.Submit(IsBigOrder()).Throws<UnauthorizedAccessException>(); - - At runtime, Moq knows that the return value was a matcher (note that the method MUST be - annotated with the [Matcher] attribute in order to determine this) and - evaluates your predicate with the actual value passed into your predicate. - - Another example might be a case where you want to match a lists of orders - that contains a particular one. You might create matcher like the following: - - - public static class Orders - { - [Matcher] - public static IEnumerable<Order> Contains(Order order) - { - return Match<IEnumerable<Order>>.Create(orders => orders.Contains(order)); - } - } - - Now we can invoke this static method instead of an argument in an - invocation: - - var order = new Order { ... }; - var mock = new Mock<IRepository<Order>>(); - - mock.Setup(x => x.Save(Orders.Contains(order))) - .Throws<ArgumentException>(); - - - - - - Tracks the current mock and interception context. - - - - - Having an active fluent mock context means that the invocation - is being performed in "trial" mode, just to gather the - target method and arguments that need to be matched later - when the actual invocation is made. - - - - - A that returns an empty default value - for non-mockeable types, and mocks for all other types (interfaces and - non-sealed classes) that can be mocked. - - - - - Allows querying the universe of mocks for those that behave - according to the LINQ query specification. - - - This entry-point into Linq to Mocks is the only one in the root Moq - namespace to ease discovery. But to get all the mocking extension - methods on Object, a using of Moq.Linq must be done, so that the - polluting of the intellisense for all objects is an explicit opt-in. - - - - - Access the universe of mocks of the given type, to retrieve those - that behave according to the LINQ query specification. - - The type of the mocked object to query. - - - - Access the universe of mocks of the given type, to retrieve those - that behave according to the LINQ query specification. - - The predicate with the setup expressions. - The type of the mocked object to query. - - - - Creates an mock object of the indicated type. - - The type of the mocked object. - The mocked object created. - - - - Creates an mock object of the indicated type. - - The predicate with the setup expressions. - The type of the mocked object. - The mocked object created. - - - - Creates the mock query with the underlying queriable implementation. - - - - - Wraps the enumerator inside a queryable. - - - - - Method that is turned into the actual call from .Query{T}, to - transform the queryable query into a normal enumerable query. - This method is never used directly by consumers. - - - - - Extension method used to support Linq-like setup properties that are not virtual but do have - a getter and a setter, thereby allowing the use of Linq to Mocks to quickly initialize Dtos too :) - - - - - Helper extensions that are used by the query translator. - - - - - Retrieves a fluent mock from the given setup expression. - - - - - Defines the number of invocations allowed by a mocked method. - - - - - Specifies that a mocked method should be invoked times as minimum. - The minimun number of times.An object defining the allowed number of invocations. - - - - Specifies that a mocked method should be invoked one time as minimum. - An object defining the allowed number of invocations. - - - - Specifies that a mocked method should be invoked time as maximun. - The maximun number of times.An object defining the allowed number of invocations. - - - - Specifies that a mocked method should be invoked one time as maximun. - An object defining the allowed number of invocations. - - - - Specifies that a mocked method should be invoked between and - times. - The minimun number of times.The maximun number of times. - The kind of range. See . - An object defining the allowed number of invocations. - - - - Specifies that a mocked method should be invoked exactly times. - The times that a method or property can be called.An object defining the allowed number of invocations. - - - - Specifies that a mocked method should not be invoked. - An object defining the allowed number of invocations. - - - - Specifies that a mocked method should be invoked exactly one time. - An object defining the allowed number of invocations. - - - - Determines whether the specified is equal to this instance. - - The to compare with this instance. - - true if the specified is equal to this instance; otherwise, false. - - - - - Returns a hash code for this instance. - - A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. - - - - - Determines whether two specified objects have the same value. - - The first . - - The second . - - true if the value of left is the same as the value of right; otherwise, false. - - - - - Determines whether two specified objects have different values. - - The first . - - The second . - - true if the value of left is different from the value of right; otherwise, false. - - - - diff --git a/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.Test.dll b/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.Test.dll deleted file mode 100644 index 5c505e8..0000000 Binary files a/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.Test.dll and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.Test.dll.VisualState.xml b/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.Test.dll.VisualState.xml deleted file mode 100644 index c29d62f..0000000 --- a/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.Test.dll.VisualState.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - [0-1069]C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\Mvc.Mailer.Test.dll - [0-1035]Mvc.Mailer.Test.UrlHelperExtensionsTest.Abs_with_config_should_not_double_slash_when_using_the_base_url_from_the_config - false - - - - - - - - - - \ No newline at end of file diff --git a/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.Test.pdb b/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.Test.pdb deleted file mode 100644 index 878fbaf..0000000 Binary files a/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.Test.pdb and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.dll b/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.dll deleted file mode 100644 index 51a30ec..0000000 Binary files a/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.dll and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.pdb b/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.pdb deleted file mode 100644 index dfce701..0000000 Binary files a/Mvc.Mailer.Test/bin/Release/Mvc.Mailer.pdb and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Release/TestResult.xml b/Mvc.Mailer.Test/bin/Release/TestResult.xml deleted file mode 100644 index 5a1ad34..0000000 --- a/Mvc.Mailer.Test/bin/Release/TestResult.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Mvc.Mailer.Test/bin/Release/content/Views/web.config.transform b/Mvc.Mailer.Test/bin/Release/content/Views/web.config.transform deleted file mode 100644 index be4c33d..0000000 --- a/Mvc.Mailer.Test/bin/Release/content/Views/web.config.transform +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/Mvc.Mailer.Test/bin/Release/content/web.config.transform b/Mvc.Mailer.Test/bin/Release/content/web.config.transform deleted file mode 100644 index 8429770..0000000 --- a/Mvc.Mailer.Test/bin/Release/content/web.config.transform +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Mvc.Mailer.Test/bin/Release/nunit.framework.dll b/Mvc.Mailer.Test/bin/Release/nunit.framework.dll deleted file mode 100644 index 875e098..0000000 Binary files a/Mvc.Mailer.Test/bin/Release/nunit.framework.dll and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Release/nunit.framework.xml b/Mvc.Mailer.Test/bin/Release/nunit.framework.xml deleted file mode 100644 index 1cccec3..0000000 --- a/Mvc.Mailer.Test/bin/Release/nunit.framework.xml +++ /dev/null @@ -1,10385 +0,0 @@ - - - - nunit.framework - - - - - Attribute used to apply a category to a test - - - - - The name of the category - - - - - Construct attribute for a given category based on - a name. The name may not contain the characters ',', - '+', '-' or '!'. However, this is not checked in the - constructor since it would cause an error to arise at - as the test was loaded without giving a clear indication - of where the problem is located. The error is handled - in NUnitFramework.cs by marking the test as not - runnable. - - The name of the category - - - - Protected constructor uses the Type name as the name - of the category. - - - - - The name of the category - - - - - Used to mark a field for use as a datapoint when executing a theory - within the same fixture that requires an argument of the field's Type. - - - - - Used to mark an array as containing a set of datapoints to be used - executing a theory within the same fixture that requires an argument - of the Type of the array elements. - - - - - Attribute used to provide descriptive text about a - test case or fixture. - - - - - Construct the attribute - - Text describing the test - - - - Gets the test description - - - - - Enumeration indicating how the expected message parameter is to be used - - - - Expect an exact match - - - Expect a message containing the parameter string - - - Match the regular expression provided as a parameter - - - Expect a message that starts with the parameter string - - - - ExpectedExceptionAttribute - - - - - - Constructor for a non-specific exception - - - - - Constructor for a given type of exception - - The type of the expected exception - - - - Constructor for a given exception name - - The full name of the expected exception - - - - Gets or sets the expected exception type - - - - - Gets or sets the full Type name of the expected exception - - - - - Gets or sets the expected message text - - - - - Gets or sets the user message displayed in case of failure - - - - - Gets or sets the type of match to be performed on the expected message - - - - - Gets the name of a method to be used as an exception handler - - - - - ExplicitAttribute marks a test or test fixture so that it will - only be run if explicitly executed from the gui or command line - or if it is included by use of a filter. The test will not be - run simply because an enclosing suite is run. - - - - - Default constructor - - - - - Constructor with a reason - - The reason test is marked explicit - - - - The reason test is marked explicit - - - - - Attribute used to mark a test that is to be ignored. - Ignored tests result in a warning message when the - tests are run. - - - - - Constructs the attribute without giving a reason - for ignoring the test. - - - - - Constructs the attribute giving a reason for ignoring the test - - The reason for ignoring the test - - - - The reason for ignoring a test - - - - - Abstract base for Attributes that are used to include tests - in the test run based on environmental settings. - - - - - Constructor with no included items specified, for use - with named property syntax. - - - - - Constructor taking one or more included items - - Comma-delimited list of included items - - - - Name of the item that is needed in order for - a test to run. Multiple itemss may be given, - separated by a comma. - - - - - Name of the item to be excluded. Multiple items - may be given, separated by a comma. - - - - - The reason for including or excluding the test - - - - - PlatformAttribute is used to mark a test fixture or an - individual method as applying to a particular platform only. - - - - - Constructor with no platforms specified, for use - with named property syntax. - - - - - Constructor taking one or more platforms - - Comma-deliminted list of platforms - - - - CultureAttribute is used to mark a test fixture or an - individual method as applying to a particular Culture only. - - - - - Constructor with no cultures specified, for use - with named property syntax. - - - - - Constructor taking one or more cultures - - Comma-deliminted list of cultures - - - - Marks a test to use a combinatorial join of any argument data - provided. NUnit will create a test case for every combination of - the arguments provided. This can result in a large number of test - cases and so should be used judiciously. This is the default join - type, so the attribute need not be used except as documentation. - - - - - PropertyAttribute is used to attach information to a test as a name/value pair.. - - - - - Construct a PropertyAttribute with a name and string value - - The name of the property - The property value - - - - Construct a PropertyAttribute with a name and int value - - The name of the property - The property value - - - - Construct a PropertyAttribute with a name and double value - - The name of the property - The property value - - - - Constructor for derived classes that set the - property dictionary directly. - - - - - Constructor for use by derived classes that use the - name of the type as the property name. Derived classes - must ensure that the Type of the property value is - a standard type supported by the BCL. Any custom - types will cause a serialization Exception when - in the client. - - - - - Gets the property dictionary for this attribute - - - - - Default constructor - - - - - Marks a test to use pairwise join of any argument data provided. - NUnit will attempt too excercise every pair of argument values at - least once, using as small a number of test cases as it can. With - only two arguments, this is the same as a combinatorial join. - - - - - Default constructor - - - - - Marks a test to use a sequential join of any argument data - provided. NUnit will use arguements for each parameter in - sequence, generating test cases up to the largest number - of argument values provided and using null for any arguments - for which it runs out of values. Normally, this should be - used with the same number of arguments for each parameter. - - - - - Default constructor - - - - - Summary description for MaxTimeAttribute. - - - - - Construct a MaxTimeAttribute, given a time in milliseconds. - - The maximum elapsed time in milliseconds - - - - RandomAttribute is used to supply a set of random values - to a single parameter of a parameterized test. - - - - - ValuesAttribute is used to provide literal arguments for - an individual parameter of a test. - - - - - Abstract base class for attributes that apply to parameters - and supply data for the parameter. - - - - - Gets the data to be provided to the specified parameter - - - - - The collection of data to be returned. Must - be set by any derived attribute classes. - We use an object[] so that the individual - elements may have their type changed in GetData - if necessary. - - - - - Construct with one argument - - - - - - Construct with two arguments - - - - - - - Construct with three arguments - - - - - - - - Construct with an array of arguments - - - - - - Get the collection of values to be used as arguments - - - - - Construct a set of doubles from 0.0 to 1.0, - specifying only the count. - - - - - - Construct a set of doubles from min to max - - - - - - - - Construct a set of ints from min to max - - - - - - - - Get the collection of values to be used as arguments - - - - - RangeAttribute is used to supply a range of values to an - individual parameter of a parameterized test. - - - - - Construct a range of ints using default step of 1 - - - - - - - Construct a range of ints specifying the step size - - - - - - - - Construct a range of longs - - - - - - - - Construct a range of doubles - - - - - - - - Construct a range of floats - - - - - - - - RepeatAttribute may be applied to test case in order - to run it multiple times. - - - - - Construct a RepeatAttribute - - The number of times to run the test - - - - RequiredAddinAttribute may be used to indicate the names of any addins - that must be present in order to run some or all of the tests in an - assembly. If the addin is not loaded, the entire assembly is marked - as NotRunnable. - - - - - Initializes a new instance of the class. - - The required addin. - - - - Gets the name of required addin. - - The required addin name. - - - - Summary description for SetCultureAttribute. - - - - - Construct given the name of a culture - - - - - - Summary description for SetUICultureAttribute. - - - - - Construct given the name of a culture - - - - - - Attribute used to mark a class that contains one-time SetUp - and/or TearDown methods that apply to all the tests in a - namespace or an assembly. - - - - - SetUpFixtureAttribute is used to identify a SetUpFixture - - - - - Attribute used to mark a static (shared in VB) property - that returns a list of tests. - - - - - Attribute used to identify a method that is called - immediately after each test is run. The method is - guaranteed to be called, even if an exception is thrown. - - - - - Adding this attribute to a method within a - class makes the method callable from the NUnit test runner. There is a property - called Description which is optional which you can provide a more detailed test - description. This class cannot be inherited. - - - - [TestFixture] - public class Fixture - { - [Test] - public void MethodToTest() - {} - - [Test(Description = "more detailed description")] - publc void TestDescriptionMethod() - {} - } - - - - - - Descriptive text for this test - - - - - TestCaseAttribute is used to mark parameterized test cases - and provide them with their arguments. - - - - - The ITestCaseData interface is implemented by a class - that is able to return complete testcases for use by - a parameterized test method. - - NOTE: This interface is used in both the framework - and the core, even though that results in two different - types. However, sharing the source code guarantees that - the various implementations will be compatible and that - the core is able to reflect successfully over the - framework implementations of ITestCaseData. - - - - - Gets the argument list to be provided to the test - - - - - Gets the expected result - - - - - Gets the expected exception Type - - - - - Gets the FullName of the expected exception - - - - - Gets the name to be used for the test - - - - - Gets the description of the test - - - - - Gets a value indicating whether this is ignored. - - true if ignored; otherwise, false. - - - - Gets the ignore reason. - - The ignore reason. - - - - Construct a TestCaseAttribute with a list of arguments. - This constructor is not CLS-Compliant - - - - - - Construct a TestCaseAttribute with a single argument - - - - - - Construct a TestCaseAttribute with a two arguments - - - - - - - Construct a TestCaseAttribute with a three arguments - - - - - - - - Gets the list of arguments to a test case - - - - - Gets or sets the expected result. - - The result. - - - - Gets or sets the expected exception. - - The expected exception. - - - - Gets or sets the name the expected exception. - - The expected name of the exception. - - - - Gets or sets the expected message of the expected exception - - The expected message of the exception. - - - - Gets or sets the type of match to be performed on the expected message - - - - - Gets or sets the description. - - The description. - - - - Gets or sets the name of the test. - - The name of the test. - - - - Gets or sets the ignored status of the test - - - - - Gets or sets the ignored status of the test - - - - - Gets the ignore reason. - - The ignore reason. - - - - FactoryAttribute indicates the source to be used to - provide test cases for a test method. - - - - - Construct with the name of the factory - for use with languages - that don't support params arrays. - - An array of the names of the factories that will provide data - - - - Construct with a Type and name - for use with languages - that don't support params arrays. - - The Type that will provide data - The name of the method, property or field that will provide data - - - - The name of a the method, property or fiend to be used as a source - - - - - A Type to be used as a source - - - - - [TestFixture] - public class ExampleClass - {} - - - - - Default constructor - - - - - Construct with a object[] representing a set of arguments. - In .NET 2.0, the arguments may later be separated into - type arguments and constructor arguments. - - - - - - Descriptive text for this fixture - - - - - The arguments originally provided to the attribute - - - - - Gets or sets a value indicating whether this should be ignored. - - true if ignore; otherwise, false. - - - - Gets or sets the ignore reason. May set Ignored as a side effect. - - The ignore reason. - - - - Get or set the type arguments. If not set - explicitly, any leading arguments that are - Types are taken as type arguments. - - - - - Attribute used to identify a method that is - called before any tests in a fixture are run. - - - - - Attribute used to identify a method that is called after - all the tests in a fixture have run. The method is - guaranteed to be called, even if an exception is thrown. - - - - - Adding this attribute to a method within a - class makes the method callable from the NUnit test runner. There is a property - called Description which is optional which you can provide a more detailed test - description. This class cannot be inherited. - - - - [TestFixture] - public class Fixture - { - [Test] - public void MethodToTest() - {} - - [Test(Description = "more detailed description")] - publc void TestDescriptionMethod() - {} - } - - - - - - WUsed on a method, marks the test with a timeout value in milliseconds. - The test will be run in a separate thread and is cancelled if the timeout - is exceeded. Used on a method or assembly, sets the default timeout - for all contained test methods. - - - - - Construct a TimeoutAttribute given a time in milliseconds - - The timeout value in milliseconds - - - - Marks a test that must run in the STA, causing it - to run in a separate thread if necessary. - - On methods, you may also use STAThreadAttribute - to serve the same purpose. - - - - - Construct a RequiresSTAAttribute - - - - - Marks a test that must run in the MTA, causing it - to run in a separate thread if necessary. - - On methods, you may also use MTAThreadAttribute - to serve the same purpose. - - - - - Construct a RequiresMTAAttribute - - - - - Marks a test that must run on a separate thread. - - - - - Construct a RequiresThreadAttribute - - - - - Construct a RequiresThreadAttribute, specifying the apartment - - - - - ValueSourceAttribute indicates the source to be used to - provide data for one parameter of a test method. - - - - - Construct with the name of the factory - for use with languages - that don't support params arrays. - - The name of the data source to be used - - - - Construct with a Type and name - for use with languages - that don't support params arrays. - - The Type that will provide data - The name of the method, property or field that will provide data - - - - The name of a the method, property or fiend to be used as a source - - - - - A Type to be used as a source - - - - - AttributeExistsConstraint tests for the presence of a - specified attribute on a Type. - - - - - The Constraint class is the base of all built-in constraints - within NUnit. It provides the operator overloads used to combine - constraints. - - - - - The IConstraintExpression interface is implemented by all - complete and resolvable constraints and expressions. - - - - - Return the top-level constraint for this expression - - - - - - Static UnsetObject used to detect derived constraints - failing to set the actual value. - - - - - The actual value being tested against a constraint - - - - - The display name of this Constraint for use by ToString() - - - - - Argument fields used by ToString(); - - - - - The builder holding this constraint - - - - - Construct a constraint with no arguments - - - - - Construct a constraint with one argument - - - - - Construct a constraint with two arguments - - - - - Sets the ConstraintBuilder holding this constraint - - - - - Write the failure message to the MessageWriter provided - as an argument. The default implementation simply passes - the constraint and the actual value to the writer, which - then displays the constraint description and the value. - - Constraints that need to provide additional details, - such as where the error occured can override this. - - The MessageWriter on which to display the message - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Test whether the constraint is satisfied by an - ActualValueDelegate that returns the value to be tested. - The default implementation simply evaluates the delegate - but derived classes may override it to provide for delayed - processing. - - An ActualValueDelegate - True for success, false for failure - - - - Test whether the constraint is satisfied by a given reference. - The default implementation simply dereferences the value but - derived classes may override it to provide for delayed processing. - - A reference to the value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Default override of ToString returns the constraint DisplayName - followed by any arguments within angle brackets. - - - - - - Returns the string representation of this constraint - - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - This operator creates a constraint that is satisfied if either - of the argument constraints is satisfied. - - - - - This operator creates a constraint that is satisfied if the - argument constraint is not satisfied. - - - - - Returns a DelayedConstraint with the specified delay time. - - The delay in milliseconds. - - - - - Returns a DelayedConstraint with the specified delay time - and polling interval. - - The delay in milliseconds. - The interval at which to test the constraint. - - - - - The display name of this Constraint for use by ToString(). - The default value is the name of the constraint with - trailing "Constraint" removed. Derived classes may set - this to another name in their constructors. - - - - - Returns a ConstraintExpression by appending And - to the current constraint. - - - - - Returns a ConstraintExpression by appending And - to the current constraint. - - - - - Returns a ConstraintExpression by appending Or - to the current constraint. - - - - - Class used to detect any derived constraints - that fail to set the actual value in their - Matches override. - - - - - Constructs an AttributeExistsConstraint for a specific attribute Type - - - - - - Tests whether the object provides the expected attribute. - - A Type, MethodInfo, or other ICustomAttributeProvider - True if the expected attribute is present, otherwise false - - - - Writes the description of the constraint to the specified writer - - - - - AttributeConstraint tests that a specified attribute is present - on a Type or other provider and that the value of the attribute - satisfies some other constraint. - - - - - Abstract base class used for prefixes - - - - - The base constraint - - - - - Construct given a base constraint - - - - - - Constructs an AttributeConstraint for a specified attriute - Type and base constraint. - - - - - - - Determines whether the Type or other provider has the - expected attribute and if its value matches the - additional constraint specified. - - - - - Writes a description of the attribute to the specified writer. - - - - - Writes the actual value supplied to the specified writer. - - - - - Returns a string representation of the constraint. - - - - - BasicConstraint is the abstract base for constraints that - perform a simple comparison to a constant value. - - - - - Initializes a new instance of the class. - - The expected. - The description. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - NullConstraint tests that the actual value is null - - - - - Initializes a new instance of the class. - - - - - TrueConstraint tests that the actual value is true - - - - - Initializes a new instance of the class. - - - - - FalseConstraint tests that the actual value is false - - - - - Initializes a new instance of the class. - - - - - NaNConstraint tests that the actual value is a double or float NaN - - - - - Test that the actual value is an NaN - - - - - - - Write the constraint description to a specified writer - - - - - - BinaryConstraint is the abstract base of all constraints - that combine two other constraints in some fashion. - - - - - The first constraint being combined - - - - - The second constraint being combined - - - - - Construct a BinaryConstraint from two other constraints - - The first constraint - The second constraint - - - - AndConstraint succeeds only if both members succeed. - - - - - Create an AndConstraint from two other constraints - - The first constraint - The second constraint - - - - Apply both member constraints to an actual value, succeeding - succeeding only if both of them succeed. - - The actual value - True if the constraints both succeeded - - - - Write a description for this contraint to a MessageWriter - - The MessageWriter to receive the description - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - OrConstraint succeeds if either member succeeds - - - - - Create an OrConstraint from two other constraints - - The first constraint - The second constraint - - - - Apply the member constraints to an actual value, succeeding - succeeding as soon as one of them succeeds. - - The actual value - True if either constraint succeeded - - - - Write a description for this contraint to a MessageWriter - - The MessageWriter to receive the description - - - - CollectionConstraint is the abstract base class for - constraints that operate on collections. - - - - - Construct an empty CollectionConstraint - - - - - Construct a CollectionConstraint - - - - - - Determines whether the specified enumerable is empty. - - The enumerable. - - true if the specified enumerable is empty; otherwise, false. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Protected method to be implemented by derived classes - - - - - - - CollectionItemsEqualConstraint is the abstract base class for all - collection constraints that apply some notion of item equality - as a part of their operation. - - - - - Construct an empty CollectionConstraint - - - - - Construct a CollectionConstraint - - - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied Comparison object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Compares two collection members for equality - - - - - Return a new CollectionTally for use in making tests - - The collection to be included in the tally - - - - Flag the constraint to ignore case and return self. - - - - - EmptyCollectionConstraint tests whether a collection is empty. - - - - - Check that the collection is empty - - - - - - - Write the constraint description to a MessageWriter - - - - - - UniqueItemsConstraint tests whether all the items in a - collection are unique. - - - - - Check that all items are unique. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionContainsConstraint is used to test whether a collection - contains an expected object as a member. - - - - - Construct a CollectionContainsConstraint - - - - - - Test whether the expected item is contained in the collection - - - - - - - Write a descripton of the constraint to a MessageWriter - - - - - - CollectionEquivalentCOnstraint is used to determine whether two - collections are equivalent. - - - - - Construct a CollectionEquivalentConstraint - - - - - - Test whether two collections are equivalent - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionSubsetConstraint is used to determine whether - one collection is a subset of another - - - - - Construct a CollectionSubsetConstraint - - The collection that the actual value is expected to be a subset of - - - - Test whether the actual collection is a subset of - the expected collection provided. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionOrderedConstraint is used to test whether a collection is ordered. - - - - - Construct a CollectionOrderedConstraint - - - - - Modifies the constraint to use an IComparer and returns self. - - - - - Modifies the constraint to use an IComparer<T> and returns self. - - - - - Modifies the constraint to use a Comparison<T> and returns self. - - - - - Modifies the constraint to test ordering by the value of - a specified property and returns self. - - - - - Test whether the collection is ordered - - - - - - - Write a description of the constraint to a MessageWriter - - - - - - Returns the string representation of the constraint. - - - - - - If used performs a reverse comparison - - - - - CollectionTally counts (tallies) the number of - occurences of each object in one or more enumerations. - - - - - Construct a CollectionTally object from a comparer and a collection - - - - - Try to remove an object from the tally - - The object to remove - True if successful, false if the object was not found - - - - Try to remove a set of objects from the tally - - The objects to remove - True if successful, false if any object was not found - - - - The number of objects remaining in the tally - - - - - ComparisonAdapter class centralizes all comparisons of - values in NUnit, adapting to the use of any provided - IComparer, IComparer<T> or Comparison<T> - - - - - Returns a ComparisonAdapter that wraps an IComparer - - - - - Returns a ComparisonAdapter that wraps an IComparer<T> - - - - - Returns a ComparisonAdapter that wraps a Comparison<T> - - - - - Compares two objects - - - - - Gets the default ComparisonAdapter, which wraps an - NUnitComparer object. - - - - - Construct a ComparisonAdapter for an IComparer - - - - - Compares two objects - - - - - - - - Construct a default ComparisonAdapter - - - - - ComparisonAdapter<T> extends ComparisonAdapter and - allows use of an IComparer<T> or Comparison<T> - to actually perform the comparison. - - - - - Construct a ComparisonAdapter for an IComparer<T> - - - - - Compare a Type T to an object - - - - - Construct a ComparisonAdapter for a Comparison<T> - - - - - Compare a Type T to an object - - - - - Abstract base class for constraints that compare values to - determine if one is greater than, equal to or less than - the other. - - - - - The value against which a comparison is to be made - - - - - If true, less than returns success - - - - - if true, equal returns success - - - - - if true, greater than returns success - - - - - The predicate used as a part of the description - - - - - ComparisonAdapter to be used in making the comparison - - - - - Initializes a new instance of the class. - - The value against which to make a comparison. - if set to true less succeeds. - if set to true equal succeeds. - if set to true greater succeeds. - String used in describing the constraint. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Modifies the constraint to use an IComparer and returns self - - - - - Modifies the constraint to use an IComparer<T> and returns self - - - - - Modifies the constraint to use a Comparison<T> and returns self - - - - - Tests whether a value is greater than the value supplied to its constructor - - - - - Initializes a new instance of the class. - - The expected value. - - - - Tests whether a value is greater than or equal to the value supplied to its constructor - - - - - Initializes a new instance of the class. - - The expected value. - - - - Tests whether a value is less than the value supplied to its constructor - - - - - Initializes a new instance of the class. - - The expected value. - - - - Tests whether a value is less than or equal to the value supplied to its constructor - - - - - Initializes a new instance of the class. - - The expected value. - - - - Delegate used to delay evaluation of the actual value - to be used in evaluating a constraint - - - - - ConstraintBuilder maintains the stacks that are used in - processing a ConstraintExpression. An OperatorStack - is used to hold operators that are waiting for their - operands to be reognized. a ConstraintStack holds - input constraints as well as the results of each - operator applied. - - - - - Initializes a new instance of the class. - - - - - Appends the specified operator to the expression by first - reducing the operator stack and then pushing the new - operator on the stack. - - The operator to push. - - - - Appends the specified constraint to the expresson by pushing - it on the constraint stack. - - The constraint to push. - - - - Sets the top operator right context. - - The right context. - - - - Reduces the operator stack until the topmost item - precedence is greater than or equal to the target precedence. - - The target precedence. - - - - Resolves this instance, returning a Constraint. If the builder - is not currently in a resolvable state, an exception is thrown. - - The resolved constraint - - - - Gets a value indicating whether this instance is resolvable. - - - true if this instance is resolvable; otherwise, false. - - - - - OperatorStack is a type-safe stack for holding ConstraintOperators - - - - - Initializes a new instance of the class. - - The builder. - - - - Pushes the specified operator onto the stack. - - The op. - - - - Pops the topmost operator from the stack. - - - - - - Gets a value indicating whether this is empty. - - true if empty; otherwise, false. - - - - Gets the topmost operator without modifying the stack. - - The top. - - - - ConstraintStack is a type-safe stack for holding Constraints - - - - - Initializes a new instance of the class. - - The builder. - - - - Pushes the specified constraint. As a side effect, - the constraint's builder field is set to the - ConstraintBuilder owning this stack. - - The constraint. - - - - Pops this topmost constrait from the stack. - As a side effect, the constraint's builder - field is set to null. - - - - - - Gets a value indicating whether this is empty. - - true if empty; otherwise, false. - - - - Gets the topmost constraint without modifying the stack. - - The topmost constraint - - - - ConstraintExpression represents a compound constraint in the - process of being constructed from a series of syntactic elements. - - Individual elements are appended to the expression as they are - reognized. Once an actual Constraint is appended, the expression - returns a resolvable Constraint. - - - - - ConstraintExpressionBase is the abstract base class for the - generated ConstraintExpression class, which represents a - compound constraint in the process of being constructed - from a series of syntactic elements. - - NOTE: ConstraintExpressionBase is aware of some of its - derived classes, which is an apparent violation of - encapsulation. Ideally, these classes would be a - single class, but they must be separated in order to - allow parts to be generated under .NET 1.x and to - provide proper user feedback in syntactically - aware IDEs. - - - - - The ConstraintBuilder holding the elements recognized so far - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the - class passing in a ConstraintBuilder, which may be pre-populated. - - The builder. - - - - Returns a string representation of the expression as it - currently stands. This should only be used for testing, - since it has the side-effect of resolving the expression. - - - - - - Appends an operator to the expression and returns the - resulting expression itself. - - - - - Appends a self-resolving operator to the expression and - returns a new ResolvableConstraintExpression. - - - - - Appends a constraint to the expression and returns that - constraint, which is associated with the current state - of the expression being built. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the - class passing in a ConstraintBuilder, which may be pre-populated. - - The builder. - - - - Returns a new PropertyConstraintExpression, which will either - test for the existence of the named property on the object - being tested or apply any following constraint to that property. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns the constraint provided as an argument - used to allow custom - custom constraints to easily participate in the syntax. - - - - - Returns the constraint provided as an argument - used to allow custom - custom constraints to easily participate in the syntax. - - - - - Returns a constraint that tests two items for equality - - - - - Returns a constraint that tests that two references are the same object - - - - - Returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a collection containing the same elements as the - collection supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a subset of the collection supplied as an argument. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new ContainsConstraint. This constraint - will, in turn, make use of the appropriate second-level - constraint, depending on the type of the actual argument. - This overload is only used if the item sought is a string, - since any other type implies that we are looking for a - collection member. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that tests whether the path provided - is the same as an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the actual value falls - within a specified range. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if at least one of them succeeds. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them fail. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Length property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Count property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Message property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the InnerException property of the object being tested. - - - - - With is currently a NOP - reserved for future use. - - - - - Returns a constraint that tests for null - - - - - Returns a constraint that tests for True - - - - - Returns a constraint that tests for False - - - - - Returns a constraint that tests for NaN - - - - - Returns a constraint that tests for empty - - - - - Returns a constraint that tests whether a collection - contains all unique items. - - - - - Returns a constraint that tests whether an object graph is serializable in binary format. - - - - - Returns a constraint that tests whether an object graph is serializable in xml format. - - - - - Returns a constraint that tests whether a collection is ordered - - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - Returns a new PropertyConstraintExpression, which will either - test for the existence of the named property on the object - being tested or apply any following constraint to that property. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a constraint that tests two items for equality - - - - - Returns a constraint that tests that two references are the same object - - - - - Returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a collection containing the same elements as the - collection supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a subset of the collection supplied as an argument. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new ContainsConstraint. This constraint - will, in turn, make use of the appropriate second-level - constraint, depending on the type of the actual argument. - This overload is only used if the item sought is a string, - since any other type implies that we are looking for a - collection member. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that fails if the actual - value matches the pattern supplied as an argument. - - - - - Returns a constraint that tests whether the path provided - is the same as an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the actual value falls - within a specified range. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if at least one of them succeeds. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them fail. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Length property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Count property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Message property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the InnerException property of the object being tested. - - - - - Returns a constraint that tests for null - - - - - Returns a constraint that tests for True - - - - - Returns a constraint that tests for False - - - - - Returns a constraint that tests for NaN - - - - - Returns a constraint that tests for empty - - - - - Returns a constraint that tests whether a collection - contains all unique items. - - - - - Returns a constraint that tests whether an object graph is serializable in binary format. - - - - - Returns a constraint that tests whether an object graph is serializable in xml format. - - - - - Returns a constraint that tests whether a collection is ordered - - - - - The ConstraintOperator class is used internally by a - ConstraintBuilder to represent an operator that - modifies or combines constraints. - - Constraint operators use left and right precedence - values to determine whether the top operator on the - stack should be reduced before pushing a new operator. - - - - - The precedence value used when the operator - is about to be pushed to the stack. - - - - - The precedence value used when the operator - is on the top of the stack. - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - The syntax element preceding this operator - - - - - The syntax element folowing this operator - - - - - The precedence value used when the operator - is about to be pushed to the stack. - - - - - The precedence value used when the operator - is on the top of the stack. - - - - - PrefixOperator takes a single constraint and modifies - it's action in some way. - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - Returns the constraint created by applying this - prefix to another constraint. - - - - - - - Negates the test of the constraint it wraps. - - - - - Constructs a new NotOperator - - - - - Returns a NotConstraint applied to its argument. - - - - - Abstract base for operators that indicate how to - apply a constraint to items in a collection. - - - - - Constructs a CollectionOperator - - - - - Represents a constraint that succeeds if all the - members of a collection match a base constraint. - - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - they all succeed. - - - - - Represents a constraint that succeeds if any of the - members of a collection match a base constraint. - - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - any of them succeed. - - - - - Represents a constraint that succeeds if none of the - members of a collection match a base constraint. - - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - none of them succeed. - - - - - Represents a constraint that simply wraps the - constraint provided as an argument, without any - further functionality, but which modifes the - order of evaluation because of its precedence. - - - - - Constructor for the WithOperator - - - - - Returns a constraint that wraps its argument - - - - - Abstract base class for operators that are able to reduce to a - constraint whether or not another syntactic element follows. - - - - - Operator used to test for the presence of a named Property - on an object and optionally apply further tests to the - value of that property. - - - - - Constructs a PropOperator for a particular named property - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - Gets the name of the property to which the operator applies - - - - - Operator that tests for the presence of a particular attribute - on a type and optionally applies further tests to the attribute. - - - - - Construct an AttributeOperator for a particular Type - - The Type of attribute tested - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - Operator that tests that an exception is thrown and - optionally applies further tests to the exception. - - - - - Construct a ThrowsOperator - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - Abstract base class for all binary operators - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - Abstract method that produces a constraint by applying - the operator to its left and right constraint arguments. - - - - - Gets the left precedence of the operator - - - - - Gets the right precedence of the operator - - - - - Operator that requires both it's arguments to succeed - - - - - Construct an AndOperator - - - - - Apply the operator to produce an AndConstraint - - - - - Operator that requires at least one of it's arguments to succeed - - - - - Construct an OrOperator - - - - - Apply the operator to produce an OrConstraint - - - - - ContainsConstraint tests a whether a string contains a substring - or a collection contains an object. It postpones the decision of - which test to use until the type of the actual argument is known. - This allows testing whether a string is contained in a collection - or as a substring of another string using the same syntax. - - - - - Initializes a new instance of the class. - - The expected. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied Comparison object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to ignore case and return self. - - - - - Applies a delay to the match so that a match can be evaluated in the future. - - - - - Creates a new DelayedConstraint - - The inner constraint two decorate - The time interval after which the match is performed - If the value of is less than 0 - - - - Creates a new DelayedConstraint - - The inner constraint two decorate - The time interval after which the match is performed - The time interval used for polling - If the value of is less than 0 - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for if the base constraint fails, false if it succeeds - - - - Test whether the constraint is satisfied by a delegate - - The delegate whose value is to be tested - True for if the base constraint fails, false if it succeeds - - - - Test whether the constraint is satisfied by a given reference. - Overridden to wait for the specified delay period before - calling the base constraint with the dereferenced value. - - A reference to the value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a MessageWriter. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - EmptyDirectoryConstraint is used to test that a directory is empty - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - EmptyConstraint tests a whether a string or collection is empty, - postponing the decision about which test is applied until the - type of the actual argument is known. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - EqualConstraint is able to compare an actual value with the - expected value provided in its constructor. Two objects are - considered equal if both are null, or if both have the same - value. NUnit has special semantics for some object types. - - - - - If true, strings in error messages will be clipped - - - - - NUnitEqualityComparer used to test equality. - - - - - Initializes a new instance of the class. - - The expected value. - - - - Flag the constraint to use a tolerance when determining equality. - - Tolerance value to be used - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied Comparison object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write a failure message. Overridden to provide custom - failure messages for EqualConstraint. - - The MessageWriter to write to - - - - Write description of this constraint - - The MessageWriter to write to - - - - Display the failure information for two collections that did not match. - - The MessageWriter on which to display - The expected collection. - The actual collection - The depth of this failure in a set of nested collections - - - - Displays a single line showing the types and sizes of the expected - and actual collections or arrays. If both are identical, the value is - only shown once. - - The MessageWriter on which to display - The expected collection or array - The actual collection or array - The indentation level for the message line - - - - Displays a single line showing the point in the expected and actual - arrays at which the comparison failed. If the arrays have different - structures or dimensions, both values are shown. - - The MessageWriter on which to display - The expected array - The actual array - Index of the failure point in the underlying collections - The indentation level for the message line - - - - Flag the constraint to ignore case and return self. - - - - - Flag the constraint to suppress string clipping - and return self. - - - - - Flag the constraint to compare arrays as collections - and return self. - - - - - Switches the .Within() modifier to interpret its tolerance as - a distance in representable values (see remarks). - - Self. - - Ulp stands for "unit in the last place" and describes the minimum - amount a given value can change. For any integers, an ulp is 1 whole - digit. For floating point values, the accuracy of which is better - for smaller numbers and worse for larger numbers, an ulp depends - on the size of the number. Using ulps for comparison of floating - point results instead of fixed tolerances is safer because it will - automatically compensate for the added inaccuracy of larger numbers. - - - - - Switches the .Within() modifier to interpret its tolerance as - a percentage that the actual values is allowed to deviate from - the expected value. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in days. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in hours. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in minutes. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in seconds. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in milliseconds. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in clock ticks. - - Self - - - - EqualityAdapter class handles all equality comparisons - that use an IEqualityComparer, IEqualityComparer<T> - or a ComparisonAdapter. - - - - - Compares two objects, returning true if they are equal - - - - - Returns an EqualityAdapter that wraps an IComparer. - - - - - Returns an EqualityAdapter that wraps an IEqualityComparer. - - - - - Returns an EqualityAdapter that wraps an IEqualityComparer<T>. - - - - - Returns an EqualityAdapter that wraps an IComparer<T>. - - - - - Returns an EqualityAdapter that wraps a Comparison<T>. - - - - Helper routines for working with floating point numbers - - - The floating point comparison code is based on this excellent article: - http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm - - - "ULP" means Unit in the Last Place and in the context of this library refers to - the distance between two adjacent floating point numbers. IEEE floating point - numbers can only represent a finite subset of natural numbers, with greater - accuracy for smaller numbers and lower accuracy for very large numbers. - - - If a comparison is allowed "2 ulps" of deviation, that means the values are - allowed to deviate by up to 2 adjacent floating point values, which might be - as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. - - - - - Compares two floating point values for equality - First floating point value to be compared - Second floating point value t be compared - - Maximum number of representable floating point values that are allowed to - be between the left and the right floating point values - - True if both numbers are equal or close to being equal - - - Floating point values can only represent a finite subset of natural numbers. - For example, the values 2.00000000 and 2.00000024 can be stored in a float, - but nothing inbetween them. - - - This comparison will count how many possible floating point values are between - the left and the right number. If the number of possible values between both - numbers is less than or equal to maxUlps, then the numbers are considered as - being equal. - - - Implementation partially follows the code outlined here: - http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ - - - - - Compares two double precision floating point values for equality - First double precision floating point value to be compared - Second double precision floating point value t be compared - - Maximum number of representable double precision floating point values that are - allowed to be between the left and the right double precision floating point values - - True if both numbers are equal or close to being equal - - - Double precision floating point values can only represent a limited series of - natural numbers. For example, the values 2.0000000000000000 and 2.0000000000000004 - can be stored in a double, but nothing inbetween them. - - - This comparison will count how many possible double precision floating point - values are between the left and the right number. If the number of possible - values between both numbers is less than or equal to maxUlps, then the numbers - are considered as being equal. - - - Implementation partially follows the code outlined here: - http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ - - - - - - Reinterprets the memory contents of a floating point value as an integer value - - - Floating point value whose memory contents to reinterpret - - - The memory contents of the floating point value interpreted as an integer - - - - - Reinterprets the memory contents of a double precision floating point - value as an integer value - - - Double precision floating point value whose memory contents to reinterpret - - - The memory contents of the double precision floating point value - interpreted as an integer - - - - - Reinterprets the memory contents of an integer as a floating point value - - Integer value whose memory contents to reinterpret - - The memory contents of the integer value interpreted as a floating point value - - - - - Reinterprets the memory contents of an integer value as a double precision - floating point value - - Integer whose memory contents to reinterpret - - The memory contents of the integer interpreted as a double precision - floating point value - - - - Union of a floating point variable and an integer - - - The union's value as a floating point variable - - - The union's value as an integer - - - The union's value as an unsigned integer - - - Union of a double precision floating point variable and a long - - - The union's value as a double precision floating point variable - - - The union's value as a long - - - The union's value as an unsigned long - - - - MessageWriter is the abstract base for classes that write - constraint descriptions and messages in some form. The - class has separate methods for writing various components - of a message, allowing implementations to tailor the - presentation as needed. - - - - - Construct a MessageWriter given a culture - - - - - Method to write single line message with optional args, usually - written to precede the general failure message. - - The message to be written - Any arguments used in formatting the message - - - - Method to write single line message with optional args, usually - written to precede the general failure message, at a givel - indentation level. - - The indentation level of the message - The message to be written - Any arguments used in formatting the message - - - - Display Expected and Actual lines for a constraint. This - is called by MessageWriter's default implementation of - WriteMessageTo and provides the generic two-line display. - - The constraint that failed - - - - Display Expected and Actual lines for given values. This - method may be called by constraints that need more control over - the display of actual and expected values than is provided - by the default implementation. - - The expected value - The actual value causing the failure - - - - Display Expected and Actual lines for given values, including - a tolerance value on the Expected line. - - The expected value - The actual value causing the failure - The tolerance within which the test was made - - - - Display the expected and actual string values on separate lines. - If the mismatch parameter is >=0, an additional line is displayed - line containing a caret that points to the mismatch point. - - The expected string value - The actual string value - The point at which the strings don't match or -1 - If true, case is ignored in locating the point where the strings differ - If true, the strings should be clipped to fit the line - - - - Writes the text for a connector. - - The connector. - - - - Writes the text for a predicate. - - The predicate. - - - - Writes the text for an expected value. - - The expected value. - - - - Writes the text for a modifier - - The modifier. - - - - Writes the text for an actual value. - - The actual value. - - - - Writes the text for a generalized value. - - The value. - - - - Writes the text for a collection value, - starting at a particular point, to a max length - - The collection containing elements to write. - The starting point of the elements to write - The maximum number of elements to write - - - - Abstract method to get the max line length - - - - - Static methods used in creating messages - - - - - Static string used when strings are clipped - - - - - Returns the representation of a type as used in NUnitLite. - This is the same as Type.ToString() except for arrays, - which are displayed with their declared sizes. - - - - - - - Converts any control characters in a string - to their escaped representation. - - The string to be converted - The converted string - - - - Return the a string representation for a set of indices into an array - - Array of indices for which a string is needed - - - - Get an array of indices representing the point in a collection or - array corresponding to a single int index into the collection. - - The collection to which the indices apply - Index in the collection - Array of indices - - - - Clip a string to a given length, starting at a particular offset, returning the clipped - string with ellipses representing the removed parts - - The string to be clipped - The maximum permitted length of the result string - The point at which to start clipping - The clipped string - - - - Clip the expected and actual strings in a coordinated fashion, - so that they may be displayed together. - - - - - - - - - Shows the position two strings start to differ. Comparison - starts at the start index. - - The expected string - The actual string - The index in the strings at which comparison should start - Boolean indicating whether case should be ignored - -1 if no mismatch found, or the index where mismatch found - - - - The Numerics class contains common operations on numeric values. - - - - - Checks the type of the object, returning true if - the object is a numeric type. - - The object to check - true if the object is a numeric type - - - - Checks the type of the object, returning true if - the object is a floating point numeric type. - - The object to check - true if the object is a floating point numeric type - - - - Checks the type of the object, returning true if - the object is a fixed point numeric type. - - The object to check - true if the object is a fixed point numeric type - - - - Test two numeric values for equality, performing the usual numeric - conversions and using a provided or default tolerance. If the tolerance - provided is Empty, this method may set it to a default tolerance. - - The expected value - The actual value - A reference to the tolerance in effect - True if the values are equal - - - - Compare two numeric values, performing the usual numeric conversions. - - The expected value - The actual value - The relationship of the values to each other - - - - NUnitComparer encapsulates NUnit's default behavior - in comparing two objects. - - - - - Compares two objects - - - - - - - - Returns the default NUnitComparer. - - - - - NUnitEqualityComparer encapsulates NUnit's handling of - equality tests between objects. - - - - - If true, all string comparisons will ignore case - - - - - If true, arrays will be treated as collections, allowing - those of different dimensions to be compared - - - - - If non-zero, equality comparisons within the specified - tolerance will succeed. - - - - - Comparison object used in comparisons for some constraints. - - - - - Compares two objects for equality. - - - - - Helper method to compare two arrays - - - - - Method to compare two DirectoryInfo objects - - first directory to compare - second directory to compare - true if equivalent, false if not - - - - Returns the default NUnitEqualityComparer - - - - - Gets and sets a flag indicating whether case should - be ignored in determining equality. - - - - - Gets and sets a flag indicating that arrays should be - compared as collections, without regard to their shape. - - - - - Gets and sets an external comparer to be used to - test for equality. It is applied to members of - collections, in place of NUnit's own logic. - - - - - Gets and sets a tolerance used to compare objects of - certin types. - - - - - Gets the list of failure points for the last Match performed. - - - - - PathConstraint serves as the abstract base of constraints - that operate on paths and provides several helper methods. - - - - - The expected path used in the constraint - - - - - The actual path being tested - - - - - Flag indicating whether a caseInsensitive comparison should be made - - - - - Construct a PathConstraint for a give expected path - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Returns true if the expected path and actual path match - - - - - Returns the string representation of this constraint - - - - - Canonicalize the provided path - - - The path in standardized form - - - - Test whether two paths are the same - - The first path - The second path - Indicates whether case should be ignored - - - - - Test whether one path is under another path - - The first path - supposed to be the parent path - The second path - supposed to be the child path - Indicates whether case should be ignored - - - - - Test whether one path is the same as or under another path - - The first path - supposed to be the parent path - The second path - supposed to be the child path - - - - - Modifies the current instance to be case-insensitve - and returns it. - - - - - Modifies the current instance to be case-sensitve - and returns it. - - - - - Summary description for SamePathConstraint. - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SubPathConstraint tests that the actual path is under the expected path - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SamePathOrUnderConstraint tests that one path is under another - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Predicate constraint wraps a Predicate in a constraint, - returning success if the predicate is true. - - - - - Construct a PredicateConstraint from a predicate - - - - - Determines whether the predicate succeeds when applied - to the actual value. - - - - - Writes the description to a MessageWriter - - - - - NotConstraint negates the effect of some other constraint - - - - - Initializes a new instance of the class. - - The base constraint to be negated. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for if the base constraint fails, false if it succeeds - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a MessageWriter. - - The writer on which the actual value is displayed - - - - AllItemsConstraint applies another constraint to each - item in a collection, succeeding if they all succeed. - - - - - Construct an AllItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - SomeItemsConstraint applies another constraint to each - item in a collection, succeeding if any of them succeeds. - - - - - Construct a SomeItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - succeeding if any item succeeds. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - NoItemConstraint applies another constraint to each - item in a collection, failing if any of them succeeds. - - - - - Construct a SomeItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - PropertyExistsConstraint tests that a named property - exists on the object provided through Match. - - Originally, PropertyConstraint provided this feature - in addition to making optional tests on the vaue - of the property. The two constraints are now separate. - - - - - Initializes a new instance of the class. - - The name of the property. - - - - Test whether the property exists for a given object - - The object to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - - PropertyConstraint extracts a named property and uses - its value as the actual value for a chained constraint. - - - - - Initializes a new instance of the class. - - The name. - The constraint to apply to the property. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - - RangeConstraint tests whethe two values are within a - specified range. - - - - - Initializes a new instance of the class. - - From. - To. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Modifies the constraint to use an IComparer and returns self. - - - - - Modifies the constraint to use an IComparer<T> and returns self. - - - - - Modifies the constraint to use a Comparison<T> and returns self. - - - - - ResolvableConstraintExpression is used to represent a compound - constraint being constructed at a point where the last operator - may either terminate the expression or may have additional - qualifying constraints added to it. - - It is used, for example, for a Property element or for - an Exception element, either of which may be optionally - followed by constraints that apply to the property or - exception. - - - - - Create a new instance of ResolvableConstraintExpression - - - - - Create a new instance of ResolvableConstraintExpression, - passing in a pre-populated ConstraintBuilder. - - - - - Resolve the current expression to a Constraint - - - - - Appends an And Operator to the expression - - - - - Appends an Or operator to the expression. - - - - - ReusableConstraint wraps a resolved constraint so that it - may be saved and reused as needed. - - - - - Construct a ReusableConstraint - - The constraint or expression to be reused - - - - Conversion operator from a normal constraint to a ReusableConstraint. - - The original constraint to be wrapped as a ReusableConstraint - - - - - Returns the string representation of the constraint. - - A string representing the constraint - - - - Resolves the ReusableConstraint by returning the constraint - that it originally wrapped. - - A resolved constraint - - - - SameAsConstraint tests whether an object is identical to - the object passed to its constructor - - - - - Initializes a new instance of the class. - - The expected object. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - BinarySerializableConstraint tests whether - an object is serializable in binary format. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation - - - - - BinarySerializableConstraint tests whether - an object is serializable in binary format. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation of this constraint - - - - - StringConstraint is the abstract base for constraints - that operate on strings. It supports the IgnoreCase - modifier for string operations. - - - - - The expected value - - - - - Indicates whether tests should be case-insensitive - - - - - Constructs a StringConstraint given an expected value - - The expected value - - - - Modify the constraint to ignore case in matching. - - - - - EmptyStringConstraint tests whether a string is empty. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - NullEmptyStringConstraint tests whether a string is either null or empty. - - - - - Constructs a new NullOrEmptyStringConstraint - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SubstringConstraint can test whether a string contains - the expected substring. - - - - - Initializes a new instance of the class. - - The expected. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - StartsWithConstraint can test whether a string starts - with an expected substring. - - - - - Initializes a new instance of the class. - - The expected string - - - - Test whether the constraint is matched by the actual value. - This is a template method, which calls the IsMatch method - of the derived class. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - EndsWithConstraint can test whether a string ends - with an expected substring. - - - - - Initializes a new instance of the class. - - The expected string - - - - Test whether the constraint is matched by the actual value. - This is a template method, which calls the IsMatch method - of the derived class. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - RegexConstraint can test whether a string matches - the pattern provided. - - - - - Initializes a new instance of the class. - - The pattern. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - ThrowsConstraint is used to test the exception thrown by - a delegate by applying a constraint to it. - - - - - Initializes a new instance of the class, - using a constraint to be applied to the exception. - - A constraint to apply to the caught exception. - - - - Executes the code of the delegate and captures any exception. - If a non-null base constraint was provided, it applies that - constraint to the exception. - - A delegate representing the code to be tested - True if an exception is thrown and the constraint succeeds, otherwise false - - - - Converts an ActualValueDelegate to a TestDelegate - before calling the primary overload. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation of this constraint - - - - - Get the actual exception thrown - used by Assert.Throws. - - - - - ThrowsNothingConstraint tests that a delegate does not - throw an exception. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True if no exception is thrown, otherwise false - - - - Converts an ActualValueDelegate to a TestDelegate - before calling the primary overload. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Modes in which the tolerance value for a comparison can - be interpreted. - - - - - The tolerance was created with a value, without specifying - how the value would be used. This is used to prevent setting - the mode more than once and is generally changed to Linear - upon execution of the test. - - - - - The tolerance is used as a numeric range within which - two compared values are considered to be equal. - - - - - Interprets the tolerance as the percentage by which - the two compared values my deviate from each other. - - - - - Compares two values based in their distance in - representable numbers. - - - - - The Tolerance class generalizes the notion of a tolerance - within which an equality test succeeds. Normally, it is - used with numeric types, but it can be used with any - type that supports taking a difference between two - objects and comparing that difference to a value. - - - - - Constructs a linear tolerance of a specdified amount - - - - - Constructs a tolerance given an amount and ToleranceMode - - - - - Tests that the current Tolerance is linear with a - numeric value, throwing an exception if it is not. - - - - - Returns an empty Tolerance object, equivalent to - specifying an exact match. - - - - - Gets the ToleranceMode for the current Tolerance - - - - - Gets the value of the current Tolerance instance. - - - - - Returns a new tolerance, using the current amount as a percentage. - - - - - Returns a new tolerance, using the current amount in Ulps. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of days. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of hours. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of minutes. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of seconds. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of milliseconds. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of clock ticks. - - - - - Returns true if the current tolerance is empty. - - - - - TypeConstraint is the abstract base for constraints - that take a Type as their expected value. - - - - - The expected Type used by the constraint - - - - - Construct a TypeConstraint for a given Type - - - - - - Write the actual value for a failing constraint test to a - MessageWriter. TypeConstraints override this method to write - the name of the type. - - The writer on which the actual value is displayed - - - - ExactTypeConstraint is used to test that an object - is of the exact type provided in the constructor - - - - - Construct an ExactTypeConstraint for a given Type - - The expected Type. - - - - Test that an object is of the exact type specified - - The actual value. - True if the tested object is of the exact type provided, otherwise false. - - - - Write the description of this constraint to a MessageWriter - - The MessageWriter to use - - - - InstanceOfTypeConstraint is used to test that an object - is of the same type provided or derived from it. - - - - - Construct an InstanceOfTypeConstraint for the type provided - - The expected Type - - - - Test whether an object is of the specified type or a derived type - - The object to be tested - True if the object is of the provided type or derives from it, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - AssignableFromConstraint is used to test that an object - can be assigned from a given Type. - - - - - Construct an AssignableFromConstraint for the type provided - - - - - - Test whether an object can be assigned from the specified type - - The object to be tested - True if the object can be assigned a value of the expected Type, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - AssignableToConstraint is used to test that an object - can be assigned to a given Type. - - - - - Construct an AssignableToConstraint for the type provided - - - - - - Test whether an object can be assigned to the specified type - - The object to be tested - True if the object can be assigned a value of the expected Type, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - Thrown when an assertion failed. - - - - - The error message that explains - the reason for the exception - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Thrown when an assertion failed. - - - - - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Thrown when a test executes inconclusively. - - - - - The error message that explains - the reason for the exception - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Thrown when an assertion failed. - - - - - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Delegate used by tests that execute code and - capture any thrown exception. - - - - - The Assert class contains a collection of static methods that - implement the most common assertions used in NUnit. - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Helper for Assert.AreEqual(double expected, double actual, ...) - allowing code generation to work consistently. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Throws a with the message and arguments - that are passed in. This allows a test to be cut short, with a result - of success returned to NUnit. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws a with the message and arguments - that are passed in. This allows a test to be cut short, with a result - of success returned to NUnit. - - The message to initialize the with. - - - - Throws a with the message and arguments - that are passed in. This allows a test to be cut short, with a result - of success returned to NUnit. - - - - - Throws an with the message and arguments - that are passed in. This is used by the other Assert functions. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This is used by the other Assert functions. - - The message to initialize the with. - - - - Throws an . - This is used by the other Assert functions. - - - - - Throws an with the message and arguments - that are passed in. This causes the test to be reported as ignored. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This causes the test to be reported as ignored. - - The message to initialize the with. - - - - Throws an . - This causes the test to be reported as ignored. - - - - - Throws an with the message and arguments - that are passed in. This causes the test to be reported as inconclusive. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This causes the test to be reported as inconclusive. - - The message to initialize the with. - - - - Throws an . - This causes the test to be reported as Inconclusive. - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that the code represented by a delegate throws an exception - that satisfies the constraint provided. - - A TestDelegate to be executed - A ThrowsConstraint used in the test - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestSnippet delegate - - - - Verifies that a delegate throws a particular exception when called. - - The exception Type expected - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - The exception Type expected - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - The exception Type expected - A TestSnippet delegate - - - - Verifies that a delegate throws a particular exception when called. - - Type of the expected exception - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - Type of the expected exception - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - Type of the expected exception - A TestSnippet delegate - - - - Verifies that a delegate throws an exception when called - and returns it. - - A TestDelegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws an exception when called - and returns it. - - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws an exception when called - and returns it. - - A TestDelegate - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - - - - Verifies that a delegate does not throw an exception - - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate does not throw an exception. - - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate does not throw an exception. - - A TestSnippet delegate - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - - - - Assert that a string is not null or empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is not null or empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is not null or empty - - The string to be tested - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are not equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are not equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are not equal an is thrown. - - The value that is expected - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two objects are not equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two objects are not equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - - - - Verifies that two objects are not equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are equal an is thrown. - - The value that is expected - The actual value - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - The message to display in case of failure - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - - - - Gets the number of assertions executed so far and - resets the counter to zero. - - - - - AssertionHelper is an optional base class for user tests, - allowing the use of shorter names for constraints and - asserts and avoiding conflict with the definition of - , from which it inherits much of its - behavior, in certain mock object frameworks. - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to - . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to - . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to . - - The evaluated condition - - - - Asserts that the code represented by a delegate throws an exception - that satisfies the constraint provided. - - A TestDelegate to be executed - A ThrowsConstraint used in the test - - - - Returns a ListMapper based on a collection. - - The original collection - - - - - Provides static methods to express the assumptions - that must be met for a test to give a meaningful - result. If an assumption is not met, the test - should produce an inconclusive result. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the - method throws an . - - The evaluated condition - - - - Asserts that the code represented by a delegate throws an exception - that satisfies the constraint provided. - - A TestDelegate to be executed - A ThrowsConstraint used in the test - - - - A set of Assert methods operationg on one or more collections - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - The message that will be displayed on failure - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable containing objects to be considered - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable containing objects to be considered - The message that will be displayed on failure - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - The message that will be displayed on failure - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - The message that will be displayed on failure - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array,list or other collection is empty - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array,list or other collection is empty - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - A custom comparer to perform the comparisons - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - A custom comparer to perform the comparisons - The message to be displayed on failure - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - A custom comparer to perform the comparisons - - - - Static helper class used in the constraint-based syntax - - - - - Creates a new SubstringConstraint - - The value of the substring - A SubstringConstraint - - - - Creates a new CollectionContainsConstraint. - - The item that should be found. - A new CollectionContainsConstraint - - - - Summary description for DirectoryAssert - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are not equal - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are equal - Arguments to be used in formatting the message - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are equal - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Summary description for FileAssert. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - The message to display if objects are not equal - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if objects are not equal - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if objects are not equal - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - The message to be displayed when the two Stream are the same. - Arguments to be used in formatting the message - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - The message to be displayed when the Streams are the same. - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if objects are not equal - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if objects are not equal - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - - - - GlobalSettings is a place for setting default values used - by the framework in performing asserts. - - - - - Default tolerance for floating point equality - - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - Returns a new PropertyConstraintExpression, which will either - test for the existence of the named property on the object - being tested or apply any following constraint to that property. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if at least one of them succeeds. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them fail. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Length property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Count property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Message property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the InnerException property of the object being tested. - - - - - Interface implemented by a user fixture in order to - validate any expected exceptions. It is only called - for test methods marked with the ExpectedException - attribute. - - - - - Method to handle an expected exception - - The exception to be handled - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - Returns a constraint that tests two items for equality - - - - - Returns a constraint that tests that two references are the same object - - - - - Returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a collection containing the same elements as the - collection supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a subset of the collection supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that tests whether the path provided - is the same as an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the actual value falls - within a specified range. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a constraint that tests for null - - - - - Returns a constraint that tests for True - - - - - Returns a constraint that tests for False - - - - - Returns a constraint that tests for NaN - - - - - Returns a constraint that tests for empty - - - - - Returns a constraint that tests whether a collection - contains all unique items. - - - - - Returns a constraint that tests whether an object graph is serializable in binary format. - - - - - Returns a constraint that tests whether an object graph is serializable in xml format. - - - - - Returns a constraint that tests whether a collection is ordered - - - - - The Iz class is a synonym for Is intended for use in VB, - which regards Is as a keyword. - - - - - The List class is a helper class with properties and methods - that supply a number of constraints used with lists and collections. - - - - - List.Map returns a ListMapper, which can be used to map - the original collection to another collection. - - - - - - - ListMapper is used to transform a collection used as an actual argument - producing another collection to be used in the assertion. - - - - - Construct a ListMapper based on a collection - - The collection to be transformed - - - - Produces a collection containing all the values of a property - - The collection of property values - - - - - Randomizer returns a set of random values in a repeatable - way, to allow re-running of tests if necessary. - - - - - Get a randomizer for a particular member, returning - one that has already been created if it exists. - This ensures that the same values are generated - each time the tests are reloaded. - - - - - Get a randomizer for a particular parameter, returning - one that has already been created if it exists. - This ensures that the same values are generated - each time the tests are reloaded. - - - - - Construct a randomizer using a random seed - - - - - Construct a randomizer using a specified seed - - - - - Return an array of random doubles between 0.0 and 1.0. - - - - - - - Return an array of random doubles with values in a specified range. - - - - - Return an array of random ints with values in a specified range. - - - - - Get a random seed for use in creating a randomizer. - - - - - The SpecialValue enum is used to represent TestCase arguments - that cannot be used as arguments to an Attribute. - - - - - Null represents a null value, which cannot be used as an - argument to an attriute under .NET 1.x - - - - - Basic Asserts on strings. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - - - - Asserts that a string is not found within another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - - - - Asserts that a string does not start with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string does not start with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string does not start with another string. - - The expected string - The string to be examined - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - - - - Asserts that a string does not end with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string does not end with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string does not end with another string. - - The expected string - The string to be examined - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - - - - Asserts that two strings are not equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that two strings are Notequal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - - - - Asserts that two strings are not equal, without regard to case. - - The expected string - The actual string - - - - Asserts that a string matches an expected regular expression pattern. - - The regex pattern to be matched - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string matches an expected regular expression pattern. - - The regex pattern to be matched - The actual string - The message to display in case of failure - - - - Asserts that a string matches an expected regular expression pattern. - - The regex pattern to be matched - The actual string - - - - Asserts that a string does not match an expected regular expression pattern. - - The regex pattern to be used - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string does not match an expected regular expression pattern. - - The regex pattern to be used - The actual string - The message to display in case of failure - - - - Asserts that a string does not match an expected regular expression pattern. - - The regex pattern to be used - The actual string - - - - The TestCaseData class represents a set of arguments - and other parameter info to be used for a parameterized - test case. It provides a number of instance modifiers - for use in initializing the test case. - - Note: Instance modifiers are getters that return - the same instance after modifying it's state. - - - - - The argument list to be provided to the test - - - - - The expected result to be returned - - - - - The expected exception Type - - - - - The FullName of the expected exception - - - - - The name to be used for the test - - - - - The description of the test - - - - - A dictionary of properties, used to add information - to tests without requiring the class to change. - - - - - If true, indicates that the test case is to be ignored - - - - - The reason for ignoring a test case - - - - - Initializes a new instance of the class. - - The arguments. - - - - Initializes a new instance of the class. - - The argument. - - - - Initializes a new instance of the class. - - The first argument. - The second argument. - - - - Initializes a new instance of the class. - - The first argument. - The second argument. - The third argument. - - - - Sets the expected result for the test - - The expected result - A modified TestCaseData - - - - Sets the expected exception type for the test - - Type of the expected exception. - The modified TestCaseData instance - - - - Sets the expected exception type for the test - - FullName of the expected exception. - The modified TestCaseData instance - - - - Sets the name of the test case - - The modified TestCaseData instance - - - - Sets the description for the test case - being constructed. - - The description. - The modified TestCaseData instance. - - - - Applies a category to the test - - - - - - - Applies a named property to the test - - - - - - - - Applies a named property to the test - - - - - - - - Applies a named property to the test - - - - - - - - Ignores this TestCase. - - - - - - Ignores this TestCase, specifying the reason. - - The reason. - - - - - Gets the argument list to be provided to the test - - - - - Gets the expected result - - - - - Gets the expected exception Type - - - - - Gets the FullName of the expected exception - - - - - Gets the name to be used for the test - - - - - Gets the description of the test - - - - - Gets a value indicating whether this is ignored. - - true if ignored; otherwise, false. - - - - Gets the ignore reason. - - The ignore reason. - - - - Gets a list of categories associated with this test. - - - - - Gets the property dictionary for this test - - - - - Provide the context information of the current test - - - - - Constructs a TestContext using the provided context dictionary - - A context dictionary - - - - Get the current test context. This is created - as needed. The user may save the context for - use within a test, but it should not be used - outside the test for which it is created. - - - - - Gets a TestAdapter representing the currently executing test in this context. - - - - - Gets a ResultAdapter representing the current result for the test - executing in this context. - - - - - Gets the current directory for this TestContext - - - - - TestAdapter adapts a Test for consumption by - the user test code. - - - - - Constructs a TestAdapter for this context - - The context dictionary - - - - The name of the test. - - - - - The FullName of the test - - - - - The properties of the test. - - - - - ResultAdapter adapts a TestResult for consumption by - the user test code. - - - - - Construct a ResultAdapter for a context - - The context holding the result - - - - The TestState of current test. This maps to the ResultState - used in nunit.core and is subject to change in the future. - - - - - The TestStatus of current test. This enum will be used - in future versions of NUnit and so is to be preferred - to the TestState value. - - - - - The ResultState enum indicates the result of running a test - - - - - The result is inconclusive - - - - - The test was not runnable. - - - - - The test has been skipped. - - - - - The test has been ignored. - - - - - The test succeeded - - - - - The test failed - - - - - The test encountered an unexpected exception - - - - - The test was cancelled by the user - - - - - The TestStatus enum indicates the result of running a test - - - - - The test was inconclusive - - - - - The test has skipped - - - - - The test succeeded - - - - - The test failed - - - - - Helper class with static methods used to supply constraints - that operate on strings. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that fails if the actual - value matches the pattern supplied as an argument. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - TextMessageWriter writes constraint descriptions and messages - in displayable form as a text stream. It tailors the display - of individual message components to form the standard message - format of NUnit assertion failure messages. - - - - - Prefix used for the expected value line of a message - - - - - Prefix used for the actual value line of a message - - - - - Length of a message prefix - - - - - Construct a TextMessageWriter - - - - - Construct a TextMessageWriter, specifying a user message - and optional formatting arguments. - - - - - - - Method to write single line message with optional args, usually - written to precede the general failure message, at a givel - indentation level. - - The indentation level of the message - The message to be written - Any arguments used in formatting the message - - - - Display Expected and Actual lines for a constraint. This - is called by MessageWriter's default implementation of - WriteMessageTo and provides the generic two-line display. - - The constraint that failed - - - - Display Expected and Actual lines for given values. This - method may be called by constraints that need more control over - the display of actual and expected values than is provided - by the default implementation. - - The expected value - The actual value causing the failure - - - - Display Expected and Actual lines for given values, including - a tolerance value on the expected line. - - The expected value - The actual value causing the failure - The tolerance within which the test was made - - - - Display the expected and actual string values on separate lines. - If the mismatch parameter is >=0, an additional line is displayed - line containing a caret that points to the mismatch point. - - The expected string value - The actual string value - The point at which the strings don't match or -1 - If true, case is ignored in string comparisons - If true, clip the strings to fit the max line length - - - - Writes the text for a connector. - - The connector. - - - - Writes the text for a predicate. - - The predicate. - - - - Write the text for a modifier. - - The modifier. - - - - Writes the text for an expected value. - - The expected value. - - - - Writes the text for an actual value. - - The actual value. - - - - Writes the text for a generalized value. - - The value. - - - - Writes the text for a collection value, - starting at a particular point, to a max length - - The collection containing elements to write. - The starting point of the elements to write - The maximum number of elements to write - - - - Write the generic 'Expected' line for a constraint - - The constraint that failed - - - - Write the generic 'Expected' line for a given value - - The expected value - - - - Write the generic 'Expected' line for a given value - and tolerance. - - The expected value - The tolerance within which the test was made - - - - Write the generic 'Actual' line for a constraint - - The constraint for which the actual value is to be written - - - - Write the generic 'Actual' line for a given value - - The actual value causing a failure - - - - Gets or sets the maximum line length for this writer - - - - - Helper class with properties and methods that supply - constraints that operate on exceptions. - - - - - Creates a constraint specifying the exact type of exception expected - - - - - Creates a constraint specifying the exact type of exception expected - - - - - Creates a constraint specifying the type of exception expected - - - - - Creates a constraint specifying the type of exception expected - - - - - Creates a constraint specifying an expected exception - - - - - Creates a constraint specifying an exception with a given InnerException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying that no exception is thrown - - - - diff --git a/Mvc.Mailer.Test/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Mvc.Mailer.Test/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache deleted file mode 100644 index a270022..0000000 Binary files a/Mvc.Mailer.Test/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ diff --git a/Mvc.Mailer.Test/obj/Debug/Mvc.Mailer.Test.csproj.FileListAbsolute.txt b/Mvc.Mailer.Test/obj/Debug/Mvc.Mailer.Test.csproj.FileListAbsolute.txt deleted file mode 100644 index 6490271..0000000 --- a/Mvc.Mailer.Test/obj/Debug/Mvc.Mailer.Test.csproj.FileListAbsolute.txt +++ /dev/null @@ -1,15 +0,0 @@ -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\content\Views\web.config.transform -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\content\web.config.transform -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\Chrysanthemum.jpg -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\Mvc.Mailer.Test.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\Mvc.Mailer.Test.pdb -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\Moq.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\Mvc.Mailer.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\nunit.framework.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\Mvc.Mailer.pdb -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\Moq.pdb -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\Moq.xml -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Debug\nunit.framework.xml -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\obj\Debug\ResolveAssemblyReference.cache -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\obj\Debug\Mvc.Mailer.Test.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\obj\Debug\Mvc.Mailer.Test.pdb diff --git a/Mvc.Mailer.Test/obj/Debug/Mvc.Mailer.Test.dll b/Mvc.Mailer.Test/obj/Debug/Mvc.Mailer.Test.dll deleted file mode 100644 index ff627a1..0000000 Binary files a/Mvc.Mailer.Test/obj/Debug/Mvc.Mailer.Test.dll and /dev/null differ diff --git a/Mvc.Mailer.Test/obj/Debug/Mvc.Mailer.Test.pdb b/Mvc.Mailer.Test/obj/Debug/Mvc.Mailer.Test.pdb deleted file mode 100644 index 9ab76c4..0000000 Binary files a/Mvc.Mailer.Test/obj/Debug/Mvc.Mailer.Test.pdb and /dev/null differ diff --git a/Mvc.Mailer.Test/obj/Debug/ResolveAssemblyReference.cache b/Mvc.Mailer.Test/obj/Debug/ResolveAssemblyReference.cache deleted file mode 100644 index d165c93..0000000 Binary files a/Mvc.Mailer.Test/obj/Debug/ResolveAssemblyReference.cache and /dev/null differ diff --git a/Mvc.Mailer.Test/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache b/Mvc.Mailer.Test/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache deleted file mode 100644 index 4208aa0..0000000 Binary files a/Mvc.Mailer.Test/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ diff --git a/Mvc.Mailer.Test/obj/Release/Mvc.Mailer.Test.csproj.FileListAbsolute.txt b/Mvc.Mailer.Test/obj/Release/Mvc.Mailer.Test.csproj.FileListAbsolute.txt deleted file mode 100644 index 9d595c5..0000000 --- a/Mvc.Mailer.Test/obj/Release/Mvc.Mailer.Test.csproj.FileListAbsolute.txt +++ /dev/null @@ -1,15 +0,0 @@ -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\content\Views\web.config.transform -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\content\web.config.transform -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\Chrysanthemum.jpg -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\Mvc.Mailer.Test.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\Mvc.Mailer.Test.pdb -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\Moq.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\Mvc.Mailer.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\nunit.framework.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\Mvc.Mailer.pdb -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\Moq.pdb -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\Moq.xml -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\bin\Release\nunit.framework.xml -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\obj\Release\ResolveAssemblyReference.cache -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\obj\Release\Mvc.Mailer.Test.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer.Test\obj\Release\Mvc.Mailer.Test.pdb diff --git a/Mvc.Mailer.Test/obj/Release/Mvc.Mailer.Test.dll b/Mvc.Mailer.Test/obj/Release/Mvc.Mailer.Test.dll deleted file mode 100644 index 5c505e8..0000000 Binary files a/Mvc.Mailer.Test/obj/Release/Mvc.Mailer.Test.dll and /dev/null differ diff --git a/Mvc.Mailer.Test/obj/Release/Mvc.Mailer.Test.pdb b/Mvc.Mailer.Test/obj/Release/Mvc.Mailer.Test.pdb deleted file mode 100644 index 878fbaf..0000000 Binary files a/Mvc.Mailer.Test/obj/Release/Mvc.Mailer.Test.pdb and /dev/null differ diff --git a/Mvc.Mailer.Test/obj/Release/ResolveAssemblyReference.cache b/Mvc.Mailer.Test/obj/Release/ResolveAssemblyReference.cache deleted file mode 100644 index 9b1e76f..0000000 Binary files a/Mvc.Mailer.Test/obj/Release/ResolveAssemblyReference.cache and /dev/null differ diff --git a/Mvc.Mailer.Test/packages.config b/Mvc.Mailer.Test/packages.config new file mode 100644 index 0000000..e52bef7 --- /dev/null +++ b/Mvc.Mailer.Test/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Mvc.Mailer.gpState b/Mvc.Mailer.gpState new file mode 100644 index 0000000..aa4223b --- /dev/null +++ b/Mvc.Mailer.gpState @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/MvcMailer.sln b/Mvc.Mailer.sln similarity index 55% rename from MvcMailer.sln rename to Mvc.Mailer.sln index 25b1f25..77cfadc 100644 --- a/MvcMailer.sln +++ b/Mvc.Mailer.sln @@ -1,25 +1,40 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C# Express 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mvc.Mailer", "Mvc.Mailer\Mvc.Mailer.csproj", "{37B58562-EF1A-47FE-A02E-98C82D5FB5BC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mvc.Mailer.Test", "Mvc.Mailer.Test\Mvc.Mailer.Test.csproj", "{3664DD95-3C70-421E-96CA-9B63EE086C27}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {37B58562-EF1A-47FE-A02E-98C82D5FB5BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {37B58562-EF1A-47FE-A02E-98C82D5FB5BC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {37B58562-EF1A-47FE-A02E-98C82D5FB5BC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {37B58562-EF1A-47FE-A02E-98C82D5FB5BC}.Release|Any CPU.Build.0 = Release|Any CPU - {3664DD95-3C70-421E-96CA-9B63EE086C27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3664DD95-3C70-421E-96CA-9B63EE086C27}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3664DD95-3C70-421E-96CA-9B63EE086C27}.Release|Any CPU.ActiveCfg = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mvc.Mailer.Test", "Mvc.Mailer.Test\Mvc.Mailer.Test.csproj", "{3664DD95-3C70-421E-96CA-9B63EE086C27}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{48B9898F-BAD2-49B6-9474-9894D80C05B0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mvc.Mailer", "Mvc.Mailer\Mvc.Mailer.csproj", "{37B58562-EF1A-47FE-A02E-98C82D5FB5BC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{8DD380F2-F51E-4DDD-8851-BD0CFA15BF8B}" + ProjectSection(SolutionItems) = preProject + .nuget\NuGet.Config = .nuget\NuGet.Config + .nuget\NuGet.exe = .nuget\NuGet.exe + .nuget\NuGet.targets = .nuget\NuGet.targets + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mvc.Mailer.PreMailerPostProcessor", "Mvc.Mailer.PreMailer\Mvc.Mailer.PreMailerPostProcessor.csproj", "{209E5AE9-C1E3-4553-9BAB-E711F4F923E3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3664DD95-3C70-421E-96CA-9B63EE086C27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3664DD95-3C70-421E-96CA-9B63EE086C27}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3664DD95-3C70-421E-96CA-9B63EE086C27}.Release|Any CPU.ActiveCfg = Release|Any CPU + {37B58562-EF1A-47FE-A02E-98C82D5FB5BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {37B58562-EF1A-47FE-A02E-98C82D5FB5BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {37B58562-EF1A-47FE-A02E-98C82D5FB5BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {37B58562-EF1A-47FE-A02E-98C82D5FB5BC}.Release|Any CPU.Build.0 = Release|Any CPU + {209E5AE9-C1E3-4553-9BAB-E711F4F923E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {209E5AE9-C1E3-4553-9BAB-E711F4F923E3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {209E5AE9-C1E3-4553-9BAB-E711F4F923E3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {209E5AE9-C1E3-4553-9BAB-E711F4F923E3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Mvc.Mailer/EmptyHttpContext.cs b/Mvc.Mailer/EmptyHttpContext.cs index bfc3951..5d92d04 100644 --- a/Mvc.Mailer/EmptyHttpContext.cs +++ b/Mvc.Mailer/EmptyHttpContext.cs @@ -1,19 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Web; - -namespace Mvc.Mailer -{ - public class EmptyHttpContext : HttpContextBase - { - public override HttpRequestBase Request - { - get - { - return new HttpRequestWrapper(new HttpRequest("", "", "")); - } - } - } -} +using System.Web; + +namespace Mvc.Mailer { + public class EmptyHttpContext : HttpContextBase { + public override HttpRequestBase Request { + get { + return new HttpRequestWrapper(new HttpRequest("", "", "")); + } + } + } +} diff --git a/Mvc.Mailer/ExtensionMethods/HtmlHelperExtensions.cs b/Mvc.Mailer/ExtensionMethods/HtmlHelperExtensions.cs index 7fcb93a..cef4c3a 100644 --- a/Mvc.Mailer/ExtensionMethods/HtmlHelperExtensions.cs +++ b/Mvc.Mailer/ExtensionMethods/HtmlHelperExtensions.cs @@ -1,24 +1,17 @@ -using System.Web.Mvc; -using System; -using System.Web; -using System.Text; - -namespace Mvc.Mailer -{ - public static class HtmlHelperExtensions - { - /// - /// Produces the tag for inline image - /// - /// - /// e.g. logo - /// e.g. Company Logo - /// Company Logo - public static IHtmlString InlineImage(this HtmlHelper htmlHelper, string contentId, string alt = "") - { - return htmlHelper.Raw(string.Format("\"{1}\"/", contentId, alt)); - } - - } - -} +using System.Web.Mvc; +using System.Web; + +namespace Mvc.Mailer { + public static class HtmlHelperExtensions { + /// + /// Produces the tag for inline image + /// + /// + /// e.g. logo + /// e.g. Company Logo + /// Company Logo + public static IHtmlString InlineImage(this HtmlHelper htmlHelper, string contentId, string alt = "") { + return htmlHelper.Raw(string.Format("\"{1}\"/", contentId, alt)); + } + } +} diff --git a/Mvc.Mailer/ExtensionMethods/MailMessageExtensions.cs b/Mvc.Mailer/ExtensionMethods/MailMessageExtensions.cs deleted file mode 100644 index eed07c5..0000000 --- a/Mvc.Mailer/ExtensionMethods/MailMessageExtensions.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Net.Mail; -using System.Runtime.Serialization.Formatters.Binary; -using System.IO; -using System.Threading; - -namespace Mvc.Mailer -{ - /// - /// Adds the much needed send method to MailMessage so that you can do the following - /// MailMessage email = new MyMailer().WelcomeMessage(); - /// email.Send(); - /// - /// The underlying implementation utilizes the SMTPClient class to send the emails. - /// - public static class MailMessageExtensions - { - /// - /// Sends a MailMessage using smtpClient - /// - /// The mailMessage Object - /// leave null to use default System.Net.Mail.SmtpClient - public static void Send(this MailMessage message, ISmtpClient smtpClient = null) - { - smtpClient = smtpClient ?? GetSmtpClient(); - using (smtpClient) - { - smtpClient.Send(message); - } - } - - /// - /// Asynchronously Sends a MailMessage using smtpClient - /// - /// The mailMessage Object - /// The userState - /// leave null to use default System.Net.Mail.SmtpClient - public static void SendAsync(this MailMessage message, object userState = null, ISmtpClient smtpClient = null) - { - smtpClient = smtpClient ?? GetSmtpClient(); - smtpClient.SendAsync(message, userState); - } - - public static ISmtpClient GetSmtpClient() - { - if (MailerBase.IsTestModeEnabled) - { - return new TestSmtpClient(); - } - return new SmtpClientWrapper(); - - } - - } - -} \ No newline at end of file diff --git a/Mvc.Mailer/ExtensionMethods/UrlHelperExtensions.cs b/Mvc.Mailer/ExtensionMethods/UrlHelperExtensions.cs index e49c7a4..8a5caed 100644 --- a/Mvc.Mailer/ExtensionMethods/UrlHelperExtensions.cs +++ b/Mvc.Mailer/ExtensionMethods/UrlHelperExtensions.cs @@ -1,50 +1,41 @@ -using System.Web.Mvc; -using System; -using System.Web; -using System.Text; -using System.Configuration; - -namespace Mvc.Mailer -{ - public static class UrlHelperExtensions - { - public static readonly string BASE_URL_KEY = "MvcMailer.BaseUrl"; - - /// - /// This extension method will help generating Absolute Urls in the mailer or other views - /// - /// The object that gets the extended behavior - /// A relative or absolute URL to convert to Absolute - /// An absolute Url. e.g. http://domain:port/controller/action from /controller/action - public static string Abs(this UrlHelper urlHelper, string relativeOrAbsoluteUrl) - { - var uri = new Uri(relativeOrAbsoluteUrl, UriKind.RelativeOrAbsolute); - if (uri.IsAbsoluteUri) - { - return relativeOrAbsoluteUrl; - } - Uri combinedUri; - if (Uri.TryCreate(BaseUrl(urlHelper), relativeOrAbsoluteUrl, out combinedUri)) - { - return combinedUri.AbsoluteUri; - } - - throw new Exception(string.Format("Could not create absolute url for {0} using baseUri{0}", relativeOrAbsoluteUrl, BaseUrl(urlHelper))); - } - - - private static Uri BaseUrl(UrlHelper urlHelper) - { - string baseUrl = ConfigurationManager.AppSettings[BASE_URL_KEY]; - - //No configuration given, so use the one from the context - if(string.IsNullOrWhiteSpace(baseUrl)){ - baseUrl = urlHelper.RequestContext.HttpContext.Request.Url.GetLeftPart(UriPartial.Authority); - } - - return new Uri(baseUrl); - } - - } - -} +using System.Web.Mvc; +using System; +using System.Configuration; + +namespace Mvc.Mailer { + public static class UrlHelperExtensions { + public static readonly string BASE_URL_KEY = "MvcMailer.BaseUrl"; + + /// + /// This extension method will help generating Absolute Urls in the mailer or other views + /// + /// The object that gets the extended behavior + /// A relative or absolute URL to convert to Absolute + /// An absolute Url. e.g. http://domain:port/controller/action from /controller/action + public static string Abs(this UrlHelper urlHelper, string relativeOrAbsoluteUrl) { + var uri = new Uri(relativeOrAbsoluteUrl, UriKind.RelativeOrAbsolute); + if (uri.IsAbsoluteUri) { + return relativeOrAbsoluteUrl; + } + + Uri combinedUri; + if (Uri.TryCreate(BaseUrl(urlHelper), relativeOrAbsoluteUrl, out combinedUri)) { + return combinedUri.AbsoluteUri; + } + + throw new Exception(string.Format("Could not create absolute url for {0} using baseUri{0}", relativeOrAbsoluteUrl, BaseUrl(urlHelper))); + } + + + private static Uri BaseUrl(UrlHelper urlHelper) { + var baseUrl = ConfigurationManager.AppSettings[BASE_URL_KEY]; + + //No configuration given, so use the one from the context + if(string.IsNullOrWhiteSpace(baseUrl)){ + baseUrl = urlHelper.RequestContext.HttpContext.Request.Url.GetLeftPart(UriPartial.Authority); + } + + return new Uri(baseUrl); + } +} +} \ No newline at end of file diff --git a/Mvc.Mailer/ILinkedResourceProvider.cs b/Mvc.Mailer/ILinkedResourceProvider.cs index fb3537d..6c8d0a2 100644 --- a/Mvc.Mailer/ILinkedResourceProvider.cs +++ b/Mvc.Mailer/ILinkedResourceProvider.cs @@ -1,24 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Net.Mail; -using System.IO; - -namespace Mvc.Mailer -{ - /// - /// Declares the methods for creating LinkedResources - /// - public interface ILinkedResourceProvider - { - /// - /// Gets a list of resources given their Id and FilePath - /// - List GetAll(Dictionary resources); - /// - /// Gets a linked resources given its Id and FilePath - /// - LinkedResource Get(string contentId, string filePath); - } -} +using System.Collections.Generic; +using System.Net.Mail; + +namespace Mvc.Mailer { + /// + /// Declares the methods for creating LinkedResources + /// + public interface ILinkedResourceProvider { + /// + /// Gets a list of resources given their Id and FilePath + /// + List GetAll(Dictionary resources); + /// + /// Gets a linked resources given its Id and FilePath + /// + LinkedResource Get(string contentId, string filePath); + } +} diff --git a/Mvc.Mailer/IPostProcessor.cs b/Mvc.Mailer/IPostProcessor.cs new file mode 100644 index 0000000..18f3341 --- /dev/null +++ b/Mvc.Mailer/IPostProcessor.cs @@ -0,0 +1,7 @@ +namespace Mvc.Mailer +{ + public interface IPostProcessor + { + string Process(string body); + } +} \ No newline at end of file diff --git a/Mvc.Mailer/ISmtpClient.cs b/Mvc.Mailer/ISmtpClient.cs index cc2a04b..6cc90b5 100644 --- a/Mvc.Mailer/ISmtpClient.cs +++ b/Mvc.Mailer/ISmtpClient.cs @@ -1,16 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Net.Mail; - -namespace Mvc.Mailer -{ - public interface ISmtpClient : IDisposable - { - event SendCompletedEventHandler SendCompleted; - void Send(MailMessage mailMessage); - void SendAsync(MailMessage mailMessage); - void SendAsync(MailMessage mailMessage, object userState); - } -} +using System; +using System.Net.Mail; + +namespace Mvc.Mailer { + public interface ISmtpClient : IDisposable { + event SendCompletedEventHandler SendCompleted; + void Send(MailMessage mailMessage); + void SendAsync(MailMessage mailMessage); + void SendAsync(MailMessage mailMessage, object userState); + } +} diff --git a/Mvc.Mailer/LinkedResourceProvider.cs b/Mvc.Mailer/LinkedResourceProvider.cs index 8311f56..8c07037 100644 --- a/Mvc.Mailer/LinkedResourceProvider.cs +++ b/Mvc.Mailer/LinkedResourceProvider.cs @@ -1,46 +1,31 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Net.Mail; -using System.Net.Mime; -using System.IO; - -namespace Mvc.Mailer -{ - /// - /// This class is a utility class for instantiating LinkedResource objects - /// - public class LinkedResourceProvider : ILinkedResourceProvider - { - public virtual List GetAll(Dictionary resources) - { - var linkedResources = new List(); - foreach (var resource in resources) - { - linkedResources.Add(Get(resource.Key, resource.Value)); - } - return linkedResources; - } - - public virtual LinkedResource Get(string contentId, string filePath) - { - LinkedResource resource = new LinkedResource(filePath, GetContentType(filePath)); - resource.ContentId = contentId; - return resource; - } - - public virtual ContentType GetContentType(string fileName) - { - string ext = System.IO.Path.GetExtension(fileName).ToLower(); - - Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext); - - if (regKey != null && regKey.GetValue("Content Type") != null) - { - return new ContentType(regKey.GetValue("Content Type").ToString()); - } - return null; - } - } -} +using System.Collections.Generic; +using System.Linq; +using System.Net.Mail; +using System.Net.Mime; + +namespace Mvc.Mailer { + /// + /// This class is a utility class for instantiating LinkedResource objects + /// + public class LinkedResourceProvider : ILinkedResourceProvider { + public virtual List GetAll(Dictionary resources) { + return resources + .Select(resource => Get(resource.Key, resource.Value)) + .ToList(); + } + + public virtual LinkedResource Get(string contentId, string filePath) { + return new LinkedResource(filePath, GetContentType(filePath)) { ContentId = contentId }; + } + + public virtual ContentType GetContentType(string fileName) { + var ext = System.IO.Path.GetExtension(fileName).ToLower(); + + var regKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext); + if (regKey != null && regKey.GetValue("Content Type") != null) { + return new ContentType(regKey.GetValue("Content Type").ToString()); + } + return null; + } + } +} \ No newline at end of file diff --git a/Mvc.Mailer/MailerBase.cs b/Mvc.Mailer/MailerBase.cs index ecd7708..1d9b46a 100644 --- a/Mvc.Mailer/MailerBase.cs +++ b/Mvc.Mailer/MailerBase.cs @@ -1,325 +1,362 @@ -using System; -using System.Collections.Generic; -using System.Net.Mail; -using System.Net.Mime; -using System.Web; -using System.Configuration; -using System.Web.Mvc; -using System.Web.Routing; -using System.Text; - -namespace Mvc.Mailer -{ - /// - /// The Base class for Mailers. Your mailer should subclass MailerBase: - /// - public class MailerBase : ControllerBase - { - - /// - /// The parameterless constructor - /// - public MailerBase() - { - if (HttpContext.Current != null) - { - CurrentHttpContext = new HttpContextWrapper(HttpContext.Current); - } - else if (IsTestModeEnabled) - { - CurrentHttpContext = new EmptyHttpContext(); - } - - } - - private ILinkedResourceProvider _LinkedResourceProvider = new LinkedResourceProvider(); - /// - /// Uses the ILinkedResourceProvider to produce inline linked resources - /// - public virtual ILinkedResourceProvider LinkedResourceProvider - { - get { return _LinkedResourceProvider; } - set { _LinkedResourceProvider = value; } - } - - /// - /// The Path to the MasterPage or Layout - /// e.g. Razor: myMailer.MasterName = "_MyLayout.cshtml" - /// e.g. Aspx: myMailer.MasterName = "_MyLayout.Master" - /// - public virtual string MasterName - { - get; - set; - } - - /// - /// Nothing to Execute at this point, left blank - /// - protected override void ExecuteCore() - { - - } - - /// - /// This method generates the EmailBody from the given viewName, masterName - /// - /// @example: "WelcomeMessage" - /// @example: "_MyLayout.cshtml" if nothing is set, then the MasterName property will be used instead - /// the raw html content of the email view and its master page - public virtual string EmailBody(string viewName, string masterName=null) - { - - masterName = masterName ?? MasterName; - - var result = new StringResult - { - ViewName = viewName, - ViewData = ViewData, - MasterName = masterName ?? MasterName - }; - if(ControllerContext == null) - CreateControllerContext(); - result.ExecuteResult(ControllerContext, MailerName); - return result.Output; - } - - /// - /// Populates the mailMessage with content rendered from the view using the default masterName - /// - /// a non null System.Net.Mail.MailMessage reference - /// The name of the view file, e.g. WelcomeMessage - /// Key: linked resource id or CID, Value:Path to the resource - public virtual void PopulateBody(MailMessage mailMessage, string viewName, Dictionary linkedResources) - { - PopulateBody(mailMessage, viewName, null, linkedResources); - } - - /// - /// Populates the mailMessage with content rendered from the view using the provided masterName - /// - /// a non null System.Net.Mail.MailMessage reference - /// The name of the view file, e.g. WelcomeMessage - /// The name of the master file, e.g. Layout - /// Key: linked resource id or CID, Value:Path to the resource - public virtual void PopulateBody(MailMessage mailMessage, string viewName, string masterName = null, Dictionary linkedResources = null) - { - if (mailMessage == null) - { - throw new ArgumentNullException("mailMessage", "mailMessage cannot be null"); - } - - masterName = masterName ?? MasterName; - - var linkedResourcesPresent = linkedResources != null && linkedResources.Count > 0; - var textExists = TextViewExists(viewName, masterName); - - //if Text exists, it always goes to the body - if (textExists) - { - PopulateTextBody(mailMessage, viewName, masterName); - } - - // if html exists - if (HtmlViewExists(viewName, masterName)) - { - if (textExists || linkedResourcesPresent) - { - PopulateHtmlPart(mailMessage, viewName, masterName, linkedResources); - } - else - { - PopulateHtmlBody(mailMessage, viewName, masterName); - } - } - } - - /// - /// Populates a text/plain AlternateView inside the mailMessage - /// - public virtual AlternateView PopulateTextPart(MailMessage mailMessage, string viewName, string masterName) - { - return PopulatePart(mailMessage, TextViewName(viewName), "text/plain", TextMasterName(masterName)); - } - - /// - /// Populates the mailMessage.Body with a text/plain content - /// - /// The string containing the body - public virtual string PopulateTextBody(MailMessage mailMessage, string viewName, string masterName) - { - mailMessage.Body = EmailBody(TextViewName(viewName), TextMasterName(masterName)); - mailMessage.IsBodyHtml = false; - return mailMessage.Body; - } - - /// - /// Populates the mailMessage.Body with a text/html content and sets the IsBodyHtml to true - /// - /// The string containing the Html body - public virtual string PopulateHtmlBody(MailMessage mailMessage, string viewName, string masterName) - { - mailMessage.Body = EmailBody(viewName, masterName); - mailMessage.IsBodyHtml = true; - return mailMessage.Body; - } - - /// - /// Returns true if text view exists - /// - /// e.g. "Welcome" will look for "Welcome.text" - /// e.g. "Layout" will Look for "Layout.text" - public virtual bool TextViewExists(string viewName, string masterName) - { - return ViewExists(TextViewName(viewName), TextMasterName(masterName)); - } - - /// - /// Returns true if html view exists - /// - public virtual bool HtmlViewExists(string viewName, string masterName) - { - return ViewExists(viewName, masterName); - } - - - /// - /// Returns true if both text and html views are present - /// - public virtual bool IsMultiPart(string viewName, string masterName) - { - return TextViewExists(viewName, masterName) && HtmlViewExists(viewName, masterName); - } - - /// - /// Converts a view to its text view name - /// - /// e.g. Welcome - /// e.g. Welcome.text - public virtual string TextViewName(string viewName) - { - return viewName + ".text"; - } - - /// - /// Returns a text master name or null if blank string passed - /// - /// e.g. Layout - /// e.g. Layout.text - public virtual string TextMasterName(string masterName) - { - return string.IsNullOrEmpty(masterName) ? null : masterName + ".text"; - } - - /// - /// Populates a text/html AlternateView inside the mailMessage - /// - public virtual AlternateView PopulateHtmlPart(MailMessage mailMessage, string viewName, string masterName, Dictionary linkedResources) - { - var htmlPart = PopulatePart(mailMessage, viewName, "text/html", masterName); - if (htmlPart != null) - { - PopulateLinkedResources(htmlPart, linkedResources); - } - return htmlPart; - } - - /// - /// Populates an AlternateView inside the mailMessage - /// - /// e.g. text/plain, text/html etc. - public virtual AlternateView PopulatePart(MailMessage mailMessage, string viewName, string mime, string masterName = null) - { - masterName = masterName ?? MasterName; - if (ViewExists(viewName, masterName)) - { - var part = EmailBody(viewName, masterName); - var alternateView = AlternateView.CreateAlternateViewFromString(part, new ContentType(mime)); - mailMessage.AlternateViews.Add(alternateView); - return alternateView; - } - return null; - } - - /// - /// Adds LinkedResources to the mailPart - /// - public virtual List PopulateLinkedResources(AlternateView mailPart, Dictionary resources) - { - if(resources == null || resources.Count == 0) - return new List(); - - var linkedResources = LinkedResourceProvider.GetAll(resources); - linkedResources.ForEach(resource => mailPart.LinkedResources.Add(resource)); - return linkedResources; - } - - /// - /// Adds a single LinkedResource to a mailPart - /// - public virtual LinkedResource PopulateLinkedResource(AlternateView mailPart, string contentId, string fileName) - { - var linkedResource = LinkedResourceProvider.Get(contentId, fileName); - mailPart.LinkedResources.Add(linkedResource); - return linkedResource; - } - - - private ControllerContext CreateControllerContext() - { - var routeData = RouteTable.Routes.GetRouteData(CurrentHttpContext); - ControllerContext = new ControllerContext(CurrentHttpContext, routeData, this); - return ControllerContext; - } - - /// - /// The MailerName determines the folder that contains the views for this mailer - /// - protected virtual string MailerName - { - get - { - return this.GetType().Name;; - } - } - - - public virtual HttpContextBase CurrentHttpContext - { - get; - set; - } - - private static bool _isTestModeEnabled = false; - /// - /// If set to true, it will use TestSmtpClient instead of SmtpClient. Used solely for testing purpose - /// - public static bool IsTestModeEnabled - { - get { return _isTestModeEnabled; } - set { _isTestModeEnabled = value; } - } - - /// - /// Determines if a View exists given its name and masterName - /// - public virtual bool ViewExists(string viewName, string masterName) - { - if (ControllerContext == null) - CreateControllerContext(); - - var controllerName = this.ControllerContext.RouteData.Values["controller"]; - this.ControllerContext.RouteData.Values["controller"] = MailerName; - - try - { - return ViewEngines.Engines.FindView(this.ControllerContext, viewName, masterName).View != null; - } - finally - { - this.ControllerContext.RouteData.Values["controller"] = controllerName; - } - } - } - +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Mail; +using System.Net.Mime; +using System.Web; +using System.Web.Mvc; +using System.Web.Routing; + +namespace Mvc.Mailer +{ + /// + /// The Base class for Mailers. Your mailer should subclass MailerBase: + /// + public class MailerBase : ControllerBase + { + /// + /// The parameterless constructor + /// + public MailerBase() + { + if (HttpContext.Current != null) + { + CurrentHttpContext = new HttpContextWrapper(HttpContext.Current); + } + else if (IsTestModeEnabled) + { + CurrentHttpContext = new EmptyHttpContext(); + } + + } + + private ILinkedResourceProvider _linkedResourceProvider = new LinkedResourceProvider(); + /// + /// Uses the ILinkedResourceProvider to produce inline linked resources + /// + public virtual ILinkedResourceProvider LinkedResourceProvider + { + get { return _linkedResourceProvider; } + set { _linkedResourceProvider = value; } + } + + /// + /// The Path to the MasterPage or Layout + /// e.g. Razor: myMailer.MasterName = "_MyLayout.cshtml" + /// e.g. Aspx: myMailer.MasterName = "_MyLayout.Master" + /// + public virtual string MasterName { get; set; } + + /// + /// Nothing to Execute at this point, left blank + /// + protected override void ExecuteCore() + { + } + + /// + /// This method generates the EmailBody from the given viewName, masterName + /// + /// @example: "WelcomeMessage" + /// @example: "_MyLayout.cshtml" if nothing is set, then the MasterName property will be used instead + /// the raw html content of the email view and its master page + public virtual string EmailBody(string viewName, string masterName = null) + { + masterName = masterName ?? MasterName; + + var result = new StringResult + { + ViewName = viewName, + ViewData = ViewData, + MasterName = masterName ?? MasterName + }; + if (ControllerContext == null) + { + CreateControllerContext(); + } + result.ExecuteResult(ControllerContext, MailerName); + return result.Output; + } + + /// + /// Populates the mailMessage with content rendered from the view using the default masterName + /// + /// Action to be performed on a new message instance + public virtual MvcMailMessage Populate(Action action) + { + var message = new MvcMailMessage(); + + action(message); + PopulateBody(message, message.ViewName, message.MasterName, message.LinkedResources); + + return message; + } + + /// + /// Populates the mailMessage with content rendered from the view using the default masterName + /// + /// a non null System.Net.Mail.MailMessage reference + /// The name of the view file, e.g. WelcomeMessage + /// Key: linked resource id or CID, Value:Path to the resource + public virtual void PopulateBody(MailMessage mailMessage, string viewName, Dictionary linkedResources) + { + PopulateBody(mailMessage, viewName, null, linkedResources); + } + + /// + /// Populates the mailMessage with content rendered from the view using the provided masterName + /// + /// a non null System.Net.Mail.MailMessage reference + /// The name of the view file, e.g. WelcomeMessage + /// The name of the master file, e.g. Layout + /// Key: linked resource id or CID, Value:Path to the resource + public virtual void PopulateBody(MailMessage mailMessage, string viewName, string masterName = null, Dictionary linkedResources = null) + { + if (mailMessage == null) + { + throw new ArgumentNullException("mailMessage", "mailMessage cannot be null"); + } + + masterName = masterName ?? MasterName; + + var linkedResourcesPresent = linkedResources != null && linkedResources.Count > 0; + var textExists = TextViewExists(viewName, masterName); + + //if Text exists, it always goes to the body + if (textExists) + { + PopulateTextBody(mailMessage, viewName, masterName); + } + + // if html exists + if (!HtmlViewExists(viewName, masterName)) return; + + if (textExists || linkedResourcesPresent) + { + PopulateHtmlPart(mailMessage, viewName, masterName, linkedResources); + } + else + { + PopulateHtmlBody(mailMessage, viewName, masterName); + } + } + + /// + /// Populates a text/plain AlternateView inside the mailMessage + /// + public virtual AlternateView PopulateTextPart(MailMessage mailMessage, string viewName, string masterName) + { + return PopulatePart(mailMessage, TextViewName(viewName), "text/plain", TextMasterName(masterName)); + } + + /// + /// Populates the mailMessage.Body with a text/plain content + /// + /// The string containing the body + public virtual string PopulateTextBody(MailMessage mailMessage, string viewName, string masterName) + { + mailMessage.Body = EmailBody(TextViewName(viewName), TextMasterName(masterName)); + mailMessage.IsBodyHtml = false; + + return mailMessage.Body; + } + + /// + /// Populates the mailMessage.Body with a text/html content and sets the IsBodyHtml to true + /// + /// The string containing the Html body + public virtual string PopulateHtmlBody(MailMessage mailMessage, string viewName, string masterName) + { + var body = EmailBody(viewName, masterName); + body = PostprocessBody(Postprocessors, body); + mailMessage.Body = body; + mailMessage.IsBodyHtml = true; + + return mailMessage.Body; + } + + /// + /// Returns true if text view exists + /// + /// e.g. "Welcome" will look for "Welcome.text" + /// e.g. "Layout" will Look for "Layout.text" + public virtual bool TextViewExists(string viewName, string masterName) + { + return ViewExists(TextViewName(viewName), TextMasterName(masterName)); + } + + /// + /// Returns true if html view exists + /// + public virtual bool HtmlViewExists(string viewName, string masterName) + { + return ViewExists(viewName, masterName); + } + + + /// + /// Returns true if both text and html views are present + /// + public virtual bool IsMultiPart(string viewName, string masterName) + { + return TextViewExists(viewName, masterName) && HtmlViewExists(viewName, masterName); + } + + /// + /// Converts a view to its text view name + /// + /// e.g. Welcome + /// e.g. Welcome.text + public virtual string TextViewName(string viewName) + { + return viewName + ".text"; + } + + /// + /// Returns a text master name or null if blank string passed + /// + /// e.g. Layout + /// e.g. Layout.text + public virtual string TextMasterName(string masterName) + { + return string.IsNullOrEmpty(masterName) ? null : masterName + ".text"; + } + + /// + /// Populates a text/html AlternateView inside the mailMessage + /// + public virtual AlternateView PopulateHtmlPart(MailMessage mailMessage, string viewName, string masterName, Dictionary linkedResources) + { + var htmlPart = PopulatePart(mailMessage, viewName, "text/html", masterName); + if (htmlPart != null) + { + PopulateLinkedResources(htmlPart, linkedResources); + } + + return htmlPart; + } + + /// + /// Populates an AlternateView inside the mailMessage + /// + /// e.g. text/plain, text/html etc. + public virtual AlternateView PopulatePart(MailMessage mailMessage, string viewName, string mime, string masterName = null) + { + masterName = masterName ?? MasterName; + if (ViewExists(viewName, masterName)) + { + var part = EmailBody(viewName, masterName); + var alternateView = AlternateView.CreateAlternateViewFromString(part, new ContentType(mime)); + mailMessage.AlternateViews.Add(alternateView); + return alternateView; + } + + return null; + } + + /// + /// Adds LinkedResources to the mailPart + /// + public virtual List PopulateLinkedResources(AlternateView mailPart, Dictionary resources) + { + if (resources == null || resources.Count == 0) + { + return new List(); + } + + var linkedResources = LinkedResourceProvider.GetAll(resources); + linkedResources.ForEach(resource => mailPart.LinkedResources.Add(resource)); + + return linkedResources; + } + + /// + /// Adds a single LinkedResource to a mailPart + /// + public virtual LinkedResource PopulateLinkedResource(AlternateView mailPart, string contentId, string fileName) + { + var linkedResource = LinkedResourceProvider.Get(contentId, fileName); + mailPart.LinkedResources.Add(linkedResource); + + return linkedResource; + } + + private void CreateControllerContext() + { + var routeData = RouteTable.Routes.GetRouteData(CurrentHttpContext); + ControllerContext = new ControllerContext(CurrentHttpContext, routeData, this); + } + + /// + /// The MailerName determines the folder that contains the views for this mailer + /// + protected virtual string MailerName { get { return GetType().Name; } } + + public virtual HttpContextBase CurrentHttpContext { get; set; } + + /// + /// If set to true, it will use TestSmtpClient instead of SmtpClient. Used solely for testing purpose + /// + public static bool IsTestModeEnabled { get; set; } + + /// + /// Determines if a View exists given its name and masterName + /// + public virtual bool ViewExists(string viewName, string masterName) + { + if (ControllerContext == null) + { + CreateControllerContext(); + } + + var controllerName = ControllerContext.RouteData.Values["controller"]; + ControllerContext.RouteData.Values["controller"] = MailerName; + + try + { + return ViewEngines.Engines.FindView(ControllerContext, viewName, masterName).View != null; + } + finally + { + ControllerContext.RouteData.Values["controller"] = controllerName; + } + } + + + #region "PostProcessors" + public static void RegisterPostprocessor(T instance) where T : IPostProcessor + { + ValidatePostprocessor(instance); + Postprocessors.Add(instance); + } + + static void ValidatePostprocessor(IPostProcessor instance) + { + if (Postprocessors.Any(p => p.GetType() == typeof(T))) + { + throw new InvalidOperationException(string.Format("Can't add multiple postprocessors of type: {0}", typeof(T).FullName)); + } + } + + internal static readonly IList Postprocessors = new List(); + + internal void AddPostprocessor(IPostProcessor instance) + { + if (!Postprocessors.Any(ipp => ipp.GetType() == instance.GetType())) + { + Postprocessors.Add(instance); + } + } + + protected string PostprocessBody(IEnumerable postprocessors, string body) + { + if (postprocessors == null) + { + return body; + } + return postprocessors.Aggregate(body, (cntnt, pp) => pp.Process(body)); + } + #endregion + } + } \ No newline at end of file diff --git a/Mvc.Mailer/Mvc.Mailer.csproj b/Mvc.Mailer/Mvc.Mailer.csproj index ad765f9..960a53e 100644 --- a/Mvc.Mailer/Mvc.Mailer.csproj +++ b/Mvc.Mailer/Mvc.Mailer.csproj @@ -1,106 +1,98 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {37B58562-EF1A-47FE-A02E-98C82D5FB5BC} - Library - Properties - Mvc.Mailer - Mvc.Mailer - v4.0 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Always - - - Always - Designer - - - - - - - - - - - - - - - - - - - Designer - - - - - - copy *.dll "$(ProjectDir)NuGet\input\lib\40" -xcopy content "$(ProjectDir)NuGet\input\content" /S /Y -cd "$(ProjectDir)NuGet" -IF NOT EXIST output md output -nuget pack mvcmailer.nuspec -b input -o output - - - + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {37B58562-EF1A-47FE-A02E-98C82D5FB5BC} + Library + Properties + Mvc.Mailer + Mvc.Mailer + v4.0 + 512 + + true + ..\ + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + D:\Desarrollo\nuget + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nuget pack $(ProjectPath) -Prop Configuration=Release -o $(NugetPath) + + + \ No newline at end of file diff --git a/Mvc.Mailer/Mvc.Mailer.nuspec b/Mvc.Mailer/Mvc.Mailer.nuspec new file mode 100644 index 0000000..c4a8aaf --- /dev/null +++ b/Mvc.Mailer/Mvc.Mailer.nuspec @@ -0,0 +1,24 @@ + + + + $id$ + $version$ + $title$ + $author$ + Hernan Marano + https://github.com/hernangm/MvcMailer + http://www.opensource.org/licenses/mit-license.php + false + This is MvcMailer extended to apply processors to html body after render + Postprocessors can be registered and configures so they are applied to html contents. + Copyright 2013 + aspmvc, mvcmailer + + + + + + + + + \ No newline at end of file diff --git a/Mvc.Mailer/MvcMailMessage.cs b/Mvc.Mailer/MvcMailMessage.cs new file mode 100644 index 0000000..15c301c --- /dev/null +++ b/Mvc.Mailer/MvcMailMessage.cs @@ -0,0 +1,44 @@ +using System.Collections.Generic; +using System.Net.Mail; + +namespace Mvc.Mailer { + public class MvcMailMessage : MailMessage { + public string ViewName { get; set; } + public string MasterName { get; set; } + public Dictionary LinkedResources { get; set; } + + /// + /// Sends a MailMessage using smtpClient + /// + /// leave null to use default System.Net.Mail.SmtpClient + public virtual void Send(ISmtpClient smtpClient = null) + { + smtpClient = smtpClient ?? GetSmtpClient(); + using (smtpClient) + { + smtpClient.Send(this); + } + } + + /// + /// Asynchronously Sends a MailMessage using smtpClient + /// + /// The userState + /// leave null to use default System.Net.Mail.SmtpClient + public virtual void SendAsync(object userState = null, ISmtpClient smtpClient = null) + { + smtpClient = smtpClient ?? GetSmtpClient(); + smtpClient.SendAsync(this, userState); + } + + public virtual ISmtpClient GetSmtpClient() + { + if (MailerBase.IsTestModeEnabled) + { + return new TestSmtpClient(); + } + return new SmtpClientWrapper(); + } + + } +} diff --git a/Mvc.Mailer/NuGet/MvcMailer.nuspec b/Mvc.Mailer/NuGet/MvcMailer.nuspec deleted file mode 100644 index 662b855..0000000 --- a/Mvc.Mailer/NuGet/MvcMailer.nuspec +++ /dev/null @@ -1,19 +0,0 @@ - - - - MvcMailer - 1.2 - S. M. SOHAN - -MvcMailer sends emails using the MVC views as Email Body with no effort. Here's a quick list of features: a) Use Razor/WebForms views b) Use Master pages c) Write Testable Code d) Pass values to your view using ViewBag or ViewModel and e) Generate Absolute URL using Url.Abs method and f) create multi-part emails by just adding a view file, g) scaffold your mailers. -MvcMailer has a MailerBase class that extends ControllerBase class. So, Mailers are just like your Controllers. As a result, you can use all the controller goodies without any learning curve, period. The end result is a professional looking HTML email body ready for your to send to your website users. -Visit the Project site for a comprehensive tutorial on MvcMailer. - - - - - en-US - https://github.com/smsohan/MvcMailer - http://www.opensource.org/licenses/mit-license.php - - \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/NuGet.exe b/Mvc.Mailer/NuGet/NuGet.exe deleted file mode 100644 index 1c01932..0000000 Binary files a/Mvc.Mailer/NuGet/NuGet.exe and /dev/null differ diff --git a/Mvc.Mailer.Test/bin/Debug/content/Views/web.config.transform b/Mvc.Mailer/NuGet/content/Views/web.config.transform similarity index 97% rename from Mvc.Mailer.Test/bin/Debug/content/Views/web.config.transform rename to Mvc.Mailer/NuGet/content/Views/web.config.transform index be4c33d..aed0db8 100644 --- a/Mvc.Mailer.Test/bin/Debug/content/Views/web.config.transform +++ b/Mvc.Mailer/NuGet/content/Views/web.config.transform @@ -1,19 +1,19 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/Mvc.Mailer/NuGet/input/content/web.config.transform b/Mvc.Mailer/NuGet/content/web.config.transform similarity index 96% rename from Mvc.Mailer/NuGet/input/content/web.config.transform rename to Mvc.Mailer/NuGet/content/web.config.transform index 8429770..e5f3469 100644 --- a/Mvc.Mailer/NuGet/input/content/web.config.transform +++ b/Mvc.Mailer/NuGet/content/web.config.transform @@ -1,23 +1,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/input/content/Views/web.config.transform b/Mvc.Mailer/NuGet/input/content/Views/web.config.transform deleted file mode 100644 index be4c33d..0000000 --- a/Mvc.Mailer/NuGet/input/content/Views/web.config.transform +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/Mvc.Mailer/NuGet/input/lib/40/Mvc.Mailer.dll b/Mvc.Mailer/NuGet/input/lib/40/Mvc.Mailer.dll deleted file mode 100644 index 51a30ec..0000000 Binary files a/Mvc.Mailer/NuGet/input/lib/40/Mvc.Mailer.dll and /dev/null differ diff --git a/Mvc.Mailer/NuGet/input/tools/cs/IMailerTemplate.cs.t4 b/Mvc.Mailer/NuGet/input/tools/cs/IMailerTemplate.cs.t4 deleted file mode 100644 index 54c137c..0000000 --- a/Mvc.Mailer/NuGet/input/tools/cs/IMailerTemplate.cs.t4 +++ /dev/null @@ -1,21 +0,0 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="cs" #> -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using Mvc.Mailer; -using System.Net.Mail; - -namespace <#= Model.Namespace #>.Mailers -{ - public interface I<#= Model.MailerName #> - { - <# foreach(var mailerMethod in Model.MailerMethods) {#> - - MailMessage <#= mailerMethod #>(); - - <# } #> - - } -} \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/input/tools/cs/MailerMethodTemplate.cs.t4 b/Mvc.Mailer/NuGet/input/tools/cs/MailerMethodTemplate.cs.t4 deleted file mode 100644 index 654239e..0000000 --- a/Mvc.Mailer/NuGet/input/tools/cs/MailerMethodTemplate.cs.t4 +++ /dev/null @@ -1,14 +0,0 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="cs" #> - -public virtual MailMessage <#= Model.MethodName #>() -{ - var mailMessage = new MailMessage{Subject = "<#= Model.MethodName #>"}; - - //mailMessage.To.Add("some-email@example.com"); - //ViewBag.Data = someObject; - PopulateBody(mailMessage, viewName: "<#= Model.MethodName #>"); - - return mailMessage; -} - diff --git a/Mvc.Mailer/NuGet/input/tools/cs/MailerTemplate.cs.t4 b/Mvc.Mailer/NuGet/input/tools/cs/MailerTemplate.cs.t4 deleted file mode 100644 index 6cf1ec3..0000000 --- a/Mvc.Mailer/NuGet/input/tools/cs/MailerTemplate.cs.t4 +++ /dev/null @@ -1,37 +0,0 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="cs" #> -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using Mvc.Mailer; -using System.Net.Mail; - -namespace <#= Model.Namespace #>.Mailers -{ - public class <#= Model.MailerName #> : MailerBase<# if( Model.Interface) { #>, I<#= Model.MailerName #> <# } #> - - { - public <#= Model.MailerName #>(): - base() - { - MasterName="_Layout"; - } - - <# foreach(var mailerMethod in Model.MailerMethods) {#> - - public virtual MailMessage <#= mailerMethod #>() - { - var mailMessage = new MailMessage{Subject = "<#= mailerMethod #>"}; - - //mailMessage.To.Add("some-email@example.com"); - //ViewBag.Data = someObject; - PopulateBody(mailMessage, viewName: "<#= mailerMethod #>"); - - return mailMessage; - } - - <# } #> - - } -} \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/input/tools/view/aspx/Layout.Master.cs.t4 b/Mvc.Mailer/NuGet/input/tools/view/aspx/Layout.Master.cs.t4 deleted file mode 100644 index c5671dd..0000000 --- a/Mvc.Mailer/NuGet/input/tools/view/aspx/Layout.Master.cs.t4 +++ /dev/null @@ -1,17 +0,0 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="Master" #> -<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> - - - - - - <asp:ContentPlaceHolder ID="TitleContent" runat="server" /> - - -
- - -
- - diff --git a/Mvc.Mailer/NuGet/input/tools/view/aspx/Mail.aspx.cs.t4 b/Mvc.Mailer/NuGet/input/tools/view/aspx/Mail.aspx.cs.t4 deleted file mode 100644 index 02260d9..0000000 --- a/Mvc.Mailer/NuGet/input/tools/view/aspx/Mail.aspx.cs.t4 +++ /dev/null @@ -1,11 +0,0 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="aspx" #> - -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/<#= Model.MailerName #>/_Layout.Master" Inherits="System.Web.Mvc.ViewPage" %> - - - - - - HTML View for <#= Model.MailerName #>#<#= Model.ViewName #> - diff --git a/Mvc.Mailer/NuGet/input/tools/view/razor/Layout.cshtml.cs.t4 b/Mvc.Mailer/NuGet/input/tools/view/razor/Layout.cshtml.cs.t4 deleted file mode 100644 index 4510093..0000000 --- a/Mvc.Mailer/NuGet/input/tools/view/razor/Layout.cshtml.cs.t4 +++ /dev/null @@ -1,8 +0,0 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="cshtml" #> - - - - @RenderBody() - - \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/input/tools/view/razor/Layout.text.cshtml.cs.t4 b/Mvc.Mailer/NuGet/input/tools/view/razor/Layout.text.cshtml.cs.t4 deleted file mode 100644 index 5e8860b..0000000 --- a/Mvc.Mailer/NuGet/input/tools/view/razor/Layout.text.cshtml.cs.t4 +++ /dev/null @@ -1,4 +0,0 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="text.cshtml" #> - -@RenderBody() \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/input/tools/view/razor/Mail.text.cshtml.cs.t4 b/Mvc.Mailer/NuGet/input/tools/view/razor/Mail.text.cshtml.cs.t4 deleted file mode 100644 index 7c6719d..0000000 --- a/Mvc.Mailer/NuGet/input/tools/view/razor/Mail.text.cshtml.cs.t4 +++ /dev/null @@ -1,4 +0,0 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="text.cshtml" #> - -Text View for <#= Model.MailerName #>#<#= Model.ViewName #> \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.0.9.nupkg b/Mvc.Mailer/NuGet/output/MvcMailer.0.9.nupkg deleted file mode 100644 index e35cd64..0000000 Binary files a/Mvc.Mailer/NuGet/output/MvcMailer.0.9.nupkg and /dev/null differ diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg.zip b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg.zip deleted file mode 100644 index e55c3b7..0000000 Binary files a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg.zip and /dev/null differ diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/MvcMailer.nuspec b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/MvcMailer.nuspec deleted file mode 100644 index 1768958..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/MvcMailer.nuspec +++ /dev/null @@ -1,19 +0,0 @@ - - - - MvcMailer - 1.0 - S. M. SOHAN - S. M. SOHAN - http://www.opensource.org/licenses/mit-license.php - https://github.com/smsohan/MvcMailer - false - MvcMailer sends emails using the MVC views as Email Body with no effort. Here's a quick list of features: a) Use Razor/WebForms views b) Use Master pages c) Write Testable Code d) Pass values to your view using ViewBag or ViewModel and e) Generate Absolute URL using Url.Abs method and f) create multi-part emails by just adding a view file, g) scaffold your mailers. -MvcMailer has a MailerBase class that extends ControllerBase class. So, Mailers are just like your Controllers. As a result, you can use all the controller goodies without any learning curve, period. The end result is a professional looking HTML email body ready for your to send to your website users. -Visit the Project site for a comprehensive tutorial on MvcMailer. - en-US - - - - - \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/[Content_Types].xml b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/[Content_Types].xml deleted file mode 100644 index 349a253..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/[Content_Types].xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/_rels/.rels b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/_rels/.rels deleted file mode 100644 index 62e2aed..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/_rels/.rels +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/content/Views/web.config.transform b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/content/Views/web.config.transform deleted file mode 100644 index be4c33d..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/content/Views/web.config.transform +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/content/web.config.transform b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/content/web.config.transform deleted file mode 100644 index ad7aab0..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/content/web.config.transform +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/lib/40/Mvc.Mailer.dll b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/lib/40/Mvc.Mailer.dll deleted file mode 100644 index 98146fb..0000000 Binary files a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/lib/40/Mvc.Mailer.dll and /dev/null differ diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/package/services/metadata/core-properties/4804fa45523146db9b92d69c26d99f92.psmdcp b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/package/services/metadata/core-properties/4804fa45523146db9b92d69c26d99f92.psmdcp deleted file mode 100644 index a83402d..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/package/services/metadata/core-properties/4804fa45523146db9b92d69c26d99f92.psmdcp +++ /dev/null @@ -1,3 +0,0 @@ -S. M. SOHANMvcMailer sends emails using the MVC views as Email Body with no effort. Here's a quick list of features: a) Use Razor/WebForms views b) Use Master pages c) Write Testable Code d) Pass values to your view using ViewBag or ViewModel and e) Generate Absolute URL using Url.Abs method and f) create multi-part emails by just adding a view file, g) scaffold your mailers. -MvcMailer has a MailerBase class that extends ControllerBase class. So, Mailers are just like your Controllers. As a result, you can use all the controller goodies without any learning curve, period. The end result is a professional looking HTML email body ready for your to send to your website users. -Visit the Project site for a comprehensive tutorial on MvcMailer.MvcMailer1.0en-US \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/Install.ps1 b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/Install.ps1 deleted file mode 100644 index 792252a..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/Install.ps1 +++ /dev/null @@ -1,38 +0,0 @@ -param($rootPath, $toolsPath, $package, $project) - -### Copied from MvcScaffolding -function CountSolutionFilesByExtension($extension) { - $files = (Get-Project).DTE.Solution ` - | ?{ $_.FileName } ` - | %{ [System.IO.Path]::GetDirectoryName($_.FileName) } ` - | %{ [System.IO.Directory]::EnumerateFiles($_, "*." + $extension, [System.IO.SearchOption]::AllDirectories) } - ($files | Measure-Object).Count -} - -function InferPreferredViewEngine() { - # Assume you want Razor except if you already have some ASPX views and no Razor ones - if ((CountSolutionFilesByExtension aspx) -eq 0) { return "razor" } - if (((CountSolutionFilesByExtension cshtml) -gt 0) -or ((CountSolutionFilesByExtension vbhtml) -gt 0)) { return "razor" } - return "aspx" -} - -# Infer which view engine you're using based on the files in your project -### End copied - -$mailerScaffolder = if ([string](InferPreferredViewEngine) -eq 'aspx') { "Mailer.Aspx" } else { "Mailer.Razor" } -Set-DefaultScaffolder -Name Mailer -Scaffolder $mailerScaffolder -SolutionWide -DoNotOverwriteExistingSetting - -Write-Host -Write-Host - -Write-Host ---------------------------READ ME--------------------------------------------------- -Write-Host -Write-Host Your default Mailer Scaffolder is set to $mailerScaffolder -Write-Host -Write-Host You can generate your Mailers and Views using the following Scaffolder Command -Write-Host -Write-Host "PM> Scaffold Mailer UserMailer Welcome,GoodBye" -Write-Host -Write-Host You can find more at: https://github.com/smsohan/MvcMailer/wiki/MvcMailer-Step-by-Step-Guide -Write-Host -Write-Host ------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/Mailer.Aspx.ps1 b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/Mailer.Aspx.ps1 deleted file mode 100644 index aef0ae3..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/Mailer.Aspx.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -[T4Scaffolding.Scaffolder(Description = "Scaffold your mailers using ASPX view")][CmdletBinding()] -param( - [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$MailerName, - [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string[]]$MailerMethods, - [switch]$WithText = $false, - [switch]$NoInterface = $false, - [string]$Project, - [string]$CodeLanguage, - [string[]]$TemplateFolders, - [switch]$Force = $false -) - -$script_dir = Split-Path -Parent $MyInvocation.MyCommand.Path -. "$script_dir\MailerFunctions.ps1" - -CreateCSFiles $NoInterface -CreateLayoutAndViews $WithText $true \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/Mailer.Razor.ps1 b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/Mailer.Razor.ps1 deleted file mode 100644 index 0ef04a6..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/Mailer.Razor.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -[T4Scaffolding.Scaffolder(Description = "Scaffold your mailers using Razor Views")][CmdletBinding()] -param( - [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$MailerName, - [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string[]]$MailerMethods, - [switch]$WithText = $false, - [switch]$NoInterface = $false, - [string]$Project, - [string]$CodeLanguage, - [string[]]$TemplateFolders, - [switch]$Force = $false -) - -$script_dir = Split-Path -Parent $MyInvocation.MyCommand.Path -. "$script_dir\MailerFunctions.ps1" - -CreateCSFiles $NoInterface -CreateLayoutAndViews $WithText $false \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/MailerFunctions.ps1 b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/MailerFunctions.ps1 deleted file mode 100644 index 3ecd78f..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/MailerFunctions.ps1 +++ /dev/null @@ -1,120 +0,0 @@ -########################################################### -### ### -### FUNCTIONS ### -### ### -########################################################### -function CreateCSFileFromTemplate -{ - param ($MailerTemplate, $outputPath, $NoInterface) - - $outputFolder = "Mailers" - - $isInterface = $true - if($NoInterface) - { - $isInterface = $false - } - - - $templateFile = Find-ScaffolderTemplate cs\$MailerTemplate -TemplateFolders $TemplateFolders -Project $Project -CodeLanguage $CodeLanguage -ErrorIfNotFound - if ($templateFile) { - # Render it, adding the output to the Visual Studio project - $namespace = (Get-Project $Project).Properties.Item("DefaultNamespace").Value - $wroteFile = Invoke-ScaffoldTemplate -Template $templateFile -Model @{ - Namespace = $namespace; - MailerName = $MailerName; - MailerMethods = $MailerMethods; - Interface = $isInterface; - } -Project $Project -OutputPath $outputFolder\$outputPath -Force:$Force - if($wroteFile) { - Write-Host "Added MvcMailer output '$wroteFile'" - } - } -} - -function CreateCSFiles -{ - param($NoInterface) - - if(! $NoInterface) - { - CreateCSFileFromTemplate IMailerTemplate I$MailerName $Interface - } - CreateCSFileFromTemplate MailerTemplate $MailerName $NoInterface -} - -function CreateViewFileFromTemplate -{ - param ($ViewTemplate, $viewPath, $viewName='') - - $templateFile = Find-ScaffolderTemplate view\$ViewTemplate -TemplateFolders $TemplateFolders -Project $Project -CodeLanguage $CodeLanguage -ErrorIfNotFound - $namespace = (Get-Project $Project).Properties.Item("DefaultNamespace").Value - - if ($templateFile) { - $wroteFile = Invoke-ScaffoldTemplate -Template $templateFile -Model @{ - Namespace = $namespace; - MailerName=$MailerName; - ViewName=$viewName; - } -Project $Project -OutputPath $viewPath -Force:$force - if($wroteFile) { - Write-Host "Added MyScaffolder output '$wroteFile'" - } - } -} - -function CreateLayoutAndViews -{ - param($Text, $Aspx) - - - $viewExtension = '' - $masterExtension = '' - - if($Aspx){ - $viewExtension = "aspx" - $masterExtension = "Master" - } - else - { - $viewExtension = "cshtml" - $masterExtension = "cshtml" - } - - # HTML Views - CreateViewFileFromTemplate Layout.$masterExtension Views\$MailerName\_Layout - foreach ($viewName in $MailerMethods) - { - CreateViewFileFromTemplate Mail.$viewExtension Views\$MailerName\$viewName $viewName - } - - # Text Views - if($Text) - { - CreateViewFileFromTemplate Layout.text.$masterExtension Views\$MailerName\_Layout - foreach ($viewName in $MailerMethods) - { - CreateViewFileFromTemplate Mail.text.$viewExtension Views\$MailerName\$viewName $viewName - } - } -} - - -#function DeleteMailer -#{ -# param($Project, $MailerName) -# -# Remove-Item $Project\Mailers\$MailerName.cs -# Remove-Item $Project\Mailers\I$MailerName.cs -# Remove-Item $Project\Views\$MailerName\* -#} -# -#function DeleteMailers -#{ -# param($Project, $MailerNames) -# -# foreach($mailerName in $MailerNames) -# { -# DeleteMailer($Project, $mailerName) -# } -#} -######## END FUNCTIONS #################################### \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/cs/MailerTemplate.cs.t4 b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/cs/MailerTemplate.cs.t4 deleted file mode 100644 index 6cf1ec3..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/cs/MailerTemplate.cs.t4 +++ /dev/null @@ -1,37 +0,0 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="cs" #> -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using Mvc.Mailer; -using System.Net.Mail; - -namespace <#= Model.Namespace #>.Mailers -{ - public class <#= Model.MailerName #> : MailerBase<# if( Model.Interface) { #>, I<#= Model.MailerName #> <# } #> - - { - public <#= Model.MailerName #>(): - base() - { - MasterName="_Layout"; - } - - <# foreach(var mailerMethod in Model.MailerMethods) {#> - - public virtual MailMessage <#= mailerMethod #>() - { - var mailMessage = new MailMessage{Subject = "<#= mailerMethod #>"}; - - //mailMessage.To.Add("some-email@example.com"); - //ViewBag.Data = someObject; - PopulateBody(mailMessage, viewName: "<#= mailerMethod #>"); - - return mailMessage; - } - - <# } #> - - } -} \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/aspx/Layout.text.Master.cs.t4 b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/aspx/Layout.text.Master.cs.t4 deleted file mode 100644 index 04022cb..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/aspx/Layout.text.Master.cs.t4 +++ /dev/null @@ -1,5 +0,0 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="text.Master" #> -<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> - - diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/aspx/Mail.text.aspx.cs.t4 b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/aspx/Mail.text.aspx.cs.t4 deleted file mode 100644 index d9f7fe0..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/aspx/Mail.text.aspx.cs.t4 +++ /dev/null @@ -1,8 +0,0 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="text.aspx" #> - -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/<#= Model.MailerName #>/_Layout.text.Master" Inherits="System.Web.Mvc.ViewPage" %> - - - TEXT View for <#= Model.MailerName #>#<#= Model.ViewName #> - diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/razor/Mail.cshtml.cs.t4 b/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/razor/Mail.cshtml.cs.t4 deleted file mode 100644 index d56fdc4..0000000 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/razor/Mail.cshtml.cs.t4 +++ /dev/null @@ -1,4 +0,0 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="cshtml" #> - -HTML View for <#= Model.MailerName #>#<#= Model.ViewName #> \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.1.nupkg b/Mvc.Mailer/NuGet/output/MvcMailer.1.1.nupkg deleted file mode 100644 index 243c16a..0000000 Binary files a/Mvc.Mailer/NuGet/output/MvcMailer.1.1.nupkg and /dev/null differ diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.2.nupkg b/Mvc.Mailer/NuGet/output/MvcMailer.1.2.nupkg deleted file mode 100644 index 892b2cb..0000000 Binary files a/Mvc.Mailer/NuGet/output/MvcMailer.1.2.nupkg and /dev/null differ diff --git a/Mvc.Mailer/NuGet/input/tools/Install.ps1 b/Mvc.Mailer/NuGet/tools/Install.ps1 similarity index 97% rename from Mvc.Mailer/NuGet/input/tools/Install.ps1 rename to Mvc.Mailer/NuGet/tools/Install.ps1 index 8bea077..9e9c43d 100644 --- a/Mvc.Mailer/NuGet/input/tools/Install.ps1 +++ b/Mvc.Mailer/NuGet/tools/Install.ps1 @@ -1,40 +1,40 @@ -param($rootPath, $toolsPath, $package, $project) - -### Copied from MvcScaffolding -function CountSolutionFilesByExtension($extension) { - $files = (Get-Project).DTE.Solution ` - | ?{ $_.FileName } ` - | %{ [System.IO.Path]::GetDirectoryName($_.FileName) } ` - | %{ [System.IO.Directory]::EnumerateFiles($_, "*." + $extension, [System.IO.SearchOption]::AllDirectories) } - ($files | Measure-Object).Count -} - -function InferPreferredViewEngine() { - # Assume you want Razor except if you already have some ASPX views and no Razor ones - if ((CountSolutionFilesByExtension aspx) -eq 0) { return "razor" } - if (((CountSolutionFilesByExtension cshtml) -gt 0) -or ((CountSolutionFilesByExtension vbhtml) -gt 0)) { return "razor" } - return "aspx" -} - -# Infer which view engine you're using based on the files in your project -### End copied - -$mailerScaffolder = if ([string](InferPreferredViewEngine) -eq 'aspx') { "Mailer.Aspx" } else { "Mailer.Razor" } -Set-DefaultScaffolder -Name Mailer -Scaffolder $mailerScaffolder -SolutionWide -DoNotOverwriteExistingSetting - -Write-Host -Write-Host - -Write-Host ---------------------------READ ME--------------------------------------------------- -Write-Host -Write-Host Your default Mailer Scaffolder is set to $mailerScaffolder -Write-Host -Write-Host You can generate your Mailers and Views using the following Scaffolder Command -Write-Host -Write-Host "PM> Scaffold Mailer UserMailer Welcome,GoodBye" -Write-Host -Write-Host Edit the smtp configuration at web.config file before you send an email -Write-Host -Write-Host You can find more at: https://github.com/smsohan/MvcMailer/wiki/MvcMailer-Step-by-Step-Guide -Write-Host +param($rootPath, $toolsPath, $package, $project) + +### Copied from MvcScaffolding +function CountSolutionFilesByExtension($extension) { + $files = (Get-Project).DTE.Solution ` + | ?{ $_.FileName } ` + | %{ [System.IO.Path]::GetDirectoryName($_.FileName) } ` + | %{ [System.IO.Directory]::EnumerateFiles($_, "*." + $extension, [System.IO.SearchOption]::AllDirectories) } + ($files | Measure-Object).Count +} + +function InferPreferredViewEngine() { + # Assume you want Razor except if you already have some ASPX views and no Razor ones + if ((CountSolutionFilesByExtension aspx) -eq 0) { return "razor" } + if (((CountSolutionFilesByExtension cshtml) -gt 0) -or ((CountSolutionFilesByExtension vbhtml) -gt 0)) { return "razor" } + return "aspx" +} + +# Infer which view engine you're using based on the files in your project +### End copied + +$mailerScaffolder = if ([string](InferPreferredViewEngine) -eq 'aspx') { "Mailer.Aspx" } else { "Mailer.Razor" } +Set-DefaultScaffolder -Name Mailer -Scaffolder $mailerScaffolder -SolutionWide -DoNotOverwriteExistingSetting + +Write-Host +Write-Host + +Write-Host ---------------------------READ ME--------------------------------------------------- +Write-Host +Write-Host Your default Mailer Scaffolder is set to $mailerScaffolder +Write-Host +Write-Host You can generate your Mailers and Views using the following Scaffolder Command +Write-Host +Write-Host "PM> Scaffold Mailer UserMailer Welcome,GoodBye" +Write-Host +Write-Host Edit the smtp configuration at web.config file before you send an email +Write-Host +Write-Host You can find more at: https://github.com/smsohan/MvcMailer/wiki/MvcMailer-Step-by-Step-Guide +Write-Host Write-Host ------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/input/tools/Mailer.Aspx.ps1 b/Mvc.Mailer/NuGet/tools/Mailer.Aspx.ps1 similarity index 97% rename from Mvc.Mailer/NuGet/input/tools/Mailer.Aspx.ps1 rename to Mvc.Mailer/NuGet/tools/Mailer.Aspx.ps1 index 74f516c..51982f4 100644 --- a/Mvc.Mailer/NuGet/input/tools/Mailer.Aspx.ps1 +++ b/Mvc.Mailer/NuGet/tools/Mailer.Aspx.ps1 @@ -1,17 +1,17 @@ -[T4Scaffolding.Scaffolder(Description = "Scaffold your mailers using ASPX view")][CmdletBinding()] -param( - [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$MailerName, - [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string[]]$MailerMethods, - [switch]$WithText = $false, - [switch]$NoInterface = $false, - [string]$Project, - [string]$CodeLanguage, - [string[]]$TemplateFolders, - [switch]$Force = $false -) - -$script_dir = Split-Path -Parent $MyInvocation.MyCommand.Path -. "$script_dir\MailerFunctions.ps1" - - +[T4Scaffolding.Scaffolder(Description = "Scaffold your mailers using ASPX view")][CmdletBinding()] +param( + [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$MailerName, + [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string[]]$MailerMethods, + [switch]$WithText = $false, + [switch]$NoInterface = $false, + [string]$Project, + [string]$CodeLanguage, + [string[]]$TemplateFolders, + [switch]$Force = $false +) + +$script_dir = Split-Path -Parent $MyInvocation.MyCommand.Path +. "$script_dir\MailerFunctions.ps1" + + RunMailerScaffolder $true \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/input/tools/Mailer.Razor.ps1 b/Mvc.Mailer/NuGet/tools/Mailer.Razor.ps1 similarity index 97% rename from Mvc.Mailer/NuGet/input/tools/Mailer.Razor.ps1 rename to Mvc.Mailer/NuGet/tools/Mailer.Razor.ps1 index a80210e..bb88085 100644 --- a/Mvc.Mailer/NuGet/input/tools/Mailer.Razor.ps1 +++ b/Mvc.Mailer/NuGet/tools/Mailer.Razor.ps1 @@ -1,17 +1,17 @@ -[T4Scaffolding.Scaffolder(Description = "Scaffold your mailers using Razor Views")][CmdletBinding()] -param( - [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$MailerName, - [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string[]]$MailerMethods, - [switch]$WithText = $false, - [switch]$NoInterface = $false, - [switch]$Add = $false, - [string]$Project, - [string]$CodeLanguage, - [string[]]$TemplateFolders, - [switch]$Force = $false -) - -$script_dir = Split-Path -Parent $MyInvocation.MyCommand.Path -. "$script_dir\MailerFunctions.ps1" - +[T4Scaffolding.Scaffolder(Description = "Scaffold your mailers using Razor Views")][CmdletBinding()] +param( + [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$MailerName, + [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string[]]$MailerMethods, + [switch]$WithText = $false, + [switch]$NoInterface = $false, + [switch]$Add = $false, + [string]$Project, + [string]$CodeLanguage, + [string[]]$TemplateFolders, + [switch]$Force = $false +) + +$script_dir = Split-Path -Parent $MyInvocation.MyCommand.Path +. "$script_dir\MailerFunctions.ps1" + RunMailerScaffolder $false \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/input/tools/MailerFunctions.ps1 b/Mvc.Mailer/NuGet/tools/MailerFunctions.ps1 similarity index 96% rename from Mvc.Mailer/NuGet/input/tools/MailerFunctions.ps1 rename to Mvc.Mailer/NuGet/tools/MailerFunctions.ps1 index fe94897..464adff 100644 --- a/Mvc.Mailer/NuGet/input/tools/MailerFunctions.ps1 +++ b/Mvc.Mailer/NuGet/tools/MailerFunctions.ps1 @@ -1,153 +1,153 @@ -########################################################### -### ### -### FUNCTIONS ### -### ### -########################################################### -function CreateCSFileFromTemplate -{ - param ($MailerTemplate, $outputPath, $NoInterface) - - $outputFolder = "Mailers" - - $isInterface = $true - if($NoInterface) - { - $isInterface = $false - } - - - $templateFile = Find-ScaffolderTemplate cs\$MailerTemplate -TemplateFolders $TemplateFolders -Project $Project -CodeLanguage $CodeLanguage -ErrorIfNotFound - if ($templateFile) { - # Render it, adding the output to the Visual Studio project - $namespace = (Get-Project $Project).Properties.Item("DefaultNamespace").Value - $wroteFile = Invoke-ScaffoldTemplate -Template $templateFile -Model @{ - Namespace = $namespace; - MailerName = $MailerName; - MailerMethods = $MailerMethods; - Interface = $isInterface; - } -Project $Project -OutputPath $outputFolder\$outputPath -Force:$Force - if($wroteFile) { - Write-Host "Added MvcMailer output '$wroteFile'" - } - } -} - -function CreateCSFiles -{ - param($NoInterface) - - if(! $NoInterface) - { - CreateCSFileFromTemplate IMailerTemplate I$MailerName $Interface - } - CreateCSFileFromTemplate MailerTemplate $MailerName $NoInterface -} - -function CreateViewFileFromTemplate -{ - param ($ViewTemplate, $viewPath, $viewName='') - - $templateFile = Find-ScaffolderTemplate view\$ViewTemplate -TemplateFolders $TemplateFolders -Project $Project -CodeLanguage $CodeLanguage -ErrorIfNotFound - $namespace = (Get-Project $Project).Properties.Item("DefaultNamespace").Value - - if ($templateFile) { - $wroteFile = Invoke-ScaffoldTemplate -Template $templateFile -Model @{ - Namespace = $namespace; - MailerName=$MailerName; - ViewName=$viewName; - } -Project $Project -OutputPath $viewPath -Force:$force - if($wroteFile) { - Write-Host "Added MyScaffolder output '$wroteFile'" - } - } -} - -function CreateLayoutAndViews -{ - param($Text, $Aspx) - - - $viewExtension = '' - $masterExtension = '' - - if($Aspx){ - $viewExtension = "aspx" - $masterExtension = "Master" - } - else - { - $viewExtension = "cshtml" - $masterExtension = "cshtml" - } - - # HTML Views - CreateViewFileFromTemplate Layout.$masterExtension Views\$MailerName\_Layout - foreach ($viewName in $MailerMethods) - { - CreateViewFileFromTemplate Mail.$viewExtension Views\$MailerName\$viewName $viewName - } - - # Text Views - if($Text) - { - CreateViewFileFromTemplate Layout.text.$masterExtension Views\$MailerName\_Layout - foreach ($viewName in $MailerMethods) - { - CreateViewFileFromTemplate Mail.text.$viewExtension Views\$MailerName\$viewName $viewName - } - } -} - -function AddMethodToMailerInterface -{ - param($MailerName, $MethodName) -} - - -function AddMethodToMailer -{ - param($MailerName, $MethodName, $MethodTemplate) - - $defaultNamespace = (Get-Project $Project).Properties.Item("DefaultNamespace").Value - $mailerFullName = "$defaultNamespace.Mailers.$MailerName" - - $codeClass = Get-ProjectType $mailerFullName -Project $Project - - if($codeClass) - { - Add-ClassMemberViaTemplate -Name $MethodName -CodeClass $codeClass -Template $MethodTemplate ` - -Model @{ MethodName = $MethodName } ` - -SuccessMessage "Added method $MethodName to $mailerFullName" ` - -TemplateFolders $TemplateFolders -Project $Project -CodeLanguage $CodeLanguage -Force:$Force - } -} - -function AddMailerMethodsWithViews -{ - param($MailerName, $MethodNames, $Aspx, $WithText) - - foreach($methodName in $MethodNames) - { - #AddMethodToMailer I$MailerName $methodName IMailerMethodTemplate - AddMethodToMailer $MailerName $methodName MailerMethodTemplate - } - - CreateLayoutAndViews $WithText $Aspx -} - -function RunMailerScaffolder -{ - param($Aspx) - - if($Add) - { - AddMailerMethodsWithViews $MailerName $MailerMethods $Aspx $WithText - } - else - { - CreateCSFiles $NoInterface - CreateLayoutAndViews $WithText $Aspx - } -} - +########################################################### +### ### +### FUNCTIONS ### +### ### +########################################################### +function CreateCSFileFromTemplate +{ + param ($MailerTemplate, $outputPath, $NoInterface) + + $outputFolder = "Mailers" + + $isInterface = $true + if($NoInterface) + { + $isInterface = $false + } + + + $templateFile = Find-ScaffolderTemplate cs\$MailerTemplate -TemplateFolders $TemplateFolders -Project $Project -CodeLanguage $CodeLanguage -ErrorIfNotFound + if ($templateFile) { + # Render it, adding the output to the Visual Studio project + $namespace = (Get-Project $Project).Properties.Item("DefaultNamespace").Value + $wroteFile = Invoke-ScaffoldTemplate -Template $templateFile -Model @{ + Namespace = $namespace; + MailerName = $MailerName; + MailerMethods = $MailerMethods; + Interface = $isInterface; + } -Project $Project -OutputPath $outputFolder\$outputPath -Force:$Force + if($wroteFile) { + Write-Host "Added MvcMailer output '$wroteFile'" + } + } +} + +function CreateCSFiles +{ + param($NoInterface) + + if(! $NoInterface) + { + CreateCSFileFromTemplate IMailerTemplate I$MailerName $Interface + } + CreateCSFileFromTemplate MailerTemplate $MailerName $NoInterface +} + +function CreateViewFileFromTemplate +{ + param ($ViewTemplate, $viewPath, $viewName='') + + $templateFile = Find-ScaffolderTemplate view\$ViewTemplate -TemplateFolders $TemplateFolders -Project $Project -CodeLanguage $CodeLanguage -ErrorIfNotFound + $namespace = (Get-Project $Project).Properties.Item("DefaultNamespace").Value + + if ($templateFile) { + $wroteFile = Invoke-ScaffoldTemplate -Template $templateFile -Model @{ + Namespace = $namespace; + MailerName=$MailerName; + ViewName=$viewName; + } -Project $Project -OutputPath $viewPath -Force:$force + if($wroteFile) { + Write-Host "Added MyScaffolder output '$wroteFile'" + } + } +} + +function CreateLayoutAndViews +{ + param($Text, $Aspx) + + + $viewExtension = '' + $masterExtension = '' + + if($Aspx){ + $viewExtension = "aspx" + $masterExtension = "Master" + } + else + { + $viewExtension = "cshtml" + $masterExtension = "cshtml" + } + + # HTML Views + CreateViewFileFromTemplate Layout.$masterExtension Views\$MailerName\_Layout + foreach ($viewName in $MailerMethods) + { + CreateViewFileFromTemplate Mail.$viewExtension Views\$MailerName\$viewName $viewName + } + + # Text Views + if($Text) + { + CreateViewFileFromTemplate Layout.text.$masterExtension Views\$MailerName\_Layout + foreach ($viewName in $MailerMethods) + { + CreateViewFileFromTemplate Mail.text.$viewExtension Views\$MailerName\$viewName $viewName + } + } +} + +function AddMethodToMailerInterface +{ + param($MailerName, $MethodName) +} + + +function AddMethodToMailer +{ + param($MailerName, $MethodName, $MethodTemplate) + + $defaultNamespace = (Get-Project $Project).Properties.Item("DefaultNamespace").Value + $mailerFullName = "$defaultNamespace.Mailers.$MailerName" + + $codeClass = Get-ProjectType $mailerFullName -Project $Project + + if($codeClass) + { + Add-ClassMemberViaTemplate -Name $MethodName -CodeClass $codeClass -Template $MethodTemplate ` + -Model @{ MethodName = $MethodName } ` + -SuccessMessage "Added method $MethodName to $mailerFullName" ` + -TemplateFolders $TemplateFolders -Project $Project -CodeLanguage $CodeLanguage -Force:$Force + } +} + +function AddMailerMethodsWithViews +{ + param($MailerName, $MethodNames, $Aspx, $WithText) + + foreach($methodName in $MethodNames) + { + #AddMethodToMailer I$MailerName $methodName IMailerMethodTemplate + AddMethodToMailer $MailerName $methodName MailerMethodTemplate + } + + CreateLayoutAndViews $WithText $Aspx +} + +function RunMailerScaffolder +{ + param($Aspx) + + if($Add) + { + AddMailerMethodsWithViews $MailerName $MailerMethods $Aspx $WithText + } + else + { + CreateCSFiles $NoInterface + CreateLayoutAndViews $WithText $Aspx + } +} + ######## END FUNCTIONS #################################### \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/input/tools/cs/IMailerMethodTemplate.cs.t4 b/Mvc.Mailer/NuGet/tools/cs/IMailerMethodTemplate.cs.t4 similarity index 72% rename from Mvc.Mailer/NuGet/input/tools/cs/IMailerMethodTemplate.cs.t4 rename to Mvc.Mailer/NuGet/tools/cs/IMailerMethodTemplate.cs.t4 index ca5fb5b..c21c33c 100644 --- a/Mvc.Mailer/NuGet/input/tools/cs/IMailerMethodTemplate.cs.t4 +++ b/Mvc.Mailer/NuGet/tools/cs/IMailerMethodTemplate.cs.t4 @@ -1,5 +1,4 @@ <#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> <#@ Output Extension="cs" #> -MailMessage <#= Model.MethodName #>(); - +MvcMailMessage <#= Model.MethodName #>(); diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/cs/IMailerTemplate.cs.t4 b/Mvc.Mailer/NuGet/tools/cs/IMailerTemplate.cs.t4 similarity index 50% rename from Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/cs/IMailerTemplate.cs.t4 rename to Mvc.Mailer/NuGet/tools/cs/IMailerTemplate.cs.t4 index 54c137c..1cb28c3 100644 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/cs/IMailerTemplate.cs.t4 +++ b/Mvc.Mailer/NuGet/tools/cs/IMailerTemplate.cs.t4 @@ -1,21 +1,12 @@ <#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> <#@ Output Extension="cs" #> -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using Mvc.Mailer; -using System.Net.Mail; namespace <#= Model.Namespace #>.Mailers { public interface I<#= Model.MailerName #> { - <# foreach(var mailerMethod in Model.MailerMethods) {#> - - MailMessage <#= mailerMethod #>(); - - <# } #> - - } + <# foreach(var mailerMethod in Model.MailerMethods) {#> + MvcMailMessage <#= mailerMethod #>(); + <# } #>} } \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/tools/cs/MailerMethodTemplate.cs.t4 b/Mvc.Mailer/NuGet/tools/cs/MailerMethodTemplate.cs.t4 new file mode 100644 index 0000000..e538972 --- /dev/null +++ b/Mvc.Mailer/NuGet/tools/cs/MailerMethodTemplate.cs.t4 @@ -0,0 +1,12 @@ +<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> +<#@ Output Extension="cs" #> + +public virtual MvcMailMessage <#= Model.MethodName #>() +{ + ViewBag.Data = someObject; + return Populate(x => { + x.Subject = "<#= Model.MethodName #>"; + x.ViewName = "<#= Model.MethodName #>"; + x.To.Add("some-email@example.com"); + }); +} \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/tools/cs/MailerTemplate.cs.t4 b/Mvc.Mailer/NuGet/tools/cs/MailerTemplate.cs.t4 new file mode 100644 index 0000000..ad6996f --- /dev/null +++ b/Mvc.Mailer/NuGet/tools/cs/MailerTemplate.cs.t4 @@ -0,0 +1,28 @@ +<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> +<#@ Output Extension="cs" #> +using Mvc.Mailer; + +namespace <#= Model.Namespace #>.Mailers +{ + public class <#= Model.MailerName #> : MailerBase<# if( Model.Interface) { #>, I<#= Model.MailerName #> <# } #> + + { + public <#= Model.MailerName #>() + { + MasterName="_Layout"; + } + <# foreach(var mailerMethod in Model.MailerMethods) {#> + + public virtual MvcMailMessage <#= mailerMethod #>() + { + //ViewBag.Data = someObject; + return Populate(x => + { + x.Subject = "<#= mailerMethod #>"; + x.ViewName = "<#= mailerMethod #>"; + x.To.Add("some-email@example.com"); + }); + } + <# } #> + } +} \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/aspx/Layout.Master.cs.t4 b/Mvc.Mailer/NuGet/tools/view/aspx/Layout.Master.cs.t4 similarity index 96% rename from Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/aspx/Layout.Master.cs.t4 rename to Mvc.Mailer/NuGet/tools/view/aspx/Layout.Master.cs.t4 index c5671dd..77deedd 100644 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/aspx/Layout.Master.cs.t4 +++ b/Mvc.Mailer/NuGet/tools/view/aspx/Layout.Master.cs.t4 @@ -1,17 +1,17 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="Master" #> -<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> - - - - - - <asp:ContentPlaceHolder ID="TitleContent" runat="server" /> - - -
- - -
- - +<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> +<#@ Output Extension="Master" #> +<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> + + + + + + <asp:ContentPlaceHolder ID="TitleContent" runat="server" /> + + +
+ + +
+ + diff --git a/Mvc.Mailer/NuGet/input/tools/view/aspx/Layout.text.Master.cs.t4 b/Mvc.Mailer/NuGet/tools/view/aspx/Layout.text.Master.cs.t4 similarity index 98% rename from Mvc.Mailer/NuGet/input/tools/view/aspx/Layout.text.Master.cs.t4 rename to Mvc.Mailer/NuGet/tools/view/aspx/Layout.text.Master.cs.t4 index 04022cb..f6c5e13 100644 --- a/Mvc.Mailer/NuGet/input/tools/view/aspx/Layout.text.Master.cs.t4 +++ b/Mvc.Mailer/NuGet/tools/view/aspx/Layout.text.Master.cs.t4 @@ -1,5 +1,5 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="text.Master" #> -<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> - - +<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> +<#@ Output Extension="text.Master" #> +<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> + + diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/aspx/Mail.aspx.cs.t4 b/Mvc.Mailer/NuGet/tools/view/aspx/Mail.aspx.cs.t4 similarity index 97% rename from Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/aspx/Mail.aspx.cs.t4 rename to Mvc.Mailer/NuGet/tools/view/aspx/Mail.aspx.cs.t4 index 02260d9..ee01ba5 100644 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/aspx/Mail.aspx.cs.t4 +++ b/Mvc.Mailer/NuGet/tools/view/aspx/Mail.aspx.cs.t4 @@ -1,11 +1,11 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="aspx" #> - -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/<#= Model.MailerName #>/_Layout.Master" Inherits="System.Web.Mvc.ViewPage" %> - - - - - - HTML View for <#= Model.MailerName #>#<#= Model.ViewName #> - +<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> +<#@ Output Extension="aspx" #> + +<%@ Page Title="" Language="C#" MasterPageFile="~/Views/<#= Model.MailerName #>/_Layout.Master" Inherits="System.Web.Mvc.ViewPage" %> + + + + + + HTML View for <#= Model.MailerName #>#<#= Model.ViewName #> + diff --git a/Mvc.Mailer/NuGet/input/tools/view/aspx/Mail.text.aspx.cs.t4 b/Mvc.Mailer/NuGet/tools/view/aspx/Mail.text.aspx.cs.t4 similarity index 98% rename from Mvc.Mailer/NuGet/input/tools/view/aspx/Mail.text.aspx.cs.t4 rename to Mvc.Mailer/NuGet/tools/view/aspx/Mail.text.aspx.cs.t4 index d9f7fe0..918c902 100644 --- a/Mvc.Mailer/NuGet/input/tools/view/aspx/Mail.text.aspx.cs.t4 +++ b/Mvc.Mailer/NuGet/tools/view/aspx/Mail.text.aspx.cs.t4 @@ -1,8 +1,8 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="text.aspx" #> - -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/<#= Model.MailerName #>/_Layout.text.Master" Inherits="System.Web.Mvc.ViewPage" %> - - - TEXT View for <#= Model.MailerName #>#<#= Model.ViewName #> - +<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> +<#@ Output Extension="text.aspx" #> + +<%@ Page Title="" Language="C#" MasterPageFile="~/Views/<#= Model.MailerName #>/_Layout.text.Master" Inherits="System.Web.Mvc.ViewPage" %> + + + TEXT View for <#= Model.MailerName #>#<#= Model.ViewName #> + diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/razor/Layout.cshtml.cs.t4 b/Mvc.Mailer/NuGet/tools/view/razor/Layout.cshtml.cs.t4 similarity index 96% rename from Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/razor/Layout.cshtml.cs.t4 rename to Mvc.Mailer/NuGet/tools/view/razor/Layout.cshtml.cs.t4 index 4510093..313805c 100644 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/razor/Layout.cshtml.cs.t4 +++ b/Mvc.Mailer/NuGet/tools/view/razor/Layout.cshtml.cs.t4 @@ -1,8 +1,8 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="cshtml" #> - - - - @RenderBody() - +<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> +<#@ Output Extension="cshtml" #> + + + + @RenderBody() + \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/razor/Layout.text.cshtml.cs.t4 b/Mvc.Mailer/NuGet/tools/view/razor/Layout.text.cshtml.cs.t4 similarity index 97% rename from Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/razor/Layout.text.cshtml.cs.t4 rename to Mvc.Mailer/NuGet/tools/view/razor/Layout.text.cshtml.cs.t4 index 5e8860b..eb34a4d 100644 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/razor/Layout.text.cshtml.cs.t4 +++ b/Mvc.Mailer/NuGet/tools/view/razor/Layout.text.cshtml.cs.t4 @@ -1,4 +1,4 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="text.cshtml" #> - +<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> +<#@ Output Extension="text.cshtml" #> + @RenderBody() \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/input/tools/view/razor/Mail.cshtml.cs.t4 b/Mvc.Mailer/NuGet/tools/view/razor/Mail.cshtml.cs.t4 similarity index 98% rename from Mvc.Mailer/NuGet/input/tools/view/razor/Mail.cshtml.cs.t4 rename to Mvc.Mailer/NuGet/tools/view/razor/Mail.cshtml.cs.t4 index d56fdc4..808b775 100644 --- a/Mvc.Mailer/NuGet/input/tools/view/razor/Mail.cshtml.cs.t4 +++ b/Mvc.Mailer/NuGet/tools/view/razor/Mail.cshtml.cs.t4 @@ -1,4 +1,4 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="cshtml" #> - +<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> +<#@ Output Extension="cshtml" #> + HTML View for <#= Model.MailerName #>#<#= Model.ViewName #> \ No newline at end of file diff --git a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/razor/Mail.text.cshtml.cs.t4 b/Mvc.Mailer/NuGet/tools/view/razor/Mail.text.cshtml.cs.t4 similarity index 98% rename from Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/razor/Mail.text.cshtml.cs.t4 rename to Mvc.Mailer/NuGet/tools/view/razor/Mail.text.cshtml.cs.t4 index 7c6719d..97fa18f 100644 --- a/Mvc.Mailer/NuGet/output/MvcMailer.1.0.nupkg/tools/view/razor/Mail.text.cshtml.cs.t4 +++ b/Mvc.Mailer/NuGet/tools/view/razor/Mail.text.cshtml.cs.t4 @@ -1,4 +1,4 @@ -<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> -<#@ Output Extension="text.cshtml" #> - +<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #> +<#@ Output Extension="text.cshtml" #> + Text View for <#= Model.MailerName #>#<#= Model.ViewName #> \ No newline at end of file diff --git a/Mvc.Mailer/Properties/AssemblyInfo.cs b/Mvc.Mailer/Properties/AssemblyInfo.cs index 4b420ae..1680f92 100644 --- a/Mvc.Mailer/Properties/AssemblyInfo.cs +++ b/Mvc.Mailer/Properties/AssemblyInfo.cs @@ -1,37 +1,37 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Mvc.Mailer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Mvc.Mailer")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2790eac2-2d32-49d9-99f6-49b05fabb5a1")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: InternalsVisibleTo("Mvc.Mailer.Test")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Mvc.Mailer.Modified")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("Mvc.Mailer")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyDescription("This is MvcMailer extended to apply processors to html body after render")] +[assembly: AssemblyCompany("Hernan Marano")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2790eac2-2d32-49d9-99f6-49b05fabb5a1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] + +[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: InternalsVisibleTo("Mvc.Mailer.Test")] diff --git a/Mvc.Mailer/SmtpClientBase.cs b/Mvc.Mailer/SmtpClientBase.cs index 11407a7..448533f 100644 --- a/Mvc.Mailer/SmtpClientBase.cs +++ b/Mvc.Mailer/SmtpClientBase.cs @@ -1,33 +1,24 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Net.Mail; -using System.ComponentModel; - -namespace Mvc.Mailer -{ - public abstract class SmtpClientBase : ISmtpClient - { - public event SendCompletedEventHandler SendCompleted; - - protected void OnSendCompleted(object sender, AsyncCompletedEventArgs e) - { - if (SendCompleted != null) - { - SendCompleted(sender, e); - } - } - - public abstract void Send(MailMessage mailMessage); - - public virtual void SendAsync(MailMessage mailMessage) - { - var userState = "userState"; - SendAsync(mailMessage, userState); - } - - public abstract void SendAsync(MailMessage mailMessage, object userState); - public abstract void Dispose(); - } -} +using System.Net.Mail; +using System.ComponentModel; + +namespace Mvc.Mailer { + public abstract class SmtpClientBase : ISmtpClient { + public event SendCompletedEventHandler SendCompleted; + + protected void OnSendCompleted(object sender, AsyncCompletedEventArgs e) { + if (SendCompleted != null) { + SendCompleted(sender, e); + } + } + + public abstract void Send(MailMessage mailMessage); + + public virtual void SendAsync(MailMessage mailMessage) { + const string userState = "userState"; + SendAsync(mailMessage, userState); + } + + public abstract void SendAsync(MailMessage mailMessage, object userState); + public abstract void Dispose(); + } +} diff --git a/Mvc.Mailer/SmtpClientWrapper.cs b/Mvc.Mailer/SmtpClientWrapper.cs index e053f27..607b0a8 100644 --- a/Mvc.Mailer/SmtpClientWrapper.cs +++ b/Mvc.Mailer/SmtpClientWrapper.cs @@ -1,58 +1,40 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Net.Mail; -using System.ComponentModel; - -namespace Mvc.Mailer -{ - public class SmtpClientWrapper : SmtpClientBase - { - public SmtpClientWrapper() - { - InnerSmtpClient = new SmtpClient(); - } - - public SmtpClientWrapper(SmtpClient smtpClient) - { - InnerSmtpClient = smtpClient; - } - - public SmtpClient InnerSmtpClient - { - get; - set; - } - - public override void Send(MailMessage mailMessage) - { - using (InnerSmtpClient) - { - InnerSmtpClient.Send(mailMessage); - } - } - - public override void SendAsync(MailMessage mailMessage, object userState) - { - InnerSmtpClient.SendCompleted += new SendCompletedEventHandler(InnerSmtpClient_SendCompleted); - InnerSmtpClient.SendAsync(mailMessage, userState); - } - - void InnerSmtpClient_SendCompleted(object sender, AsyncCompletedEventArgs e) - { - (sender as SmtpClient).Dispose(); - OnSendCompleted(sender, e); - } - - public override void Dispose() - { - InnerSmtpClient.Dispose(); - } - - public static implicit operator SmtpClientWrapper(SmtpClient innerSmtpClient) - { - return new SmtpClientWrapper(innerSmtpClient); - } - } -} +using System.Net.Mail; +using System.ComponentModel; + +namespace Mvc.Mailer { + public class SmtpClientWrapper : SmtpClientBase { + public SmtpClientWrapper() { + InnerSmtpClient = new SmtpClient(); + } + + public SmtpClientWrapper(SmtpClient smtpClient) { + InnerSmtpClient = smtpClient; + } + + public SmtpClient InnerSmtpClient { get; set; } + + public override void Send(MailMessage mailMessage) { + using (InnerSmtpClient) { + InnerSmtpClient.Send(mailMessage); + } + } + + public override void SendAsync(MailMessage mailMessage, object userState) { + InnerSmtpClient.SendCompleted += InnerSmtpClient_SendCompleted; + InnerSmtpClient.SendAsync(mailMessage, userState); + } + + void InnerSmtpClient_SendCompleted(object sender, AsyncCompletedEventArgs e) { + (sender as SmtpClient).Dispose(); + OnSendCompleted(sender, e); + } + + public override void Dispose() { + InnerSmtpClient.Dispose(); + } + + public static implicit operator SmtpClientWrapper(SmtpClient innerSmtpClient) { + return new SmtpClientWrapper(innerSmtpClient); + } + } +} \ No newline at end of file diff --git a/Mvc.Mailer/StringResult.cs b/Mvc.Mailer/StringResult.cs index b5a5194..be456a0 100644 --- a/Mvc.Mailer/StringResult.cs +++ b/Mvc.Mailer/StringResult.cs @@ -1,88 +1,60 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; -using System.Text; -using System.IO; - -namespace Mvc.Mailer -{ - /// - /// Mimics the ViewResult with an important difference - the view is only storted in the Output property insted of written to a - /// browser stream! - /// - public class StringResult : ViewResult - { - - public StringResult() - { - - } - - public StringResult(string viewName) - { - ViewName = viewName; - } - - /// - /// Contains the output after compiling the view and putting in the values - /// - public string Output - { - get; - private set; - } - - public virtual void ExecuteResult(ControllerContext context, string mailerName) - { - //remember the controller name - var controllerName = context.RouteData.Values["controller"]; - - //temporarily change it to the mailer name so that FindView works - context.RouteData.Values["controller"] = mailerName; - try - { - ExecuteResult(context); - } - catch(Exception ex) - { - throw ex; - } - finally{ - //restore the controller name - context.RouteData.Values["controller"] = controllerName; - } - - - } - - public override void ExecuteResult(ControllerContext context) - { - if (context == null) - { - throw new ArgumentNullException("context"); - } - if (String.IsNullOrEmpty(ViewName)) - { - throw new ArgumentNullException("ViewName of StringResult cannot be null or empty"); - } - - ViewEngineResult result = null; - - if (View == null) - { - result = FindView(context); - View = result.View; - } - - StringBuilder stringBuilder = new StringBuilder(); - TextWriter writer = new StringWriter(stringBuilder); - - ViewContext viewContext = new ViewContext(context, View, ViewData, TempData, writer); - View.Render(viewContext, writer); - - this.Output = stringBuilder.ToString(); - } - } +using System; +using System.Web.Mvc; +using System.Text; +using System.IO; + +namespace Mvc.Mailer { + /// + /// Mimics the ViewResult with an important difference - the view is only storted in the Output property insted of written to a + /// browser stream! + /// + public class StringResult : ViewResult { + public StringResult() { + } + + public StringResult(string viewName) { + ViewName = viewName; + } + + /// + /// Contains the output after compiling the view and putting in the values + /// + public string Output { get; private set; } + + public virtual void ExecuteResult(ControllerContext context, string mailerName) { + //remember the controller name + var controllerName = context.RouteData.Values["controller"]; + + //temporarily change it to the mailer name so that FindView works + context.RouteData.Values["controller"] = mailerName; + try { + ExecuteResult(context); + } finally { + //restore the controller name + context.RouteData.Values["controller"] = controllerName; + } + } + + public override void ExecuteResult(ControllerContext context) { + if (context == null) { + throw new ArgumentNullException("context"); + } + if (String.IsNullOrEmpty(ViewName)) { + throw new ArgumentNullException("ViewName of StringResult cannot be null or empty"); + } + + if (View == null) { + var result = FindView(context); + View = result.View; + } + + var stringBuilder = new StringBuilder(); + TextWriter writer = new StringWriter(stringBuilder); + + var viewContext = new ViewContext(context, View, ViewData, TempData, writer); + View.Render(viewContext, writer); + + Output = stringBuilder.ToString(); + } + } } \ No newline at end of file diff --git a/Mvc.Mailer/TestSmtpClient.cs b/Mvc.Mailer/TestSmtpClient.cs index bfa226a..f16499e 100644 --- a/Mvc.Mailer/TestSmtpClient.cs +++ b/Mvc.Mailer/TestSmtpClient.cs @@ -1,51 +1,33 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Net.Mail; -using System.ComponentModel; - -namespace Mvc.Mailer -{ - public class TestSmtpClient : SmtpClientBase - { - [ThreadStatic] - private static List _sentMails; - public static List SentMails - { - get{ - _sentMails = _sentMails ?? new List(); - return _sentMails; - } - } - - public static bool WasLastCallAsync - { - get; - set; - } - - public TestSmtpClient() - { - - } - - public override void Send(MailMessage mailMessage) - { - WasLastCallAsync = false; - SentMails.Add(mailMessage); - } - - public override void SendAsync(MailMessage mailMessage, object userState) - { - WasLastCallAsync = true; - SentMails.Add(mailMessage); - OnSendCompleted(this, new AsyncCompletedEventArgs(null, false, userState)); - } - - public override void Dispose() - { - - } - } -} +using System; +using System.Collections.Generic; +using System.Net.Mail; +using System.ComponentModel; + +namespace Mvc.Mailer { + public class TestSmtpClient : SmtpClientBase { + [ThreadStatic] + private static List _sentMails; + public static List SentMails { + get{ + _sentMails = _sentMails ?? new List(); + return _sentMails; + } + } + + public static bool WasLastCallAsync { get; set; } + + public override void Send(MailMessage mailMessage) { + WasLastCallAsync = false; + SentMails.Add(mailMessage); + } + + public override void SendAsync(MailMessage mailMessage, object userState) { + WasLastCallAsync = true; + SentMails.Add(mailMessage); + OnSendCompleted(this, new AsyncCompletedEventArgs(null, false, userState)); + } + + public override void Dispose() { + } +} +} \ No newline at end of file diff --git a/Mvc.Mailer/bin/Debug/Mvc.Mailer.dll b/Mvc.Mailer/bin/Debug/Mvc.Mailer.dll deleted file mode 100644 index 4b85bfb..0000000 Binary files a/Mvc.Mailer/bin/Debug/Mvc.Mailer.dll and /dev/null differ diff --git a/Mvc.Mailer/bin/Debug/Mvc.Mailer.pdb b/Mvc.Mailer/bin/Debug/Mvc.Mailer.pdb deleted file mode 100644 index 3f364c0..0000000 Binary files a/Mvc.Mailer/bin/Debug/Mvc.Mailer.pdb and /dev/null differ diff --git a/Mvc.Mailer/bin/Debug/content/Views/web.config.transform b/Mvc.Mailer/bin/Debug/content/Views/web.config.transform deleted file mode 100644 index be4c33d..0000000 --- a/Mvc.Mailer/bin/Debug/content/Views/web.config.transform +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/Mvc.Mailer/bin/Debug/content/web.config.transform b/Mvc.Mailer/bin/Debug/content/web.config.transform deleted file mode 100644 index ad7aab0..0000000 --- a/Mvc.Mailer/bin/Debug/content/web.config.transform +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/Mvc.Mailer/bin/Release/Mvc.Mailer.dll b/Mvc.Mailer/bin/Release/Mvc.Mailer.dll deleted file mode 100644 index 51a30ec..0000000 Binary files a/Mvc.Mailer/bin/Release/Mvc.Mailer.dll and /dev/null differ diff --git a/Mvc.Mailer/bin/Release/Mvc.Mailer.pdb b/Mvc.Mailer/bin/Release/Mvc.Mailer.pdb deleted file mode 100644 index dfce701..0000000 Binary files a/Mvc.Mailer/bin/Release/Mvc.Mailer.pdb and /dev/null differ diff --git a/Mvc.Mailer/bin/Release/content/Views/web.config.transform b/Mvc.Mailer/bin/Release/content/Views/web.config.transform deleted file mode 100644 index be4c33d..0000000 --- a/Mvc.Mailer/bin/Release/content/Views/web.config.transform +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/Mvc.Mailer/bin/Release/content/web.config.transform b/Mvc.Mailer/bin/Release/content/web.config.transform deleted file mode 100644 index 8429770..0000000 --- a/Mvc.Mailer/bin/Release/content/web.config.transform +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Mvc.Mailer/content/Views/web.config.transform b/Mvc.Mailer/content/Views/web.config.transform deleted file mode 100644 index be4c33d..0000000 --- a/Mvc.Mailer/content/Views/web.config.transform +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/Mvc.Mailer/content/web.config.transform b/Mvc.Mailer/content/web.config.transform deleted file mode 100644 index 8429770..0000000 --- a/Mvc.Mailer/content/web.config.transform +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Mvc.Mailer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Mvc.Mailer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache deleted file mode 100644 index 9c8c1fe..0000000 Binary files a/Mvc.Mailer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ diff --git a/Mvc.Mailer/obj/Debug/Mvc.Mailer.csproj.FileListAbsolute.txt b/Mvc.Mailer/obj/Debug/Mvc.Mailer.csproj.FileListAbsolute.txt deleted file mode 100644 index 49c5c31..0000000 --- a/Mvc.Mailer/obj/Debug/Mvc.Mailer.csproj.FileListAbsolute.txt +++ /dev/null @@ -1,7 +0,0 @@ -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\bin\Debug\content\Views\web.config.transform -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\bin\Debug\content\web.config.transform -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\bin\Debug\Mvc.Mailer.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\bin\Debug\Mvc.Mailer.pdb -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\obj\Debug\ResolveAssemblyReference.cache -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\obj\Debug\Mvc.Mailer.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\obj\Debug\Mvc.Mailer.pdb diff --git a/Mvc.Mailer/obj/Debug/Mvc.Mailer.dll b/Mvc.Mailer/obj/Debug/Mvc.Mailer.dll deleted file mode 100644 index 4b85bfb..0000000 Binary files a/Mvc.Mailer/obj/Debug/Mvc.Mailer.dll and /dev/null differ diff --git a/Mvc.Mailer/obj/Debug/Mvc.Mailer.pdb b/Mvc.Mailer/obj/Debug/Mvc.Mailer.pdb deleted file mode 100644 index 3f364c0..0000000 Binary files a/Mvc.Mailer/obj/Debug/Mvc.Mailer.pdb and /dev/null differ diff --git a/Mvc.Mailer/obj/Debug/ResolveAssemblyReference.cache b/Mvc.Mailer/obj/Debug/ResolveAssemblyReference.cache deleted file mode 100644 index 40fccbf..0000000 Binary files a/Mvc.Mailer/obj/Debug/ResolveAssemblyReference.cache and /dev/null differ diff --git a/Mvc.Mailer/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache b/Mvc.Mailer/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache deleted file mode 100644 index a833e6d..0000000 Binary files a/Mvc.Mailer/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ diff --git a/Mvc.Mailer/obj/Release/Mvc.Mailer.csproj.FileListAbsolute.txt b/Mvc.Mailer/obj/Release/Mvc.Mailer.csproj.FileListAbsolute.txt deleted file mode 100644 index 03d8a56..0000000 --- a/Mvc.Mailer/obj/Release/Mvc.Mailer.csproj.FileListAbsolute.txt +++ /dev/null @@ -1,7 +0,0 @@ -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\bin\Release\content\Views\web.config.transform -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\bin\Release\content\web.config.transform -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\bin\Release\Mvc.Mailer.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\bin\Release\Mvc.Mailer.pdb -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\obj\Release\ResolveAssemblyReference.cache -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\obj\Release\Mvc.Mailer.dll -C:\Users\S M Sohan\MvcMailer\Mvc.Mailer\obj\Release\Mvc.Mailer.pdb diff --git a/Mvc.Mailer/obj/Release/Mvc.Mailer.dll b/Mvc.Mailer/obj/Release/Mvc.Mailer.dll deleted file mode 100644 index 51a30ec..0000000 Binary files a/Mvc.Mailer/obj/Release/Mvc.Mailer.dll and /dev/null differ diff --git a/Mvc.Mailer/obj/Release/Mvc.Mailer.pdb b/Mvc.Mailer/obj/Release/Mvc.Mailer.pdb deleted file mode 100644 index dfce701..0000000 Binary files a/Mvc.Mailer/obj/Release/Mvc.Mailer.pdb and /dev/null differ diff --git a/Mvc.Mailer/obj/Release/ResolveAssemblyReference.cache b/Mvc.Mailer/obj/Release/ResolveAssemblyReference.cache deleted file mode 100644 index 40fccbf..0000000 Binary files a/Mvc.Mailer/obj/Release/ResolveAssemblyReference.cache and /dev/null differ diff --git a/MvcMailer.gpState b/MvcMailer.gpState new file mode 100644 index 0000000..aa4223b --- /dev/null +++ b/MvcMailer.gpState @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/MvcMailer.suo b/MvcMailer.suo deleted file mode 100644 index 870c91e..0000000 Binary files a/MvcMailer.suo and /dev/null differ diff --git a/README.markdown b/README.markdown index e9c15c8..f506999 100644 --- a/README.markdown +++ b/README.markdown @@ -1,15 +1,18 @@ -MvcMailer is an ASP.NET MVC Mailer, inspired by Ruby on Rails ActionMailer, that helps composing Email -body using regular ASP.NET MVC views. This one works with .Net 4.0 for now. - - -##How to Use - -See [MvcMailer Wiki](https://github.com/smsohan/MvcMailer/wiki/MvcMailer-Step-by-Step-Guide) - -##Report Feature or Issues - -Use [Github Issues Page](https://github.com/smsohan/mvcmailer/issues) to mention your desired feature or if something is broken! - -##Have Fun - -I have a lot of fun working on this project. Wish you enjoy using it and if you wish, you can contribute too. Find me on Twitter [@smsohan](http://twitter.com/smsohan) \ No newline at end of file +MvcMailer is an ASP.NET MVC Mailer, inspired by Ruby on Rails ActionMailer, that helps composing Email +body using regular ASP.NET MVC views. This one works with .Net 4.0 for now. + + +##How to Use + +See [MvcMailer Wiki](https://github.com/smsohan/MvcMailer/wiki/MvcMailer-Step-by-Step-Guide) + +##Report Feature or Issues + +Use [Github Issues Page](https://github.com/smsohan/mvcmailer/issues) to mention your desired feature or if something is broken! + +##Have Fun + +I have a lot of fun working on this project. Wish you enjoy using it and if you wish, you can contribute too. Find me on Twitter [@smsohan](http://twitter.com/smsohan) + +## Other Contributors +[@TylerMercier](https://github.com/tylermercier) \ No newline at end of file diff --git a/scaffolding.config b/scaffolding.config new file mode 100644 index 0000000..e5da931 --- /dev/null +++ b/scaffolding.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file