diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index fa37eb6ca..511734d5e 100644 --- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -35,6 +35,9 @@ True + + ..\packages\AutoMoq.1.3.1.3\lib\AutoMoq.dll + False ..\NzbDrone.Core\Libraries\Castle.Core.dll @@ -44,7 +47,24 @@ - + + ..\packages\Unity.2.0\lib\20\Microsoft.Practices.ServiceLocation.dll + + + ..\packages\Unity.2.0\lib\20\Microsoft.Practices.Unity.dll + + + ..\packages\Unity.2.0\lib\20\Microsoft.Practices.Unity.Configuration.dll + + + ..\packages\Unity.2.0\lib\20\Microsoft.Practices.Unity.Interception.dll + + + ..\packages\Unity.2.0\lib\20\Microsoft.Practices.Unity.Interception.Configuration.dll + + + ..\packages\Moq.4.0.10827\lib\NET40\Moq.dll + ..\packages\Ninject.2.2.1.0\lib\.NetFramework 4.0\Ninject.dll diff --git a/NzbDrone.Core.Test/RssProviderTest.cs b/NzbDrone.Core.Test/RssProviderTest.cs index f7977ed8b..217fd81a1 100644 --- a/NzbDrone.Core.Test/RssProviderTest.cs +++ b/NzbDrone.Core.Test/RssProviderTest.cs @@ -5,6 +5,7 @@ using System.Linq; using System.ServiceModel.Syndication; using System.Text; using System.Xml; +using AutoMoq; using Gallio.Framework; using MbUnit.Framework; using MbUnit.Framework.ContractVerifiers; @@ -27,26 +28,22 @@ namespace NzbDrone.Core.Test public void Download_feed_test() { - var kernel = new MockingKernel(); + var mocker = new AutoMoqer(); var xmlReader = XmlReader.Create(File.OpenRead(".\\Files\\Rss\\nzbsorg.xml")); - var httpMock = new Mock(MockBehavior.Strict); - httpMock.Setup(h => - h.DownloadXml(It.Is(c => c == "www.google.com" || c == "www.yahoo.com"))) + + mocker.GetMock() + .Setup(h => h.DownloadXml(It.IsAny())) .Returns(xmlReader); - kernel.Bind().ToConstant(httpMock.Object); - kernel.Bind().To(); - - kernel.Get().Fetch(); - + mocker.Resolve().Fetch(); } } public class MockFeedProvider : FeedProviderBase { - public MockFeedProvider(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider, IHttpProvider httpProvider) + public MockFeedProvider(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider) : base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider) { } diff --git a/NzbDrone.Core.Test/SabControllerTest.cs b/NzbDrone.Core.Test/SabControllerTest.cs index 8bc5cc433..20e69a22c 100644 --- a/NzbDrone.Core.Test/SabControllerTest.cs +++ b/NzbDrone.Core.Test/SabControllerTest.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Text; +using AutoMoq; using Gallio.Framework; using MbUnit.Framework; using MbUnit.Framework.ContractVerifiers; @@ -28,22 +29,31 @@ namespace NzbDrone.Core.Test string priority = "0"; string category = "tv"; - var config = new Mock(); - config.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost); - config.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort); - config.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey); - config.Setup(c => c.GetValue("SabUsername", String.Empty, false)).Returns(username); - config.Setup(c => c.GetValue("SabPassword", String.Empty, false)).Returns(password); - config.Setup(c => c.GetValue("SabTvPriority", String.Empty, false)).Returns(priority); - config.Setup(c => c.GetValue("SabTvCategory", String.Empty, true)).Returns(category); - var http = new Mock(); - http.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&cat=tv&nzbname=This+is+an+Nzb&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")).Returns("ok"); + var mocker = new AutoMoqer(); - var target = new SabProvider(config.Object, http.Object); + var fakeConfig = mocker.GetMock(); + fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)) + .Returns(sabHost); + fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)) + .Returns(sabPort); + fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)) + .Returns(apikey); + fakeConfig.Setup(c => c.GetValue("SabUsername", String.Empty, false)) + .Returns(username); + fakeConfig.Setup(c => c.GetValue("SabPassword", String.Empty, false)) + .Returns(password); + fakeConfig.Setup(c => c.GetValue("SabTvPriority", String.Empty, false)) + .Returns(priority); + fakeConfig.Setup(c => c.GetValue("SabTvCategory", String.Empty, true)) + .Returns(category); + + mocker.GetMock() + .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&cat=tv&nzbname=This+is+an+Nzb&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) + .Returns("ok"); //Act - bool result = target.AddByUrl("http://www.nzbclub.com/nzb_download.aspx?mid=1950232", "This is an Nzb"); + bool result = mocker.Resolve().AddByUrl("http://www.nzbclub.com/nzb_download.aspx?mid=1950232", "This is an Nzb"); //Assert Assert.AreEqual(true, result); @@ -61,22 +71,23 @@ namespace NzbDrone.Core.Test string priority = "0"; string category = "tv"; - var config = new Mock(); - config.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost); - config.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort); - config.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey); - config.Setup(c => c.GetValue("SabUsername", String.Empty, false)).Returns(username); - config.Setup(c => c.GetValue("SabPassword", String.Empty, false)).Returns(password); - config.Setup(c => c.GetValue("SabTvPriority", String.Empty, false)).Returns(priority); - config.Setup(c => c.GetValue("SabTvCategory", String.Empty, true)).Returns(category); + var mocker = new AutoMoqer(); - var http = new Mock(); - http.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&cat=tv&nzbname=This+is+an+Nzb&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")).Returns("error"); + var fakeConfig = mocker.GetMock(); + fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost); + fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort); + fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey); + fakeConfig.Setup(c => c.GetValue("SabUsername", String.Empty, false)).Returns(username); + fakeConfig.Setup(c => c.GetValue("SabPassword", String.Empty, false)).Returns(password); + fakeConfig.Setup(c => c.GetValue("SabTvPriority", String.Empty, false)).Returns(priority); + fakeConfig.Setup(c => c.GetValue("SabTvCategory", String.Empty, true)).Returns(category); - var target = new SabProvider(config.Object, http.Object); + mocker.GetMock() + .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&cat=tv&nzbname=This+is+an+Nzb&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) + .Returns("error"); //Act - bool result = target.AddByUrl("http://www.nzbclub.com/nzb_download.aspx?mid=1950232", "This is an Nzb"); + bool result = mocker.Resolve().AddByUrl("http://www.nzbclub.com/nzb_download.aspx?mid=1950232", "This is an Nzb"); //Assert Assert.AreEqual(false, result); @@ -92,24 +103,21 @@ namespace NzbDrone.Core.Test string username = "admin"; string password = "pass"; - var config = new Mock(); - config.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost); - config.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort); - config.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey); - config.Setup(c => c.GetValue("SabUsername", String.Empty, false)).Returns(username); - config.Setup(c => c.GetValue("SabPassword", String.Empty, false)).Returns(password); + var mocker = new AutoMoqer(); - var http = new Mock(); - http.Setup( - s => - s.DownloadString( - "http://192.168.5.55:2222/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) + var fakeConfig = mocker.GetMock(); + fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost); + fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort); + fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey); + fakeConfig.Setup(c => c.GetValue("SabUsername", String.Empty, false)).Returns(username); + fakeConfig.Setup(c => c.GetValue("SabPassword", String.Empty, false)).Returns(password); + + mocker.GetMock() + .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(new StreamReader(@".\Files\Queue.xml").ReadToEnd()); - var target = new SabProvider(config.Object, http.Object); - //Act - bool result = target.IsInQueue("Ubuntu Test"); + bool result = mocker.Resolve().IsInQueue("Ubuntu Test"); //Assert Assert.AreEqual(true, result); @@ -125,24 +133,21 @@ namespace NzbDrone.Core.Test string username = "admin"; string password = "pass"; - var config = new Mock(); - config.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost); - config.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort); - config.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey); - config.Setup(c => c.GetValue("SabUsername", String.Empty, false)).Returns(username); - config.Setup(c => c.GetValue("SabPassword", String.Empty, false)).Returns(password); + var mocker = new AutoMoqer(); - var http = new Mock(); - http.Setup( - s => - s.DownloadString( - "http://192.168.5.55:2222/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) - .Returns(new StreamReader(@".\Files\QueueEmpty.xml").ReadToEnd()); + var fakeConfig = mocker.GetMock(); + fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost); + fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort); + fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey); + fakeConfig.Setup(c => c.GetValue("SabUsername", String.Empty, false)).Returns(username); + fakeConfig.Setup(c => c.GetValue("SabPassword", String.Empty, false)).Returns(password); - var target = new SabProvider(config.Object, http.Object); + mocker.GetMock() + .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) + .Returns(new StreamReader(@".\Files\QueueEmpty.xml").ReadToEnd()); //Act - bool result = target.IsInQueue(String.Empty); + bool result = mocker.Resolve().IsInQueue(String.Empty); //Assert Assert.AreEqual(false, result); @@ -158,24 +163,22 @@ namespace NzbDrone.Core.Test string username = "admin"; string password = "pass"; - var config = new Mock(); - config.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost); - config.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort); - config.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey); - config.Setup(c => c.GetValue("SabUsername", String.Empty, false)).Returns(username); - config.Setup(c => c.GetValue("SabPassword", String.Empty, false)).Returns(password); + var mocker = new AutoMoqer(); - var http = new Mock(); - http.Setup( - s => - s.DownloadString( - "http://192.168.5.55:2222/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) - .Returns(new StreamReader(@".\Files\QueueError.xml").ReadToEnd()); + var fakeConfig = mocker.GetMock(); + fakeConfig.Setup(c => c.GetValue("SabHost", String.Empty, false)).Returns(sabHost); + fakeConfig.Setup(c => c.GetValue("SabPort", String.Empty, false)).Returns(sabPort); + fakeConfig.Setup(c => c.GetValue("SabApiKey", String.Empty, false)).Returns(apikey); + fakeConfig.Setup(c => c.GetValue("SabUsername", String.Empty, false)).Returns(username); + fakeConfig.Setup(c => c.GetValue("SabPassword", String.Empty, false)).Returns(password); + + mocker.GetMock() + .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) + .Returns(new StreamReader(@".\Files\QueueError.xml").ReadToEnd()); - var target = new SabProvider(config.Object, http.Object); //Act - bool result = target.IsInQueue(String.Empty); + bool result = mocker.Resolve().IsInQueue(String.Empty); //Assert Assert.AreEqual(false, result); diff --git a/NzbDrone.Core.Test/packages.config b/NzbDrone.Core.Test/packages.config index 905815da9..353e03756 100644 --- a/NzbDrone.Core.Test/packages.config +++ b/NzbDrone.Core.Test/packages.config @@ -2,4 +2,7 @@ + + + \ No newline at end of file diff --git a/NzbDrone.Core/CentralDispatch.cs b/NzbDrone.Core/CentralDispatch.cs index 3b7b21631..af103ea67 100644 --- a/NzbDrone.Core/CentralDispatch.cs +++ b/NzbDrone.Core/CentralDispatch.cs @@ -65,7 +65,7 @@ namespace NzbDrone.Core _kernel.Bind().To(); _kernel.Bind().To(); _kernel.Bind().To(); - _kernel.Bind().To(); + _kernel.Bind().To(); _kernel.Bind().To(); _kernel.Bind().To(); _kernel.Bind().To(); diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 10e39166d..b8fc1b868 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -221,7 +221,6 @@ - diff --git a/NzbDrone.Core/Providers/Core/HttpProvider.cs b/NzbDrone.Core/Providers/Core/HttpProvider.cs index 9480729de..8424a5de7 100644 --- a/NzbDrone.Core/Providers/Core/HttpProvider.cs +++ b/NzbDrone.Core/Providers/Core/HttpProvider.cs @@ -5,11 +5,11 @@ using NLog; namespace NzbDrone.Core.Providers.Core { - internal class HttpProvider : IHttpProvider + public class HttpProvider { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - public string DownloadString(string request) + public virtual string DownloadString(string request) { try { @@ -24,7 +24,7 @@ namespace NzbDrone.Core.Providers.Core return String.Empty; } - public string DownloadString(string request, string username, string password) + public virtual string DownloadString(string request, string username, string password) { try { @@ -41,7 +41,7 @@ namespace NzbDrone.Core.Providers.Core return String.Empty; } - public void DownloadFile(string request, string filename) + public virtual void DownloadFile(string request, string filename) { try { @@ -59,7 +59,7 @@ namespace NzbDrone.Core.Providers.Core } - public void DownloadFile(string request, string filename, string username, string password) + public virtual void DownloadFile(string request, string filename, string username, string password) { try { @@ -75,7 +75,7 @@ namespace NzbDrone.Core.Providers.Core } } - public XmlReader DownloadXml(string url) + public virtual XmlReader DownloadXml(string url) { return XmlReader.Create(url); } diff --git a/NzbDrone.Core/Providers/Core/IHttpProvider.cs b/NzbDrone.Core/Providers/Core/IHttpProvider.cs deleted file mode 100644 index dad240ec3..000000000 --- a/NzbDrone.Core/Providers/Core/IHttpProvider.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Xml; - -namespace NzbDrone.Core.Providers.Core -{ - public interface IHttpProvider - { - string DownloadString(string request); - string DownloadString(string request, string username, string password); - void DownloadFile(string request, string filename); - void DownloadFile(string request, string filename, string username, string password); - XmlReader DownloadXml(string url); - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/Feed/FeedProviderBase.cs b/NzbDrone.Core/Providers/Feed/FeedProviderBase.cs index a63185714..790d286d9 100644 --- a/NzbDrone.Core/Providers/Feed/FeedProviderBase.cs +++ b/NzbDrone.Core/Providers/Feed/FeedProviderBase.cs @@ -12,11 +12,11 @@ namespace NzbDrone.Core.Providers.Feed protected readonly ISeasonProvider _seasonProvider; protected readonly IEpisodeProvider _episodeProvider; protected readonly IConfigProvider _configProvider; - private readonly IHttpProvider _httpProvider; + private readonly HttpProvider _httpProvider; protected static readonly Logger Logger = LogManager.GetCurrentClassLogger(); public FeedProviderBase(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider, - IEpisodeProvider episodeProvider, IConfigProvider configProvider, IHttpProvider httpProvider) + IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider) { _seriesProvider = seriesProvider; _seasonProvider = seasonProvider; @@ -54,7 +54,7 @@ namespace NzbDrone.Core.Providers.Feed { var episodeParseResult = Parser.ParseEpisodeInfo(item.Title.Text); if (episodeParseResult == null) return null; - + var seriesInfo = _seriesProvider.FindSeries(episodeParseResult.SeriesTitle); if (seriesInfo != null) diff --git a/NzbDrone.Core/Providers/Feed/NzbsOrgFeedProvider.cs b/NzbDrone.Core/Providers/Feed/NzbsOrgFeedProvider.cs index bc51d09aa..27a996be1 100644 --- a/NzbDrone.Core/Providers/Feed/NzbsOrgFeedProvider.cs +++ b/NzbDrone.Core/Providers/Feed/NzbsOrgFeedProvider.cs @@ -9,7 +9,8 @@ namespace NzbDrone.Core.Providers.Feed { class NzbsOrgFeedProvider : FeedProviderBase { - public NzbsOrgFeedProvider(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider, IHttpProvider httpProvider) : base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider) + public NzbsOrgFeedProvider(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider) + : base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider) { } diff --git a/NzbDrone.Core/Providers/SabProvider.cs b/NzbDrone.Core/Providers/SabProvider.cs index d74b731c3..a689ae5a6 100644 --- a/NzbDrone.Core/Providers/SabProvider.cs +++ b/NzbDrone.Core/Providers/SabProvider.cs @@ -10,11 +10,11 @@ namespace NzbDrone.Core.Providers public class SabProvider : IDownloadProvider { private readonly IConfigProvider _config; - private readonly IHttpProvider _http; + private readonly HttpProvider _http; private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - public SabProvider(IConfigProvider config, IHttpProvider http) + public SabProvider(IConfigProvider config, HttpProvider http) { _config = config; _http = http; diff --git a/NzbDrone.Core/Providers/SeriesProvider.cs b/NzbDrone.Core/Providers/SeriesProvider.cs index aba30b58f..40b3d086d 100644 --- a/NzbDrone.Core/Providers/SeriesProvider.cs +++ b/NzbDrone.Core/Providers/SeriesProvider.cs @@ -36,12 +36,12 @@ namespace NzbDrone.Core.Providers #region ISeriesProvider Members - public IQueryable GetAllSeries() + public virtual IQueryable GetAllSeries() { return _sonioRepo.All(); } - public Series GetSeries(int seriesId) + public virtual Series GetSeries(int seriesId) { return _sonioRepo.Single(s => s.SeriesId == seriesId); } @@ -51,12 +51,12 @@ namespace NzbDrone.Core.Providers /// /// The TVDB ID of the series /// Whether or not the show is monitored - public bool IsMonitored(long id) + public virtual bool IsMonitored(long id) { return _sonioRepo.Exists(c => c.SeriesId == id && c.Monitored); } - public bool QualityWanted(int seriesId, QualityTypes quality) + public virtual bool QualityWanted(int seriesId, QualityTypes quality) { var series = _sonioRepo.Single(seriesId); @@ -64,7 +64,7 @@ namespace NzbDrone.Core.Providers return profile.Allowed.Contains(quality); } - public TvdbSeries MapPathToSeries(string path) + public virtual TvdbSeries MapPathToSeries(string path) { var seriesPath = new DirectoryInfo(path); var searchResults = _tvDb.GetSeries(seriesPath.Name); @@ -75,7 +75,7 @@ namespace NzbDrone.Core.Providers return _tvDb.GetSeries(searchResults.Id, false); } - public Series UpdateSeriesInfo(int seriesId) + public virtual Series UpdateSeriesInfo(int seriesId) { var tvDbSeries = _tvDb.GetSeries(seriesId, true); var series = GetSeries(seriesId); @@ -94,7 +94,7 @@ namespace NzbDrone.Core.Providers return series; } - public void AddSeries(string path, int tvDbSeriesId, int qualityProfileId) + public virtual void AddSeries(string path, int tvDbSeriesId, int qualityProfileId) { Logger.Info("Adding Series [{0}] Path: [{1}]", tvDbSeriesId, path); @@ -111,17 +111,17 @@ namespace NzbDrone.Core.Providers _sonioRepo.Add(repoSeries); } - public Series FindSeries(string title) + public virtual Series FindSeries(string title) { return _sonioRepo.Single(s => s.CleanTitle == Parser.NormalizeTitle(title)); } - public void UpdateSeries(Series series) + public virtual void UpdateSeries(Series series) { _sonioRepo.Update(series); } - public void DeleteSeries(int seriesId) + public virtual void DeleteSeries(int seriesId) { Logger.Warn("Deleting Series [{0}]", seriesId); @@ -154,7 +154,7 @@ namespace NzbDrone.Core.Providers } } - public bool SeriesPathExists(string cleanPath) + public virtual bool SeriesPathExists(string cleanPath) { if (_sonioRepo.Exists(s => s.Path == cleanPath)) return true; diff --git a/NzbDrone.Core/Providers/XbmcProvider.cs b/NzbDrone.Core/Providers/XbmcProvider.cs index 688e4933d..3dc53785d 100644 --- a/NzbDrone.Core/Providers/XbmcProvider.cs +++ b/NzbDrone.Core/Providers/XbmcProvider.cs @@ -13,11 +13,11 @@ namespace NzbDrone.Core.Providers public class XbmcProvider : IXbmcProvider { private readonly IConfigProvider _configProvider; - private readonly IHttpProvider _httpProvider; + private readonly HttpProvider _httpProvider; private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - public XbmcProvider(IConfigProvider configProvider, IHttpProvider httpProvider) + public XbmcProvider(IConfigProvider configProvider, HttpProvider httpProvider) { _configProvider = configProvider; _httpProvider = httpProvider; diff --git a/NzbDrone.sln b/NzbDrone.sln index 0cfcfbde7..4d14644d3 100644 --- a/NzbDrone.sln +++ b/NzbDrone.sln @@ -55,7 +55,6 @@ Global {43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|Any CPU.Build.0 = Debug|Any CPU {43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|x64.ActiveCfg = Debug|Any CPU {43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|x86.ActiveCfg = Debug|Any CPU {43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|x86.Build.0 = Debug|Any CPU diff --git a/packages/AutoMoq.1.3.1.3/AutoMoq.1.3.1.3.nupkg b/packages/AutoMoq.1.3.1.3/AutoMoq.1.3.1.3.nupkg new file mode 100644 index 000000000..c0f2c951e Binary files /dev/null and b/packages/AutoMoq.1.3.1.3/AutoMoq.1.3.1.3.nupkg differ diff --git a/packages/AutoMoq.1.3.1.3/lib/AutoMoq.dll b/packages/AutoMoq.1.3.1.3/lib/AutoMoq.dll new file mode 100644 index 000000000..797e0b387 Binary files /dev/null and b/packages/AutoMoq.1.3.1.3/lib/AutoMoq.dll differ diff --git a/packages/Moq.4.0.10827/License.txt b/packages/Moq.4.0.10827/License.txt new file mode 100644 index 000000000..fb36f9263 --- /dev/null +++ b/packages/Moq.4.0.10827/License.txt @@ -0,0 +1,39 @@ +Copyright (c) 2007. Clarius Consulting, Manas Technology Solutions, InSTEDD +http://code.google.com/p/moq/ +All rights reserved. + +Redistribution and use in source and binary forms, +with or without modification, are permitted provided +that the following conditions are met: + + * Redistributions of source code must retain the + above copyright notice, this list of conditions and + the following disclaimer. + + * Redistributions in binary form must reproduce + the above copyright notice, this list of conditions + and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Clarius Consulting, Manas Technology Solutions or InSTEDD nor the + names of its contributors may be used to endorse + or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +[This is the BSD license, see + http://www.opensource.org/licenses/bsd-license.php] \ No newline at end of file diff --git a/packages/Moq.4.0.10827/Moq.4.0.10827.nupkg b/packages/Moq.4.0.10827/Moq.4.0.10827.nupkg new file mode 100644 index 000000000..91e88a472 Binary files /dev/null and b/packages/Moq.4.0.10827/Moq.4.0.10827.nupkg differ diff --git a/packages/Moq.4.0.10827/Moq.chm b/packages/Moq.4.0.10827/Moq.chm new file mode 100644 index 000000000..f5779bbbd Binary files /dev/null and b/packages/Moq.4.0.10827/Moq.chm differ diff --git a/packages/Moq.4.0.10827/lib/NET35/Moq.dll b/packages/Moq.4.0.10827/lib/NET35/Moq.dll new file mode 100644 index 000000000..3d3b8ccd0 Binary files /dev/null and b/packages/Moq.4.0.10827/lib/NET35/Moq.dll differ diff --git a/packages/Moq.4.0.10827/lib/NET35/Moq.pdb b/packages/Moq.4.0.10827/lib/NET35/Moq.pdb new file mode 100644 index 000000000..b0eaa8025 Binary files /dev/null and b/packages/Moq.4.0.10827/lib/NET35/Moq.pdb differ diff --git a/packages/Moq.4.0.10827/lib/NET35/Moq.xml b/packages/Moq.4.0.10827/lib/NET35/Moq.xml new file mode 100644 index 000000000..a0be31ce5 --- /dev/null +++ b/packages/Moq.4.0.10827/lib/NET35/Moq.xml @@ -0,0 +1,5768 @@ + + + + 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. + + + + + Encapsulates a method that has five parameters and does not return a value. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + + + + Encapsulates a method that has five parameters and returns a value of the type specified by the parameter. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the return value of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The return value of the method that this delegate encapsulates. + + + + Encapsulates a method that has six parameters and does not return a value. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + + + + Encapsulates a method that has six parameters and returns a value of the type specified by the parameter. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the return value of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The return value of the method that this delegate encapsulates. + + + + Encapsulates a method that has seven parameters and does not return a value. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + + + + Encapsulates a method that has seven parameters and returns a value of the type specified by the parameter. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the return value of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The return value of the method that this delegate encapsulates. + + + + Encapsulates a method that has eight parameters and does not return a value. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + + + + Encapsulates a method that has eight parameters and returns a value of the type specified by the parameter. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the return value of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The return value of the method that this delegate encapsulates. + + + + Encapsulates a method that has nine parameters and does not return a value. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + + + + Encapsulates a method that has nine parameters and returns a value of the type specified by the parameter. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the return value of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The return value of the method that this delegate encapsulates. + + + + Encapsulates a method that has ten parameters and does not return a value. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + + + + Encapsulates a method that has ten parameters and returns a value of the type specified by the parameter. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the return value of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The return value of the method that this delegate encapsulates. + + + + Encapsulates a method that has eleven parameters and does not return a value. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the eleventh parameter of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The eleventh parameter of the method that this delegate encapsulates. + + + + Encapsulates a method that has eleven parameters and returns a value of the type specified by the parameter. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the eleventh parameter of the method that this delegate encapsulates. + The type of the return value of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The eleventh parameter of the method that this delegate encapsulates. + The return value of the method that this delegate encapsulates. + + + + Encapsulates a method that has twelve parameters and does not return a value. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the eleventh parameter of the method that this delegate encapsulates. + The type of the twelfth parameter of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The eleventh parameter of the method that this delegate encapsulates. + The twelfth parameter of the method that this delegate encapsulates. + + + + Encapsulates a method that has twelve parameters and returns a value of the type specified by the parameter. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the eleventh parameter of the method that this delegate encapsulates. + The type of the twelfth parameter of the method that this delegate encapsulates. + The type of the return value of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The eleventh parameter of the method that this delegate encapsulates. + The twelfth parameter of the method that this delegate encapsulates. + The return value of the method that this delegate encapsulates. + + + + Encapsulates a method that has thirteen parameters and does not return a value. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the eleventh parameter of the method that this delegate encapsulates. + The type of the twelfth parameter of the method that this delegate encapsulates. + The type of the thirteenth parameter of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The eleventh parameter of the method that this delegate encapsulates. + The twelfth parameter of the method that this delegate encapsulates. + The thirteenth parameter of the method that this delegate encapsulates. + + + + Encapsulates a method that has thirteen parameters and returns a value of the type specified by the parameter. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the eleventh parameter of the method that this delegate encapsulates. + The type of the twelfth parameter of the method that this delegate encapsulates. + The type of the thirteenth parameter of the method that this delegate encapsulates. + The type of the return value of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The eleventh parameter of the method that this delegate encapsulates. + The twelfth parameter of the method that this delegate encapsulates. + The thirteenth parameter of the method that this delegate encapsulates. + The return value of the method that this delegate encapsulates. + + + + Encapsulates a method that has fourteen parameters and does not return a value. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the eleventh parameter of the method that this delegate encapsulates. + The type of the twelfth parameter of the method that this delegate encapsulates. + The type of the thirteenth parameter of the method that this delegate encapsulates. + The type of the fourteenth parameter of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The eleventh parameter of the method that this delegate encapsulates. + The twelfth parameter of the method that this delegate encapsulates. + The thirteenth parameter of the method that this delegate encapsulates. + The fourteenth parameter of the method that this delegate encapsulates. + + + + Encapsulates a method that has fourteen parameters and returns a value of the type specified by the parameter. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the eleventh parameter of the method that this delegate encapsulates. + The type of the twelfth parameter of the method that this delegate encapsulates. + The type of the thirteenth parameter of the method that this delegate encapsulates. + The type of the fourteenth parameter of the method that this delegate encapsulates. + The type of the return value of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The eleventh parameter of the method that this delegate encapsulates. + The twelfth parameter of the method that this delegate encapsulates. + The thirteenth parameter of the method that this delegate encapsulates. + The fourteenth parameter of the method that this delegate encapsulates. + The return value of the method that this delegate encapsulates. + + + + Encapsulates a method that has fifteen parameters and does not return a value. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the eleventh parameter of the method that this delegate encapsulates. + The type of the twelfth parameter of the method that this delegate encapsulates. + The type of the thirteenth parameter of the method that this delegate encapsulates. + The type of the fourteenth parameter of the method that this delegate encapsulates. + The type of the fifteenth parameter of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The eleventh parameter of the method that this delegate encapsulates. + The twelfth parameter of the method that this delegate encapsulates. + The thirteenth parameter of the method that this delegate encapsulates. + The fourteenth parameter of the method that this delegate encapsulates. + The fifteenth parameter of the method that this delegate encapsulates. + + + + Encapsulates a method that has fifteen parameters and returns a value of the type specified by the parameter. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the eleventh parameter of the method that this delegate encapsulates. + The type of the twelfth parameter of the method that this delegate encapsulates. + The type of the thirteenth parameter of the method that this delegate encapsulates. + The type of the fourteenth parameter of the method that this delegate encapsulates. + The type of the fifteenth parameter of the method that this delegate encapsulates. + The type of the return value of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The eleventh parameter of the method that this delegate encapsulates. + The twelfth parameter of the method that this delegate encapsulates. + The thirteenth parameter of the method that this delegate encapsulates. + The fourteenth parameter of the method that this delegate encapsulates. + The fifteenth parameter of the method that this delegate encapsulates. + The return value of the method that this delegate encapsulates. + + + + Encapsulates a method that has sixteen parameters and does not return a value. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the eleventh parameter of the method that this delegate encapsulates. + The type of the twelfth parameter of the method that this delegate encapsulates. + The type of the thirteenth parameter of the method that this delegate encapsulates. + The type of the fourteenth parameter of the method that this delegate encapsulates. + The type of the fifteenth parameter of the method that this delegate encapsulates. + The type of the sixteenth parameter of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The eleventh parameter of the method that this delegate encapsulates. + The twelfth parameter of the method that this delegate encapsulates. + The thirteenth parameter of the method that this delegate encapsulates. + The fourteenth parameter of the method that this delegate encapsulates. + The fifteenth parameter of the method that this delegate encapsulates. + The sixteenth parameter of the method that this delegate encapsulates. + + + + Encapsulates a method that has sixteen parameters and returns a value of the type specified by the parameter. + + The type of the first parameter of the method that this delegate encapsulates. + The type of the second parameter of the method that this delegate encapsulates. + The type of the third parameter of the method that this delegate encapsulates. + The type of the fourth parameter of the method that this delegate encapsulates. + The type of the fifth parameter of the method that this delegate encapsulates. + The type of the sixth parameter of the method that this delegate encapsulates. + The type of the seventh parameter of the method that this delegate encapsulates. + The type of the eighth parameter of the method that this delegate encapsulates. + The type of the nineth parameter of the method that this delegate encapsulates. + The type of the tenth parameter of the method that this delegate encapsulates. + The type of the eleventh parameter of the method that this delegate encapsulates. + The type of the twelfth parameter of the method that this delegate encapsulates. + The type of the thirteenth parameter of the method that this delegate encapsulates. + The type of the fourteenth parameter of the method that this delegate encapsulates. + The type of the fifteenth parameter of the method that this delegate encapsulates. + The type of the sixteenth parameter of the method that this delegate encapsulates. + The type of the return value of the method that this delegate encapsulates. + The first parameter of the method that this delegate encapsulates. + The second parameter of the method that this delegate encapsulates. + The third parameter of the method that this delegate encapsulates. + The fourth parameter of the method that this delegate encapsulates. + The fifth parameter of the method that this delegate encapsulates. + The sixth parameter of the method that this delegate encapsulates. + The seventh parameter of the method that this delegate encapsulates. + The eighth parameter of the method that this delegate encapsulates. + The nineth parameter of the method that this delegate encapsulates. + The tenth parameter of the method that this delegate encapsulates. + The eleventh parameter of the method that this delegate encapsulates. + The twelfth parameter of the method that this delegate encapsulates. + The thirteenth parameter of the method that this delegate encapsulates. + The fourteenth parameter of the method that this delegate encapsulates. + The fifteenth parameter of the method that this delegate encapsulates. + The sixteenth parameter of the method that this delegate encapsulates. + The return value of the method that this delegate encapsulates. + + + + 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/packages/Moq.4.0.10827/lib/NET40/Moq.dll b/packages/Moq.4.0.10827/lib/NET40/Moq.dll new file mode 100644 index 000000000..3a3e653aa Binary files /dev/null and b/packages/Moq.4.0.10827/lib/NET40/Moq.dll differ diff --git a/packages/Moq.4.0.10827/lib/NET40/Moq.pdb b/packages/Moq.4.0.10827/lib/NET40/Moq.pdb new file mode 100644 index 000000000..03cca5608 Binary files /dev/null and b/packages/Moq.4.0.10827/lib/NET40/Moq.pdb differ diff --git a/packages/Moq.4.0.10827/lib/NET40/Moq.xml b/packages/Moq.4.0.10827/lib/NET40/Moq.xml new file mode 100644 index 000000000..13b8804b5 --- /dev/null +++ b/packages/Moq.4.0.10827/lib/NET40/Moq.xml @@ -0,0 +1,5120 @@ + + + + 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/packages/Moq.4.0.10827/lib/Silverlight4/Castle.Core.dll b/packages/Moq.4.0.10827/lib/Silverlight4/Castle.Core.dll new file mode 100644 index 000000000..a887ecd5f Binary files /dev/null and b/packages/Moq.4.0.10827/lib/Silverlight4/Castle.Core.dll differ diff --git a/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.dll b/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.dll new file mode 100644 index 000000000..fb516c1dd Binary files /dev/null and b/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.dll differ diff --git a/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.pdb b/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.pdb new file mode 100644 index 000000000..d33d394fc Binary files /dev/null and b/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.pdb differ diff --git a/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.xml b/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.xml new file mode 100644 index 000000000..ac37f5c62 --- /dev/null +++ b/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.xml @@ -0,0 +1,5101 @@ + + + + Moq.Silverlight + + + + + 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); + + + + + + Base class for mocks and static helper class with methods that + apply to mocked objects, such as to + retrieve a from an object instance. + + + + + Helper interface used to hide the base + members from the fluent API to make it much cleaner + in Visual Studio intellisense. + + + + + + + + + + + + + + + + + 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. + + + + + 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); + + + + + + Obsolete. + + + + + Obsolete. + + + + + Obsolete. + + + + + Obsolete. + + + + + Obsolete. + + + + + Exposes the mocked object instance. + + + + + 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. + + + + + 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 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. + + + + + 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. + + + + + 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. + + + + + The intention of is to create a more readable + string representation for the failure message. + + + + + 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. + + + + + 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 + + + + 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); + + + + + + Implements the fluent API. + + + + + Defines the Callback verb and overloads. + + + + + 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)); + + + + + + 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)); + + + + + + 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 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 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. + + + + + 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. + + + + + Implements the fluent API. + + + + + 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 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)); + + + + + + 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); + + + + + + Implements the fluent API. + + + + + Defines the Returns verb. + + Mocked type. + Type of the return value from the expression. + + + + 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); + + + + + + 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]); + + + + + + 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. + + + + + 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)); + + + + + + 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. + + + + + 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. + + + + + 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. + + + + 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. + + + + + 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>(); + + + + + + 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. + + + + + + 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. + + + + + We need this non-generics base class so that + we can use from + generic code. + + + + + 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 . + + + + + 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. + + + + + 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. + + + + + + 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. + + + + + 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. + + + + + 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. + + + + 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. + + + + + + + + + + + + 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}. + + + + + 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. + + + + + Helper for sequencing return values in the same method. + + + + + Return a sequence of values, once per call. + + + + + 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/packages/Unity.2.0/Unity.2.0.nupkg b/packages/Unity.2.0/Unity.2.0.nupkg new file mode 100644 index 000000000..db3f48942 Binary files /dev/null and b/packages/Unity.2.0/Unity.2.0.nupkg differ diff --git a/packages/Unity.2.0/lib/20/Microsoft.Practices.ServiceLocation.dll b/packages/Unity.2.0/lib/20/Microsoft.Practices.ServiceLocation.dll new file mode 100644 index 000000000..3f8895473 Binary files /dev/null and b/packages/Unity.2.0/lib/20/Microsoft.Practices.ServiceLocation.dll differ diff --git a/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Configuration.dll b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Configuration.dll new file mode 100644 index 000000000..619a5721f Binary files /dev/null and b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Configuration.dll differ diff --git a/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Configuration.xml b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Configuration.xml new file mode 100644 index 000000000..8903a0ca7 --- /dev/null +++ b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Configuration.xml @@ -0,0 +1,2451 @@ + + + + Microsoft.Practices.Unity.Configuration + + + + + A configuration element storing information about a single type alias. + + + + + Base class for configuration elements with a default implementation of + public deserialization. + + + + + Load this element from the given . + + Contains the XML to initialize from. + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Construct a new, uninitialized . + + + + + Construct a new that is initialized + to alias to the target . + + Alias to use. + Type that is aliased. + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + The alias used for this type. + + + + + The fully qualified name this alias refers to. + + + + + A collection of s. + + + + + Specialization of + that provides a canned implmentation of . + + Type of configuration element in the collection. + + + + A base helper class for implementing configuration collections. + + Type of configuration element contained in + the collection. + + + + Plug point to get objects out of the collection. + + Index in the collection to retrieve the item from. + Item at that index or null if not present. + + + + Plug point to get objects out of the collection. + + Key to look up the object by. + Item with that key or null if not present. + + + + Load this element from the given . + + Contains the XML to initialize from. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + 1 + + + + Add a new element to the collection. + + Element to add. + + + + Remove an element from the collection at the given index. + + The index of the item to remove. + + + + Remove all the items in the collection. + + + + + Write out the contents of this collection to the given + without a containing element + corresponding directly to this container element. Each + child element will have a tag name given by + . + + to output XML to. + Name of tag to generate. + + + + Indexer to retrieve items in the collection by index. + + Index of the item to get or set. + The item at the given index. + + + + When overridden in a derived class, creates a new . + + + A new . + + + + + Causes the configuration system to throw an exception. + + + true if the unrecognized element was deserialized successfully; otherwise, false. The default is false. + + The name of the unrecognized element. + An input stream that reads XML from the configuration file. + The element specified in is the <clear> element. + starts with the reserved prefix "config" or "lock". + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + Indexer that allows you to get or set an alias by the alias name. + + Alias of element to get or set. + The type name at that alias. + + + + A configuration element used to configure injection of + a specific set of values into an array. + + + + + Base class for configuration elements that describe a value that will + be injected. + + + + + Initialize a new instance of . + + + + + Generate an object + that will be used to configure the container for a type registration. + + Container that is being configured. Supplied in order + to let custom implementations retrieve services; do not configure the container + directly in this method. + Type of the + + + + + Validate that an expected attribute is present in the given + dictionary and that it has a non-empty value. + + Dictionary of name/value pairs to check. + attribute name to check. + + + + Return a unique string that can be used to identify this object. Used + by the configuration collection support. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Generate an object + that will be used to configure the container for a type registration. + + Container that is being configured. Supplied in order + to let custom implementations retrieve services; do not configure the container + directly in this method. + Type of the + + + + + Type of array to inject. This is actually the type of the array elements, + not the array type. Optional, if not specified we take the type from + our containing element. + + + + + Values used to calculate the contents of the array. + + + + + A configuration element representing the namespace + tags in the config file. + + + + + An element with a single "name" property, used for + the namespaces and assemblies. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Name attribute for this element. + + + + + A collection of s in configuration. + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + Helpful extension methods when implementing configuration sections + that deserialize "unwrapped" elements - elements that should be + deserialized into a container but can be present outside + that container in the actual config file. + + + + + Deserialize an element of the given type, store it in + the collection object, and + + Type of element to create and deserialize. + Parent element containing element to deserialize. + Xml reader containing state to deserialize from. + Collection to store the created element into. + The created element. + + + + Deserialize an element, basing the element type on the one + supplied at runtime, and then store the element into the + given . + + This method is useful when reading elements into a polymorphic collection. + Base type of element to store. + Element that contains the collection being stored into. + Xml Reader containing state to deserialize from. + Runtime type of element to create. + Collection to store the created element into. + The created element. + + + + Class that tracks the current input state of the parser. + + + + + A simple implementing of the rules for a Parsing Expression Grammar + parsing algorithm. This supplies basic methods to do the primitives + of the PEG, and combinators to create larger rules. + + + + + The PEG "dot" operator that matches and consumes one character. + + Input to the parser. + The parse result. + + + + Parse function generator that returns a method to match a single, + specific character. + + Character to match. + The generated parsing function. + + + + Parse function generator that checks if the current character matches + the predicate supplied. + + Predicate used to determine if the character is in + the given range. + The generated parsing function. + + + + The "*" operator - match zero or more of the inner parse expressions. + + Parse method to repeat matching. + The generated parsing function. + + + + Parsing combinator that matches all of the given expressions in + order, or matches none of them. + + Expressions that form the sequence to match. + The combined sequence. + + + + Parsing combinator that implements the PEG prioritized choice operator. Basically, + try each of the expressions in order, and match if any of them match, stopping on the + first match. + + Expressions that form the set of alternatives. + The combined parsing method. + + + + Parsing combinator implementing the "not" predicate. This wraps + the given parsing method with a check + to see if it matched. If it matched, then the Not fails, and vice + versa. The result consumes no input. + + The parse method to wrap. + The generated parsing function. + + + + Parsing expression that matches End of input. + + Parser input. + Parse result + + + + Combinator that executes an action if the given expression matched. + + Parsing expression to match. + Action to execute if + matched. Input is the matched text from . + The result of . + + + + Combinator that executes an action if the given expression matched. + + parsing expression to match. + Method to execute if a match happens. This method returns + the that will be returned from the combined expression. + The result of if expression matched, else + whatever returned. + + + + Object containing the result of attempting to match a PEG rule. + This object is the return type for all parsing methods. + + + + + Did the rule match? + + + + + The characters that were matched (if any) + + + + + Any extra information provided by the parsing expression + (only set if the parse matched). The nature + of the data varies depending on the parsing expression. + + + + + Helper methods to make it easier to pull the data + out of the result of a sequence expression. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + 2 + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + 1 + + + + Adds an item to the . + + The object to add to the . + The is read-only. + + + + + Removes all items from the . + + The is read-only. + + + + + Determines whether the contains a specific value. + + + true if is found in the ; otherwise, false. + + The object to locate in the . + + + + + Copies the elements of the sequence to an , starting at a particular index. + + The one-dimensional that is the destination of the elements copied from this sequence. The must have zero-based indexing. + The zero-based index in at which copying begins. + is null. + is less than 0. + is multidimensional. + -or- + is equal to or greater than the length of . + -or- + The number of elements in the source is greater than the available space from to the end of the destination . + + + + + Removes the first occurrence of a specific object from the . + + + true if was successfully removed from the ; otherwise, false. This method also returns false if is not found in the original . + + The object to remove from the . + The is read-only. + + + + + Determines the index of a specific item in the . + + + The index of if found in the list; otherwise, -1. + + The object to locate in the . + + + + + Inserts an item to the at the specified index. + + The zero-based index at which should be inserted. + The object to insert into the . + is not a valid index in the . + The is read-only. + + + + + Removes the item at the specified index. + + The zero-based index of the item to remove. + is not a valid index in the . + The is read-only. + + + + + Gets the number of elements contained in the . + + + The number of elements contained in the . + + + + + Gets a value indicating whether the is read-only. + + + true if the is read-only; otherwise, false. + + + + + Gets or sets the element at the specified index. + + + The element at the specified index. + + The zero-based index of the element to get or set. + is not a valid index in the . + The property is set and the is read-only. + + + + + Class containing information about a type name. + + + + + The base name of the class + + + + + Namespace if any + + + + + Assembly name, if any + + + + + Helper methods on . + + + + + A helper method to make it more foolproof to write elements. This takes care of writing the + start and end elment tags, and takes a nested closure with the code to write the content of + the tag. That way the caller doesn't need to worry about the details of getting the start + and end tags correct. + + + We don't support XML Namespaces here because .NET configuration doesn't use them so + we don't need it for this current implementation. + + XmlWriter to write to. + Name of element. + Nested lambda which, when executed, will create the content for the + element. + (for method chaining if desired). + + + + A helper method to make it easier to output attributes. If the is + null or an empty string, output nothing, else output the given XML attribute. + + Writer to output to. + Attribute name to write. + Value for the attribute. + (for method chaining if desired). + + + + A base class for those elements that can be used + to configure a unity container. + + + + + Create a new instance of . + + + + + Apply this element's configuration to the given . + + Container to configure. + + + + Return a unique key that can be used to manage this element in a collection. + + + + + A couple of useful extension methods on IDictionary + + + + + Get the value from a dictionary, or null if there is no value. + + Key type of dictionary. + Value type of dictionary. + Dictionary to search. + Key to look up. + The value at the key or null if not in the dictionary. + + + + A helper class used to map element tag names to a handler method + used to interpret that element. + + + + + + Add method to enable dictionary initializer syntax + + + + + + + Process an unknown element according to the map entries. + + Parent element that hit this unknown element. + Name of the unknown element. + XmlReader positioned at start of element. + true if processed, false if not. + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + 2 + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + 1 + + + + A helper class used to map element tag names to a handler method + used to interpret that element. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + 2 + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + 1 + + + + A helper class that assists in deserializing parameter and property + elements. These elements both have a single "value" child element that + specify the value to inject for the property or parameter. + + + + + Create a new that wraps reading + values and storing them in the given . + + Element that contains the value elements. + + + + Gets a , or if none is present, + returns a default . + + The . + The given , unless + is null, in which case returns + a . + + + + Helper method used during deserialization to handle + attributes for the dependency and value tags. + + attribute name. + attribute value. + true + + + + Helper method used during deserialization to handle the default + value element tags. + + The element name. + XML data to read. + True if deserialization succeeded, false if it failed. + + + + Call this method at the end of deserialization of your element to + set your value element. + + + + + Serialize a object out to XML. + This method is aware of and implements the shorthand attributes + for dependency and value elements. + + Writer to output XML to. + The to serialize. + If true, always output an element. If false, then + dependency and value elements will be serialized as attributes in the parent tag. + + + + Configuration element representing a constructor configuration. + + + + + Base class for configuration elements that generate + object to configure a container. + + + + + Return the set of s that are needed + to configure the container according to this configuration element. + + Container that is being configured. + Type that is being registered. + Type that is being mapped to. + Name this registration is under. + One or more objects that should be + applied to the container registration. + + + + Get the standard tag name for an + taking into account currently loaded section extensions. + + Element to get the name for. + The element name. + If the member element is not currently registered + with the section. + + + + Each element must have a unique key, which is generated by the subclasses. + + + + + Element name to use to serialize this into XML. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Return the set of s that are needed + to configure the container according to this configuration element. + + Container that is being configured. + Type that is being registered. + Type that is being mapped to. + Name this registration is under. + One or more objects that should be + applied to the container registration. + + + + The parameters of the constructor to call. + + + + + Each element must have a unique key, which is generated by the subclasses. + + + + + Element name to use to serialize this into XML. + + + + + A collection of s as + loaded from configuration. + + + + + When overridden in a derived class, creates a new . + + + A new . + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + A configuration element class defining the set of registrations to be + put into a container. + + + + + Original configuration API kept for backwards compatibility. + + Container to configure + + + + Apply the configuration information in this element to the + given . + + Container to configure. + + + + Gets a value indicating whether an unknown element is encountered during deserialization. + + + true when an unknown element is encountered while deserializing; otherwise, false. + + The name of the unknown subelement. + The being used for deserialization. + The element identified by is locked. + - or - + One or more of the element's attributes is locked. + - or - + is unrecognized, or the element has an unrecognized attribute. + - or - + The element has a Boolean attribute with an invalid value. + - or - + An attempt was made to deserialize a property more than once. + - or - + An attempt was made to deserialize a property that is not a valid member of the element. + - or - + The element cannot contain a CDATA or text element. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Name for this container configuration as given in the config file. + + + + + The type registrations in this container. + + + + + Any instances to register in the container. + + + + + Any extensions to add to the container. + + + + + Set of any extra configuration elements that were added by a + section extension. + + + This is not marked as a configuration property because we don't want + the actual property to show up as a nested element in the configuration. + + + + Configuration element representing an extension to add to a container. + + + + + Add the extension specified in this element to the container. + + Container to configure. + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Type of the extension to add. + + + + + A collection of s. + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + A derived class that describes + a parameter that should be resolved through the container. + + + + + Create a new instance of . + + + + + Create a new instance of with + properties initialized from the contents of + . + + Dictionary of name/value pairs to + initialize this object with. + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Write the contents of this element to the given . This + method always outputs an explicit <dependency> tag, instead of providing + attributes to the parent method. + + Writer to send XML content to. + + + + Generate an object + that will be used to configure the container for a type registration. + + Container that is being configured. Supplied in order + to let custom implementations retrieve services; do not configure the container + directly in this method. + Type of the + + + + + Name to use to when resolving. If empty, resolves the default. + + + + + Name of type this dependency should resolve to. This is optional; + without it the container will resolve the type of whatever + property or parameter this element is contained in. + + + + + Base class used to derive new elements that can occur + directly within a container element. + + + + + Initialize a new instance of . + + + + + When overridden in a derived class, this method will make configuration + calls into the given according to its contents. + + The container to configure. + + + + Unique key generated for use in the collection class. + + + + + A collection of s. + + + + + When overridden in a derived class, creates a new . + + + A new . + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + This class manages the set of extension elements + added by section elements. + + + + + Clear the current set of extension elements. + + + + + Register a new ContainerExtensionConfigurationElement with he section so it + can be read. + + prefix if any. + tag name. + Type of element to register. + + + + Register a new with the section + so it can be read. + + prefix if any. + Tag name. + Type of element to register. + + + + Register a new with the section + so it can be read. + + prefix if any. + Tag name. + Type of element to register. + + + + Retrieve the registered for the given + tag. + + Tag to look up. + Type of element, or null if not registered. + + + + Retrieve the ContainerExtensionConfigurationElement registered for the given + tag. + + Tag to look up. + Type of element, or null if not registered. + + + + Retrieve the ContainerExtensionConfigurationElement registered for the given + tag. + + Tag to look up. + Type of element, or null if not registered. + + + + Retrieve the correct tag to use when serializing the given + to XML. + + Element to be serialized. + The tag for that element type. + if the element is of a type that + is not registered with the section already. + + + + A polymorphic collection of s. + + + + + Causes the configuration system to throw an exception. + + + true if the unrecognized element was deserialized successfully; otherwise, false. The default is false. + + The name of the unrecognized element. + An input stream that reads XML from the configuration file. + The element specified in is the <clear> element. + starts with the reserved prefix "config" or "lock". + + + + + When overridden in a derived class, creates a new . + + + A new . + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + Indexer that lets you access elements by their key. + + Key to retrieve element with. + The element. + + + + A configuration element that describes an instance to add to the container. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Add the instance defined by this element to the given container. + + Container to configure. + + + + Name to register instance under + + + + + Value for this instance + + + + + Type of the instance. If not given, defaults to string + + + + + Type name for the type converter to use to create the instance. If not + given, defaults to the default type converter for this instance type. + + + + + Key used to keep these instances unique in the config collection. + + + + + A collection of s. + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + An element that has a child Value property. + + + + + String that will be deserialized to provide the value. + + + + + A string describing where the value this element contains + is being used. For example, if setting a property Prop1, + this should return "property Prop1" (in english). + + + + + A configuration element that represents lifetime managers. + + + + + Create the described by + this element. + + A instance. + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Type of the lifetime manager. + + + + + Extra initialization information used by the type converter for this lifetime manager. + + + + + Type of to use to create the + lifetime manager. + + + + + A configuration element representing a method to call. + + + + + Construct a new instance of . + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Return the set of s that are needed + to configure the container according to this configuration element. + + Container that is being configured. + Type that is being registered. + Type that is being mapped to. + Name this registration is under. + One or more objects that should be + applied to the container registration. + + + + Name of the method to call. + + + + + Parameters to the method call. + + + + + Each element must have a unique key, which is generated by the subclasses. + + + + + Element name to use to serialize this into XML. + + + + + A configuration element representing the namespace + tags in the config file. + + + + + A collection of s in configuration. + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + A configuration element that specifies that a value + is optional. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Generate an object + that will be used to configure the container for a type registration. + + Container that is being configured. Supplied in order + to let custom implementations retrieve services; do not configure the container + directly in this method. + Type of the + + + + + Name used to resolve the dependency, leave out or blank to resolve default. + + + + + Type of dependency to resolve. If left out, resolved the type of + the containing parameter or property. + + + + + Configuration element representing a parameter passed to a constructor + or a method. + + + + + Construct a new instance of . + + + + + Returns the required needed + to configure the container so that the correct value is injected. + + Container being configured. + Type of the parameter. + The value to use to configure the container. + + + + Does the information in this match + up with the given ? + + Information about the parameter. + True if this is a match, false if not. + + + + Reads XML from the configuration file. + + The that reads from the configuration file. + true to serialize only the collection key properties; otherwise, false. + The element to read is locked. + - or - + An attribute of the current node is not recognized. + - or - + The lock status of the current node cannot be determined. + + + + + Gets a value indicating whether an unknown attribute is encountered during deserialization. + + + true when an unknown attribute is encountered while deserializing; otherwise, false. + + The name of the unrecognized attribute. + The value of the unrecognized attribute. + + + + + Gets a value indicating whether an unknown element is encountered during deserialization. + + + true when an unknown element is encountered while deserializing; otherwise, false. + + The name of the unknown subelement. + The being used for deserialization. + The element identified by is locked. + - or - + One or more of the element's attributes is locked. + - or - + is unrecognized, or the element has an unrecognized attribute. + - or - + The element has a Boolean attribute with an invalid value. + - or - + An attempt was made to deserialize a property more than once. + - or - + An attempt was made to deserialize a property that is not a valid member of the element. + - or - + The element cannot contain a CDATA or text element. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Name of this parameter. + + + + + Type of this parameter. + + This is only needed in order to disambiguate method overloads. Normally + the parameter name is sufficient. + + + + Element that describes the value for this property. + + + This is NOT marked as a ConfigurationProperty because this + child element is polymorphic, and the element tag determines + the type. Standard configuration properties only let you do + this if it's a collection, but we only want one value. Thus + the separate property. The element is deserialized in + . + + + + A string describing where the value this element contains + is being used. For example, if setting a property Prop1, + this should return "property Prop1" (in english). + + + + + A collection of objects. + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + A collection of objects. + + + + + Causes the configuration system to throw an exception. + + + true if the unrecognized element was deserialized successfully; otherwise, false. The default is false. + + The name of the unrecognized element. + An input stream that reads XML from the configuration file. + The element specified in is the <clear> element. + starts with the reserved prefix "config" or "lock". + + + + + When overridden in a derived class, creates a new . + + + A new . + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + String that will be deserialized to provide the value. + + + + + A string describing where the value this element contains + is being used. For example, if setting a property Prop1, + this should return "property Prop1" (in english). + + + + + 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 An abstract ContainerConfiguringElement cannot be created. Please specify a concrete type.. + + + + + Looks up a localized string similar to An abstract ExtensionConfigurationElement object cannot be created. Please specify a concrete type.. + + + + + Looks up a localized string similar to An abstract InjectionMemberElement object cannot be created. Please specify a concrete type.. + + + + + Looks up a localized string similar to An abstract ParameterValueElement object cannot be created. Please specify a concrete type.. + + + + + Looks up a localized string similar to The type name or alias {0} could not be resolved. Please check your configuration file and verify this type name.. + + + + + Looks up a localized string similar to The dependency element for generic parameter {0} must not have an explicit type name but has '{1}'.. + + + + + Looks up a localized string similar to The optional dependency element for generic parameter {0} must not have an explicit type name but has '{1}'.. + + + + + Looks up a localized string similar to {0} {1}. + + + + + Looks up a localized string similar to The injection configuration for {0} has multiple values.. + + + + + Looks up a localized string similar to The configuration element type {0} has not been registered with the section.. + + + + + Looks up a localized string similar to The injection configuration for {0} is specified through both attributes and child value elements.. + + + + + Looks up a localized string similar to Could not load section extension type {0}.. + + + + + Looks up a localized string similar to The extension type {0} does not derive from SectionExtension.. + + + + + Looks up a localized string similar to The extension element type {0} that is being added does not derive from ContainerConfiguringElement, InjectionMemberElement, or ParameterValueElement. An extension element must derive from one of these types.. + + + + + Looks up a localized string similar to No valid attributes were found to construct the value for the {0}. Please check the configuration file.. + + + + + Looks up a localized string similar to Configuration is incorrect, the type {0} does not have a constructor that takes parameters named {1}.. + + + + + Looks up a localized string similar to Configuration is incorrect, the type {0} does not have a method named {1} that takes parameters named {2}.. + + + + + Looks up a localized string similar to The container named "{0}" is not defined in this configuration section.. + + + + + Looks up a localized string similar to The type {0} does not have a property named {1}.. + + + + + Looks up a localized string similar to The configuration is set to inject an array, but the type {0} is not an array type.. + + + + + Looks up a localized string similar to parameter. + + + + + Looks up a localized string similar to property. + + + + + Looks up a localized string similar to The attribute {0} must be present and non-empty.. + + + + + Looks up a localized string similar to The value element for {1} was specified for the generic array type {0}. Value elements are not allowed for generic array types.. + + + + + Looks up a localized string similar to The value element for {1} was specified for the generic parameter type {0}. Value elements are not allowed for generic parameter types.. + + + + + Looks up a localized string similar to The value element for {1} was specified for the generic type {0}. Value elements are not allowed for generic types.. + + + + + A class representing a property configuration element. + + + + + Construct a new instance of + + + + + Reads XML from the configuration file. + + The that reads from the configuration file. + true to serialize only the collection key properties; otherwise, false. + The element to read is locked. + - or - + An attribute of the current node is not recognized. + - or - + The lock status of the current node cannot be determined. + + + + + Gets a value indicating whether an unknown attribute is encountered during deserialization. + + + true when an unknown attribute is encountered while deserializing; otherwise, false. + + The name of the unrecognized attribute. + The value of the unrecognized attribute. + + + + + Gets a value indicating whether an unknown element is encountered during deserialization. + + + true when an unknown element is encountered while deserializing; otherwise, false. + + The name of the unknown subelement. + The being used for deserialization. + The element identified by is locked. + - or - + One or more of the element's attributes is locked. + - or - + is unrecognized, or the element has an unrecognized attribute. + - or - + The element has a Boolean attribute with an invalid value. + - or - + An attempt was made to deserialize a property more than once. + - or - + An attempt was made to deserialize a property that is not a valid member of the element. + - or - + The element cannot contain a CDATA or text element. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Return the set of s that are needed + to configure the container according to this configuration element. + + Container that is being configured. + Type that is being registered. + Type that is being mapped to. + Name this registration is under. + One or more objects that should be + applied to the container registration. + + + + Name of the property that will be set. + + + + + Each element must have a unique key, which is generated by the subclasses. + + + + + String that will be deserialized to provide the value. + + + + + A string describing where the value this element contains + is being used. For example, if setting a property Prop1, + this should return "property Prop1" (in english). + + + + + Element name to use to serialize this into XML. + + + + + A configuration element representing a single container type registration. + + + + + Apply the registrations from this element to the given container. + + Container to configure. + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + The type that is registered. + + + + + Name registered under. + + + + + Type that is mapped to. + + + + + Lifetime manager to register for this registration. + + + + + Any injection members (constructor, properties, etc.) that are specified for + this registration. + + + + + A collection of s. + + + + + Causes the configuration system to throw an exception. + + + true if the unrecognized element was deserialized successfully; otherwise, false. The default is false. + + The name of the unrecognized element. + An input stream that reads XML from the configuration file. + The element specified in is the <clear> element. + starts with the reserved prefix "config" or "lock". + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + Base class for Unity configuration section extensions. + Derived classes are used to add custom elments and aliases + into the configuration section being loaded. + + + + + Add the extensions to the section via the context. + + Context object that can be used to add elements and aliases. + + + + An object that gives the ability to add + elements and aliases to a configuration section. + + + + + Add a new alias to the configuration section. This is useful + for those extensions that add commonly used types to configuration + so users don't have to alias them repeatedly. + + The alias to use. + Type the alias maps to. + + + + Add a new alias to the configuration section. This is useful + for those extensions that add commonly used types to configuration + so users don't have to alias them repeatedly. + + Type the alias maps to. + The alias to use + + + + Add a new element to the configuration section schema. + + Tag name in the XML. + Type the tag maps to. + + + + Add a new element to the configuration section schema. + + Type the tag maps to. + Tag name in the XML. + + + + A configuration element used to specify which extensions to + add to the configuration schema. + + + + + Reads XML from the configuration file. + + The that reads from the configuration file. + true to serialize only the collection key properties; otherwise, false. + The element to read is locked. + - or - + An attribute of the current node is not recognized. + - or - + The lock status of the current node cannot be determined. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Type of the section extender object that will provide new elements to the schema. + + + + + Optional prefix that will be added to the element names added by this + section extender. If left out, no prefix will be added. + + + + + The extension object represented by this element. + + + + + A collection of s. + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + Type that manage access to a set of type aliases and implements + the logic for converting aliases to their actual types. + + + + + Set the set of aliases to use for resolution. + + Configuration section containing the various + type aliases, namespaces and assemblies. + + + + Resolves a type alias or type fullname to a concrete type. + + Type alias or type fullname + Type object or null if resolve fails. + Thrown if alias lookup fails. + + + + Resolves a type alias or type fullname to a concrete type. + + Alias or name to resolve. + if true and the alias does not + resolve, throw an , otherwise + return null on failure. + The type object or null if resolve fails and + is false. + + + + Resolve a type alias or type full name to a concrete type. + If is null or empty, return the + given instead. + + Type alias or full name to resolve. + Value to return if typeName is null or empty. + The concrete . + Thrown if alias lookup fails. + + + + Resolve a type alias or type full name to a concrete type. + If is null or empty, return the + given instead. + + Type alias or full name to resolve. + Value to return if typeName is null or empty. + if true and the alias does not + resolve, throw an , otherwise + return null on failure. + The concrete . + Thrown if alias lookup fails and + is true. + + + + A helper class that implements the actual logic for resolving a shorthand + type name (alias or raw type name) into an actual type object. + + + + + Construct a new that uses the given + sequence of alias, typename pairs to resolve types. + + Type aliases from the configuration file. + Assembly names to search. + Namespaces to search. + + + + Resolves a type alias or type fullname to a concrete type. + + Alias or name to resolve. + if true and the alias does not + resolve, throw an , otherwise + return null on failure. + The type object or null if resolve fails and + is false. + + + + Resolve a type alias or type full name to a concrete type. + If is null or empty, return the + given instead. + + Type alias or full name to resolve. + Value to return if typeName is null or empty. + if true and the alias does not + resolve, throw an , otherwise + return null on failure. + + If is null or an empty string, + then return . + Otherwise, return the resolved type object. If the resolution fails + and is false, then return null. + + + + + A configuration section describing configuration for an . + + + + + The name of the section where unity configuration is expected to be found. + + + + + XML Namespace string used for IntelliSense in this section. + + + + + Apply the configuration in the default container element to the given container. + + Container to configure. + The passed in . + + + + Apply the configuration in the default container element to the given container. + + Container to configure. + Name of the container element to use to configure the container. + The passed in . + + + + Reads XML from the configuration file. + + The object, which reads from the configuration file. + found no elements in the configuration file. + + + + + Gets a value indicating whether an unknown element is encountered during deserialization. + + + true when an unknown element is encountered while deserializing; otherwise, false. + + The name of the unknown subelement. + The being used for deserialization. + The element identified by is locked. + - or - + One or more of the element's attributes is locked. + - or - + is unrecognized, or the element has an unrecognized attribute. + - or - + The element has a Boolean attribute with an invalid value. + - or - + An attempt was made to deserialize a property more than once. + - or - + An attempt was made to deserialize a property that is not a valid member of the element. + - or - + The element cannot contain a CDATA or text element. + + + + + Creates an XML string containing an unmerged view of the object as a single section to write to a file. + + + An XML string containing an unmerged view of the object. + + The instance to use as the parent when performing the un-merge. + The name of the section to create. + The instance to use when writing to a string. + + + + + The current that is being deserialized + or being configured from. + + + + + Storage for XML namespace. The namespace isn't used or validated by config, but + it is useful for Visual Studio XML IntelliSense to kick in. + + + + + The set of containers defined in this configuration section. + + + + + The set of type aliases defined in this configuration file. + + + + + Any schema extensions that are added. + + + + + Any namespaces added to the type search list. + + + + + Any assemblies added to the type search list. + + + + + Add a new alias to the configuration section. This is useful + for those extensions that add commonly used types to configuration + so users don't have to alias them repeatedly. + + The alias to use. + Type the alias maps to. + + + + Add a new element to the configuration section schema. + + Tag name in the XML. + Type the tag maps to. + + + + Collection element for s. + + + + + Plug point to get objects out of the collection. + + Index in the collection to retrieve the item from. + Item at that index or null if not present. + + + + Plug point to get objects out of the collection. + + Key to look up the object by. + Item with that key or null if not present. + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + Retrieve a stored by name. + + Name to look up. + The stored container or null if not in the collection. + + + + Return the default container in the collection. The default is the one without a name. + + + + + Extensions to to simplify + loading configuration into a container. + + + + + Apply configuration from the given section and named container + into the given container. + + Unity container to configure. + Configuration section with config information. + Named container. + . + + + + Apply configuration from the default section (named "unity" pulled out of + ConfigurationManager) and the named container. + + Unity container to configure. + Named container element in configuration. + . + + + + Apply configuration from the default section and unnamed container element. + + Container to configure. + . + + + + Apply configuration from the default container in the given section. + + Unity container to configure. + Configuration section. + . + + + + Element that describes a constant value that will be + injected into the container. + + + + + Construct a new object. + + + + + Construct a new object, + initializing properties from the contents of + . + + Name/value pairs which + contain the values to initialize properties to. + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Write the contents of this element to the given . This + method always outputs an explicit <dependency> tag, instead of providing + attributes to the parent method. + + Writer to send XML content to. + + + + Generate an object + that will be used to configure the container for a type registration. + + Container that is being configured. Supplied in order + to let custom implementations retrieve services; do not configure the container + directly in this method. + Type of the parameter to get the value for. + The required object. + + + + Value for this element + + + + + + + + + diff --git a/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Interception.Configuration.dll b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Interception.Configuration.dll new file mode 100644 index 000000000..15ec9b8b4 Binary files /dev/null and b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Interception.Configuration.dll differ diff --git a/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Interception.Configuration.xml b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Interception.Configuration.xml new file mode 100644 index 000000000..c8d919d28 --- /dev/null +++ b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Interception.Configuration.xml @@ -0,0 +1,716 @@ + + + + Microsoft.Practices.Unity.Interception.Configuration + + + + + Configuration element that lets you specify additional interfaces + to add when this type is intercepted. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Return the set of s that are needed + to configure the container according to this configuration element. + + Container that is being configured. + Type that is being registered. + Type that is being mapped to. + Name this registration is under. + One or more objects that should be + applied to the container registration. + + + + Type of interface to add. + + + + + Each element must have a unique key, which is generated by the subclasses. + + + + + Configuration element representing a call handler. + + + + + Base class for the two children of the Policy element: + MatchingRuleElement and CallHandlerElement. + + + + These configuration elements have a required "name" attribute, an optional "type" attribute, and + optional child elements <lifetime> and <injection> + + + Elements without a value for the type attribute can only have a value for the name attribute, and + indicate that the represented handler or rule is configured elsewhere and that a reference to + the given name must be added to the policy to be resolved, while elements with a value for the type + attribute indicate how the represented handler or rule should be built and can optionally specify + lifetime management and injection configuration. + + + This element is similar to the , except that it does not provide + an extension point for arbitrary configuration. + + + + + + Reads XML from the configuration file. + + The that reads from the configuration file. + true to serialize only the collection key properties; otherwise, false. + The element to read is locked. + - or - + An attribute of the current node is not recognized. + - or - + The lock status of the current node cannot be determined. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Name of this item + + + + + Type that implements this matching rule or call handler. + + + + + Injection members that control how this item is created. + + + + + Lifetime manager for this item. + + + + + A collection of s for configuration. + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + Causes the configuration system to throw an exception. + + + true if the unrecognized element was deserialized successfully; otherwise, false. The default is false. + + The name of the unrecognized element. + An input stream that reads XML from the configuration file. + The element specified in is the <clear> element. + starts with the reserved prefix "config" or "lock". + + + + + Retrieve a call handler element from the collection by name. + + Name to look up. + The rule, or null if not in the collection. + + + + The <default> element that appears inside an <interceptor> element. + + + + + Base class for the default and key elements that can occur + inside the <interceptor> element. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Actually register the interceptor against this type. + + Container to configure. + interceptor to register. + + + + Type name that this interceptor will be registered for. + + + + + Return the type object that is resolved from the property. + + The type object. + + + + Actually register the interceptor against this type. + + Container to configure. + interceptor to register. + + + + Configuration elmement for specifying + interception behaviors for a type. + + + + + Reads XML from the configuration file. + + The that reads from the configuration file. + true to serialize only the collection key properties; otherwise, false. + The element to read is locked. + - or - + An attribute of the current node is not recognized. + - or - + The lock status of the current node cannot be determined. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Return the set of s that are needed + to configure the container according to this configuration element. + + Container that is being configured. + Type that is being registered. + Type that is being mapped to. + Name this registration is under. + One or more objects that should be + applied to the container registration. + + + + Type of behavior to add. + + + + + Name of behavior to resolve. + + + + + Should this behavior be configured as a default behavior for this type, or + specifically for this type/name pair only? + + + + + Each element must have a unique key, which is generated by the subclasses. + + + + + Section extension class used to add the elements needed to configure + Unity interception to the configuration schema. + + + + + Add the extensions to the section via the context. + + Context object that can be used to add elements and aliases. + + + + A configuration element that contains the top-level container configuration + information for interception - handler policies and global interceptor definitions. + + + + + Gets a value indicating whether an unknown element is encountered during deserialization. + + + true when an unknown element is encountered while deserializing; otherwise, false. + + The name of the unknown subelement. + The being used for deserialization. + The element identified by is locked. + - or - + One or more of the element's attributes is locked. + - or - + is unrecognized, or the element has an unrecognized attribute. + - or - + The element has a Boolean attribute with an invalid value. + - or - + An attempt was made to deserialize a property more than once. + - or - + An attempt was made to deserialize a property that is not a valid member of the element. + - or - + The element cannot contain a CDATA or text element. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Apply this element's configuration to the given . + + Container to configure. + + + + Policies defined for this container. + + + + + Configuration element that lets you configure + what interceptor to use for a type. + + + + + Initialize a new . + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Return the set of s that are needed + to configure the container according to this configuration element. + + Container that is being configured. + Type that is being registered. + Type that is being mapped to. + Name this registration is under. + One or more objects that should be + applied to the container registration. + + + + Type name for the interceptor to apply. + + + + + Name to use when resolving interceptors from the container. + + + + + Should this interceptor be registered as the default for the contained + type, or only for this particular type/name pair? + + + + + Each element must have a unique key, which is generated by the subclasses. + + + + + A collection of objects as shown + in configuration. + + + + + When overridden in a derived class, creates a new . + + + A new . + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + Configuration element that provides a top-level element for + configuration interceptors for types in a container. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Apply this element's configuration to the given . + + Container to configure. + + + + The various child elements that are contained in this element. + + + + + Configuration element that represents the configuration for + a specific interceptor, as presented in the config file inside + the <interceptors> element. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Gets a value indicating whether an unknown element is encountered during deserialization. + + + true when an unknown element is encountered while deserializing; otherwise, false. + + The name of the unknown subelement. + The being used for deserialization. + The element identified by is locked. + - or - + One or more of the element's attributes is locked. + - or - + is unrecognized, or the element has an unrecognized attribute. + - or - + The element has a Boolean attribute with an invalid value. + - or - + An attempt was made to deserialize a property more than once. + - or - + An attempt was made to deserialize a property that is not a valid member of the element. + - or - + The element cannot contain a CDATA or text element. + + + + + Type of interceptor to configure. + + + + + The types that this interceptor will be registered against. + + + + + Any value passed to the type converter. + + + + + Type converter to use to create the interceptor, if any. + + + + + A collection of objects + as stored in configuration. + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + The <key> element that occurs inside an <interceptor> element + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Actually register the interceptor against this type. + + Container to configure. + interceptor to register. + + + + Name registration should be under. To register under the default, leave blank. + + + + + A configuration element representing a matching rule. + + + + + A collection of s for configuration. + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + Causes the configuration system to throw an exception. + + + true if the unrecognized element was deserialized successfully; otherwise, false. The default is false. + + The name of the unrecognized element. + An input stream that reads XML from the configuration file. + The element specified in is the <clear> element. + starts with the reserved prefix "config" or "lock". + + + + + Retrieve a matching rule element from the collection by name. + + Name to look up. + The rule, or null if not in the collection. + + + + Configuration element for building up an interception policy. + + + + + Gets a value indicating whether an unknown element is encountered during deserialization. + + + true when an unknown element is encountered while deserializing; otherwise, false. + + The name of the unknown subelement. + The being used for deserialization. + The element identified by is locked. + - or - + One or more of the element's attributes is locked. + - or - + is unrecognized, or the element has an unrecognized attribute. + - or - + The element has a Boolean attribute with an invalid value. + - or - + An attempt was made to deserialize a property more than once. + - or - + An attempt was made to deserialize a property that is not a valid member of the element. + - or - + The element cannot contain a CDATA or text element. + + + + + Write the contents of this element to the given . + + The caller of this method has already written the start element tag before + calling this method, so deriving classes only need to write the element content, not + the start or end tags. + Writer to send XML content to. + + + + Name of this policy. + + + + + Matching rules for this policy. + + + + + Call handlers for this policy. + + + + + A collection of in the configuration. + + + + + Gets the element key for a specified configuration element when overridden in a derived class. + + + An that acts as the key for the specified . + + The to return the key for. + + + + + Indexer to retrieve policy element objects by name. + + Name of policy to get. + The element. + + + + A shortcut element to enable the policy injection behavior. + + + + + Return the set of s that are needed + to configure the container according to this configuration element. + + Container that is being configured. + Type that is being registered. + Type that is being mapped to. + Name this registration is under. + One or more objects that should be + applied to the container registration. + + + + Each element must have a unique key, which is generated by the subclasses. + + + + + 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 The abstract type InterceptorRegistrationElement cannot be created. Please create a concrete instance.. + + + + + Looks up a localized string similar to The <injection/> element is not allowed on element named '{0}' because it doesn't have a type attribute.. + + + + + Looks up a localized string similar to The <lifetime/> element is not allowed on element named '{0}' because it doesn't have a type attribute.. + + + + + Looks up a localized string similar to The type name or alias {0} could not be resolved. Please check your configuration file and verify this type name.. + + + + + Looks up a localized string similar to Cannot create instance of type {0} with a default constructor.. + + + + + Looks up a localized string similar to The type name {0} resolved to type {1} is not compatible with the required type {2}.. + + + + + Looks up a localized string similar to The type {0} could not be resolved to a valid type. Please double check your configuration.. + + + + + Looks up a localized string similar to The interception behavior element must have at least one of the 'name' or 'type' attributes.. + + + + diff --git a/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Interception.dll b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Interception.dll new file mode 100644 index 000000000..28b3c0e82 Binary files /dev/null and b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Interception.dll differ diff --git a/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Interception.xml b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Interception.xml new file mode 100644 index 000000000..c282fc211 --- /dev/null +++ b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.Interception.xml @@ -0,0 +1,3460 @@ + + + + Microsoft.Practices.Unity.Interception + + + + + Stores information about a single to be an additional interface for an intercepted object and + configures a container accordingly. + + + + + Stores information about a an intercepted object and configures a container accordingly. + + + + + Initializes a new instance of the with a + . + + A descriptor representing the interception behavior to use. + when is + . + when is not an interface. + + + + + Add policies to the to configure the container to use the represented + as an additional interface for the supplied parameters. + + Interface being registered. + Type to register. + Name used to resolve the type object. + Policy list to add policies to. + + + + Stores information about a single to be an additional interface for an intercepted object and + configures a container accordingly. + + The interface. + + + + Initializes a new instance of the . + + + + + An injection member that lets you specify behaviors that should + apply to all instances of a type in the container regardless + of what name it's resolved under. + + + + + Base class for injection members that allow you to add + interception behaviors. + + + + + Initializes a new instance of the with a + . + + The interception behavior to use. + + + + Initializes a new instance of the with a + given type/name pair. + + Type of behavior to + + + + + Initializes a new instance of the with a + given behavior type. + + Type of behavior to + + + + Add policies to the to configure the container to use the represented + for the supplied parameters. + + Interface being registered. + Type to register. + Name used to resolve the type object. + Policy list to add policies to. + + + + Get the list of behaviors for the current type so that it can be added to. + + Policy list. + Implementation type to set behaviors for. + Name type is registered under. + An instance of . + + + + Create a new that will + supply the given interception behavior to the container. + + Behavior to apply to this type. + + + + Create a new that will + resolve the given type/name pair to get the behavior. + + Type of behavior. + Name for behavior registration. + + + + Create a new that will + resolve the given type to get the behavior. + + Type of behavior. + + + + Get the list of behaviors for the current type so that it can be added to. + + Policy list. + Implementation type to set behaviors for. + Name type is registered under. + An instance of . + + + + A generic version of so you + can give the behavior type using generic syntax. + + Type of the behavior object to apply. + + + + Construct a new instance + that use the given type and name to resolve the behavior object. + + Name of the registration. + + + + Construct a new instance + that uses the given type to resolve the behavior object. + + + + + A that can be passed to the + method to specify + which interceptor to use. This member sets up the default + interceptor for a type - this will be used regardless of which + name is used to resolve the type. + + + + + Construt a new instance that, + when applied to a container, will register the given + interceptor as the default one. + + Interceptor to use. + + + + Construct a new that, when + applied to a container, will register the given type as + the default interceptor. + + Type of interceptor. + Name to use to resolve the interceptor. + + + + Construct a new that, when + applied to a container, will register the given type as + the default interceptor. + + Type of interceptor. + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Type of interface being registered. If no interface, + this will be null. + Type of concrete type being registered. + Name used to resolve the type object. + Policy list to add policies to. + + + + A generic version of so that + you can specify the interceptor type using generics. + + + + + + Create a new instance of . + + Name to use when resolving interceptor. + + + + Create a new instance of . + + + + + An that accumulates a sequence of + instances representing the additional interfaces for an intercepted object. + + + + + An that returns a sequence of + instances representing the additional interfaces for an intercepted object. + + + + + Gets the instances accumulated by this policy. + + + + + Initializes a new instance of the class. + + + + + Gets the instances accumulated by this policy. + + + + + An implementation of that will + resolve the interceptor through the container. + + + + + An interface that determines when to intercept instances + and which interceptor to use. + + + + + Interceptor to use. + + Context for current build operation. + + + + Construct a new that + will resolve the interceptor using the given build key. + + build key to resolve. + + + + Interceptor to use. + + Context for current build operation. + + + + An implementation of that will + resolve the interceptor through the container. + + + + + Interface that controls when and how types get intercepted. + + + + + Interceptor to use to create type proxy + + Context for current build operation. + + + + Cache for proxied type. + + + + + construct a new that + will resolve the interceptor with the given . + + The build key to use to resolve. + + + + Interceptor to use to create type proxy + + Context for current build operation. + + + + Cache for proxied type. + + + + + High-level API for performing interception on existing and new objects. + + + + + Returns a for type which wraps + the supplied . + + The type to intercept. + The instance to intercept. + The to use when creating the proxy. + The interception behaviors for the new proxy. + Any additional interfaces the proxy must implement. + A proxy for compatible with . + when is . + when is . + when is . + when is . + when cannot intercept + . + + + + Returns a for type which wraps + the supplied . + + Type to intercept. + The instance to intercept. + The to use when creating the proxy. + The interception behaviors for the new proxy. + A proxy for compatible with . + when is . + when is . + when is . + when cannot intercept + . + + + + Returns a for type which wraps + the supplied . + + The type to intercept. + The instance to intercept. + The to use when creating the proxy. + The interception behaviors for the new proxy. + Any additional interfaces the proxy must implement. + A proxy for compatible with . + when is . + when is . + when is . + when is . + when is . + when cannot intercept + . + + + + Returns a for type which wraps + the supplied . + + The type to intercept. + The instance to intercept. + The to use when creating the proxy. + The interception behaviors for the new proxy. + A proxy for compatible with . + when is . + when is . + when is . + when is . + when cannot intercept + . + + + + Creates a new instance of type that is intercepted with the behaviors in + . + + The type of the object to create. + The to use when creating the proxy. + The interception behaviors for the new proxy. + Any additional interfaces the proxy must implement. + The arguments for the creation of the new instance. + An instance of a class compatible with that includes execution of the + given . + when is . + when is . + When is . + when cannot intercept + . + + + + Creates a new instance of type that is intercepted with the behaviors in + . + + The type of the object to create. + The to use when creating the proxy. + The interception behaviors for the new proxy. + The arguments for the creation of the new instance. + An instance of a class compatible with that includes execution of the + given . + when is . + when is . + when cannot intercept + . + + + + Creates a new instance of type that is intercepted with the behaviors in + . + + The type of the object to create. + The to use when creating the proxy. + The interception behaviors for the new proxy. + Any additional interfaces the instance must implement. + The arguments for the creation of the new instance. + An instance of a class compatible with that includes execution of the + given . + when is . + when is . + when is . + when is . + when cannot intercept + . + + + + Creates a new instance of type that is intercepted with the behaviors in + . + + The type of the object to create. + The to use when creating the proxy. + The interception behaviors for the new proxy. + The arguments for the creation of the new instance. + An instance of a class compatible with that includes execution of the + given . + when is . + when is . + when is . + when cannot intercept + . + + + + Computes the array with all the additional interfaces for the interception of an object. + + The interception behaviors for the new proxy. + Any additional interfaces the instance must implement. + An array with the required interfaces for + when the interfaces are not valid. + + + + Stores information about the to be used to intercept an object and + configures a container accordingly. + + + + + + Initializes a new instance of the class with an interceptor instance. + + The to use. + when is + . + + + + Initialize a new instance of the class with a given + name and type that will be resolved to provide interception. + + Type of the interceptor + name to use to resolve. + + + + Initialize a new instance of the class with + a given type that will be resolved to provide interception. + + Type of the interceptor. + + + + Add policies to the to configure the container to use the represented + for the supplied parameters. + + Interface being registered. + Type to register. + Name used to resolve the type object. + Policy list to add policies to. + + + + Generic version of that lets you specify an interceptor + type using generic syntax. + + Type of interceptor + + + + Initialize an instance of that will + resolve the given interceptor type. + + + + + Initialize an instance of that will + resolve the given interceptor type and name. + + Name that will be used to resolve the interceptor. + + + + A simple data holder class used to store information about the current + interception operation that's being set up. Useful for creating behaviors + that need to know this stuff (especially the PIAB behavior). + + + + + Create a new instance of that + stores the given , + , and . + + that will be used to + create the intercepting type or proxy. + Type that interception was requested on. + Type of the object that will actually be intercepted. + + + + that will be used to + create the intercepting type or proxy. + + + + + Type that interception was requested on. + + + + + Type of the object that will actually be intercepted. + + + + + This interface is implemented by all proxy objects, type or instance based. + It allows for adding interception behaviors. + + + + + Adds a to the proxy. + + The to add. + + + + Base interface for type and instance based interceptor classes. + + + + + Can this interceptor generate a proxy for the given type? + + Type to check. + True if interception is possible, false if not. + + + + Returns a sequence of methods on the given type that can be + intercepted. + + Type that was specified when this interceptor + was created (typically an interface). + The concrete type of the implementing object. + Sequence of objects. + + + + Interface for interceptors that generate separate proxy + objects to implement interception on instances. + + + + + Create a proxy object that provides interception for . + + Type to generate the proxy of. + Object to create the proxy for. + Additional interfaces the proxy must implement. + The proxy object. + + + + Implementation of that returns a + pre-created interceptor. + + + + + Create a new instance of . + + Interceptor to store. + + + + Interceptor to use. + + Context for current build operation. + + + + A that intercepts objects + in the build chain by creating a proxy object. + + + + + Called during the chain of responsibility for a build operation. The + PostBuildUp method is called when the chain has finished the PreBuildUp + phase and executes in reverse order from the PreBuildUp calls. + + Context of the build operation. + + + + An instance interceptor that works by generating a + proxy class on the fly for a single interface. + + + + + Can this interceptor generate a proxy for the given type? + + Type to check. + True if interception is possible, false if not. + + + + Returns a sequence of methods on the given type that can be + intercepted. + + Type that was specified when this interceptor + was created (typically an interface). + The concrete type of the implementing object. + Sequence of objects. + + + + Create a proxy object that provides interception for . + + Type to generate the proxy of. + Object to create the proxy for. + Additional interfaces the proxy must implement. + The proxy object. + + + + A class used to generate proxy classes for doing interception on + interfaces. + + + + + Create an instance of that + can construct an intercepting proxy for the given interface. + + Type of the interface to intercept. + Additional interfaces the proxy must implement. + + + + Create the type to proxy the requested interface + + + + + + Represents the implementation of an interface method. + + + + + Used to throw an for non-implemented methods on the + additional interfaces. + + + + + This class provides the remoting-based interception mechanism. It is + invoked by a call on the corresponding TransparentProxy + object. It routes calls through the handlers as appropriate. + + + + + Creates a new instance that applies + the given policies to the given target object. + + Target object to intercept calls to. + Type to return as the type being proxied. + Additional interfaces the proxy must implement. + + + + Adds a to the proxy. + + The to add. + + + + Checks whether the proxy that represents the specified object type can be cast to the type represented by the interface. + + + + true if cast will succeed; otherwise, false. + + + The type to cast to. + The object for which to check casting. + The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. + + + + Executes a method call represented by the + parameter. The CLR will call this method when a method is called + on the TransparentProxy. This method runs the invocation through + the call handler pipeline and finally sends it down to the + target object, and then back through the pipeline. + + An object that contains the information + about the method call. + An object contains the + information about the target method's return value. + + + + Returns the target of this intercepted call. + + The target object. + + + + Gets or sets the fully qualified type name of the server object in a . + + + + The fully qualified type name of the server object in a . + + + The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. + + + + An instance interceptor that uses remoting proxies to do the + interception. + + + + + Can this interceptor generate a proxy for the given type? + + Type to check. + True if interception is possible, false if not. + + + + Returns a sequence of methods on the given type that can be + intercepted. + + The intercepted type. + The concrete type of the implementing object. + Sequence of objects. + + + + Create a proxy object that provides interception for . + + Type to generate the proxy of. + Object to create the proxy for. + Additional interfaces the proxy must implement. + The proxy object. + + + + A dumb data holder that returns the methodinfo for both an + interface method and the method that implements that interface + method. + + + + + Construct a new which holds + the given objects. + + MethodInfo for the interface method (may be null if no interface). + MethodInfo for implementing method. + + + + Determines whether the specified is equal to the current . + + + true if the specified is equal to the current ; otherwise, false. + + + The to compare with the current . + + + The parameter is null. + 2 + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + 2 + + + + Standard equals operator + + + + + standard not equal operator. + + + + + Returns a that represents the current . + + + A that represents the current . + + 2 + + + + The interface method MethodInfo. + + + + + The implementing method MethodInfo. + + + + + Interface for interceptor objects that generate + proxy types. + + + + + Create a type to proxy for the given type . + + Type to proxy. + Additional interfaces the proxy must implement. + New type that can be instantiated instead of the + original type t, and supports interception. + + + + Implementation of that returns a precreated + interceptor object. + + + + + Create a new instance of that + uses the given . + + Interceptor to use. + + + + Interceptor to use to create type proxy + + Context for current build operation. + + + + Cache for proxied type. + + + + + A that hooks up type interception. It looks for + a for the current build key, or the current + build type. If present, it substitutes types so that that proxy class gets + built up instead. On the way back, it hooks up the appropriate handlers. + + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + In this class, PreBuildUp is responsible for figuring out if the + class is proxiable, and if so, replacing it with a proxy class. + Context of the build operation. + + + + Called during the chain of responsibility for a build operation. The + PostBuildUp method is called when the chain has finished the PreBuildUp + phase and executes in reverse order from the PreBuildUp calls. + + In this class, PostBuildUp checks to see if the object was proxyable, + and if it was, wires up the handlers. + Context of the build operation. + + + + This class provides the code needed to implement the + interface on a class. + + + + + This class handles parameter type mapping. When we generate + a generic method, we need to make sure our parameter type + objects line up with the generic parameters on the generated + method, not on the one we're overriding. + + + + + A utility class that takes a set of s + and pulls out shadowed methods, only returning the ones that + are actually accessible to be overriden. + + + + + Take the list of methods and put them together into lists index by method name. + + Methods to sort through. + + + + Given a list of overloads for a method, return only those methods + that are actually visible. In other words, if there's a "new SomeType" method + somewhere, return only the new one, not the one from the base class + that's now hidden. + + Sequence of methods to process. + Sequence of returned methods. + + + + Take a semi-randomly ordered set of methods on a type and + sort them into groups by name and by parameter list. + + The list of methods. + Sequence of lists of methods, grouped by method name. + + + + Given a set of hiding overloads, return only the currently visible one. + + The set of overloads. + The most visible one. + + + + Given a method, return a value indicating how deeply in the + inheritance hierarchy the method is declared. Current type = 0, + parent = 1, grandparent = 2, etc. + + Method to check. + Declaration depth + + + + A implementation that can compare two + based on their parameter lists. + + First to compare. + Second to compare. + < 0, 0, or > 0 based on which one is "greater" than the other. + + + + Compare two parameter lists. + + First parameter list. + Second parameter list. + < 0, 0, or > 0. + + + + Compare two objects by type. + + First + First + < 0, 0, or > 0 + + + + A type based interceptor that works by generated a new class + on the fly that derives from the target class. + + + + + Can this interceptor generate a proxy for the given type? + + Type to check. + True if interception is possible, false if not. + + + + Returns a sequence of methods on the given type that can be + intercepted. + + The intercepted type. + The concrete type of the implementing object. + Sequence of objects. + + + + Create a type to proxy for the given type . + + Type to proxy. + Additional interfaces the proxy must implement. + New type that can be instantiated instead of the + original type t, and supports interception. + + + + An that returns a sequence of + instances for an intercepted object. + + + + + Get the set of object to be used for the given type and + interceptor. + + + This method will return a sequence of s. These behaviors will + only be included if their properties are true. + + Context for the current build operation. + Interceptor that will be used to invoke the behavior. + Type that interception was requested on. + Type that implements the interception. + + + + + Get the set of that can be used to resolve the + behaviors. + + + + + Key for handler pipelines. + + + + + Creates a new for the supplied method. + + The method for the key. + The new key. + + + + Compare two instances. + + Object to compare to. + True if the two keys are equal, false if not. + + + + Calculate a hash code for this instance. + + A hash code. + + + + Compare two instances for equality. + + First of the two keys to compare. + Second of the two keys to compare. + True if the values of the keys are the same, else false. + + + + Compare two instances for inequality. + + First of the two keys to compare. + Second of the two keys to compare. + false if the values of the keys are the same, else true. + + + + Compare two instances. + + Object to compare to. + True if the two keys are equal, false if not. + + + + A collection of objects, indexed + by . Returns an empty pipeline if a + MethodBase is requested that isn't in the dictionary. + + + + + Retrieve the pipeline assocated with the requested . + + The method for which the pipeline is being requested. + The handler pipeline for the given method. If no pipeline has + been set, returns a new empty pipeline. + + + + Set a new pipeline for a method. + + The method on which the pipeline should be set. + The new pipeline. + + + + Get the pipeline for the given method, creating it if necessary. + + Method to retrieve the pipeline for. + Handlers to initialize the pipeline with + True if the pipeline has any handlers in it, false if not. + + + + Attribute used to indicate that no interception should be applied to + the attribute target. + + + + + A class that reads and constructs handlers + based on on the target. + + + + + Base class for Policies that specifies which handlers apply to which methods of an object. + + + This base class always enforces the + before + passing the checks onto derived classes. This way, derived classes do not need to + worry about implementing this check. + It also means that derived classes cannot override this rule. This is considered a feature. + + + + Creates a new empty Policy. + + + + + Creates a new empty policy with the given name. + + Name of the policy. + + + + Checks if the rules in this policy match the given member info. + + MemberInfo to check against. + true if ruleset matches, false if it does not. + + + + Returns ordered collection of handlers in order that apply to the given member. + + Member that may or may not be assigned handlers by this policy. + The to use when creating handlers, + if necessary. + Collection of handlers (possibly empty) that apply to this member. + + + + Given a method on an object, return the set of MethodBases for that method, + plus any inteface methods that the member implements. + + Member to get Method Set for. + The set of methods + + + + Derived classes implement this method to calculate if the policy + will provide any handler to the specified member. + + Member to check. + true if policy applies to this member, false if not. + + + + Derived classes implement this method to supply the list of handlers for + this specific member. + + Member to get handlers for. + The to use when creating handlers, + if necessary. + Enumerable collection of handlers for this method. + + + + Gets the name of this policy. + + The name of the policy. + + + + Constructs a new instance of the . + + + + + Derived classes implement this method to calculate if the policy + will provide any handler to the specified member. + + Member to check. + true if policy applies to this member, false if not. + + + + Derived classes implement this method to supply the list of handlers for + this specific member. + + Member to get handlers for. + The to use when creating handlers, + if necessary. + Enumerable collection of handlers for this method. + + + + Base class for handler attributes used in the attribute-driven + interception policy. + + + + + Derived classes implement this method. When called, it + creates a new call handler as specified in the attribute + configuration. + + The to use when creating handlers, + if necessary. + A new call handler object. + + + + Gets or sets the order in which the handler will be executed. + + + + + The HandlerPipeline class encapsulates a list of s + and manages calling them in the proper order with the right inputs. + + + + + Creates a new with an empty pipeline. + + + + + Creates a new with the given collection + of s. + + Collection of handlers to add to the pipeline. + + + + Execute the pipeline with the given input. + + Input to the method call. + The ultimate target of the call. + Return value from the pipeline. + + + + Get the number of handlers in this pipeline. + + + + + Handlers implement this interface and are called for each + invocation of the pipelines that they're included in. + + + + + Implement this method to execute your handler processing. + + Inputs to the current call to the target. + Delegate to execute to get the next delegate in the handler + chain. + Return value from the target. + + + + Order in which the handler will be executed + + + + + This delegate type is the type that points to the next + method to execute in the current pipeline. + + Inputs to the current method call. + Delegate to get the next handler in the chain. + Return from the next method in the chain. + + + + This delegate type is passed to each handler's Invoke method. + Call the delegate to get the next delegate to call to continue + the chain. + + Next delegate in the handler chain to call. + + + + This interface is implemented by the matching rule classes. + A Matching rule is used to see if a particular policy should + be applied to a class member. + + + + + Tests to see if this rule applies to the given member. + + Member to test. + true if the rule applies, false if it doesn't. + + + + This interface is used to represent the call to a method. + An implementation of IMethodInvocation is passed to the + call handlers so that they may manipulate the call + (typically by changing the parameters) before the final target + gets called. + + + + + Factory method that creates the correct implementation of + IMethodReturn. + + Return value to be placed in the IMethodReturn object. + All arguments passed or returned as out/byref to the method. + Note that this is the entire argument list, including in parameters. + New IMethodReturn object. + + + + Factory method that creates the correct implementation of + IMethodReturn in the presence of an exception. + + Exception to be set into the returned object. + New IMethodReturn object + + + + Gets the inputs for this call. + + + + + Collection of all parameters to the call: in, out and byref. + + + + + Retrieves a dictionary that can be used to store arbitrary additional + values. This allows the user to pass values between call handlers. + + + + + The object that the call is made on. + + + + + The method on Target that we're aiming at. + + + + + This interface is used to represent the return value from a method. + An implementation of IMethodReturn is returned by call handlers, and + each handler can manipulate the parameters, return value, or add an + exception on the way out. + + + + + The collection of output parameters. If the method has no output + parameters, this is a zero-length list (never null). + + + + + Returns value from the method call. + + This value is null if the method has no return value. + + + + If the method threw an exception, the exception object is here. + + + + + Retrieves a dictionary that can be used to store arbitrary additional + values. This allows the user to pass values between call handlers. + + This is guaranteed to be the same dictionary that was used + in the IMethodInvocation object, so handlers can set context + properties in the pre-call phase and retrieve them in the after-call phase. + + + + + A Unity container extension that allows you to configure + whether an object should be intercepted and which mechanism should + be used to do it, and also provides a convenient set of methods for + configuring injection for instances. + + + + + + + + + + Initial the container with this extension's functionality. + + + + + API to configure interception for a type. + + Type to intercept. + Name type is registered under. + Interceptor to use. + This extension object. + + + + API to configure interception for a type. + + Type to intercept. + Interceptor to use. + This extension object. + + + + API to configure interception for a type. + + Type to intercept + Name type is registered under. + Interceptor object to use. + This extension object. + + + + API to configure interception for a type. + + Type to intercept + Interceptor object to use. + This extension object. + + + + API to configure interception for a type. + + Type to intercept. + Name type is registered under. + Instance interceptor to use. + This extension object. + + + + Set the interceptor for a type, regardless of what name is used to resolve the instances. + + Type to intercept + Interceptor instance. + This extension object. + + + + Set the interceptor for a type, regardless of what name is used to resolve the instances. + + Type to intercept + Interceptor instance. + This extension object. + + + + API to configure interception for a type. + + Type to intercept. + Instance interceptor to use. + This extension object. + + + + API to configure interception for a type. + + Type to intercept. + Name type is registered under. + Instance interceptor to use. + This extension object. + + + + API to configure interception for a type. + + Type to intercept. + Instance interceptor to use. + This extension object. + + + + API to configure the default interception settings for a type. + + Type the interception is being configured for. + The interceptor to use by default. + This extension object. + + + + API to configure the default interception settings for a type. + + Type the interception is being configured for. + The interceptor to use by default. + This extension object. + + + + Starts the definition of a new . + + The policy name. + + This is a convenient way for defining a new policy and the + instances and instances that are required by a policy. + + This mechanism is just a shortcut for what can be natively expressed by wiring up together objects + with repeated calls to the method. + + + + + This interface represents a list of either input or output + parameters. It implements a fixed size list, plus a couple + of other utility methods. + + + + + Gets the name of a parameter based on index. + + Index of parameter to get the name for. + Name of the requested parameter. + + + + Gets the ParameterInfo for a particular parameter by index. + + Index for this parameter. + ParameterInfo object describing the parameter. + + + + Gets the ParameterInfo for a particular parameter by name. + + Name of the parameter. + ParameterInfo object for the named parameter. + + + + Fetches a parameter's value by name. + + parameter name. + value of the named parameter. + + + + A is a matching rule that + is a collection of other matching rules. All the contained + rules much match for the set to match. + + + + + Tests the given member against the ruleset. The member matches + if all contained rules in the ruleset match against it. + + If the ruleset is empty, then Matches passes since no rules failed. + MemberInfo to test. + true if all contained rules match, false if any fail. + + + + A implementation that fails to match + if the method in question has the ApplyNoPolicies attribute on it. + + + + + Check if the matches this rule. + + This rule returns true if the member does NOT have the + on it, or a containing type doesn't have the attribute. + Member to check. + True if the rule matches, false if it doesn't. + + + + An that matches the assembly name of the + given member. + + + + + Constructs a new with the given + assembly name (or partial name). + + Assembly name to match. + + + + Constructs a new that matches + against the given assembly. + + Assembly to match. + + + + Determines if the supplied matches the rule. + + + This rule matches if the assembly containing the given + matches the name given. The rule used for matches lets you include the parts + of the assembly name in order. You can specify assembly name only, assembly and version, + assembly, version and culture, or the fully qualified assembly name. + + Member to check. + true if is in a matching assembly, false if not. + + + + An implementation of that checks to see if the + member (or type containing that member) have any s. + + + + + Checks to see if matches the rule. + + Returns true if any s are present on the method + or the type containing that method. + Member to check. + true if member matches, false if not. + + + + An implementation of that checks to see if + the member tested has an arbitrary attribute applied. + + + + + Constructs a new . + + Attribute to match. + If true, checks the base class for attributes as well. + + + + Checks to see if the given matches the rule. + + Member to check. + true if it matches, false if not. + + + + Class used for storing information about a single name/ignoreCase + pair. This class is also used as a base class for other classes that + need this pair plus some other properties. + + + + + Constructs an empty object with empty + string and ignoreCase = false. + + + + + Constructs a object that matches the given + string. IgnoreCase is false. + + The name to match. + + + + Constructs a object that matches the + given string, setting the ignoreCase flag to the given value. + + The name to match. + true to do case insensitive comparison, false to do case sensitive. + + + + Gets or sets the name to match. + + The name to match. + + + + Gets or sets whether to do case sensitive comparisons of Match. + + If false, case sensitive comparison. If true, case insensitive comparisons. + + + + A matching rule that matches when the given member name is + the same as the one supplied in the constructor. + + + + + Create a new that matches the + given member name. Wildcards are allowed. + + Name to match against. Comparison is case sensitive. + + + + Create a new that matches the + given member name. Wildcards are allowed. + + Name to match against. + If false, name comparisons are case sensitive. If true, name comparisons are case insensitive. + + + + Create a new that matches the + given member names. Wildcards are allowed. + + collections of names to match. If any of these patterns match, the rule matches. Comparisons are case sensitive. + + + + Create a new that matches the + given member names. Wildcards are allowed. + + Collections of names to match. If any of these patterns match, the rule matches. + If false, name comparisons are case sensitive. If true, name comparisons are case insensitive. + + + + Create a new that matches + one of the given member names. Wildcards are allowed. + + List of objects containing + the pattern to match and case sensitivity flag. + + + + Check if the given matches one of this + object's matching patterns. + + Member to check. + True if matches, false if not. + + + + Match methods with the given names and method signature. + + + + + Creates a new that matches methods + with the given name, with parameter types matching the given list. + + Method name to match. Wildcards are allowed. + Parameter type names to match, in order. Wildcards are allowed. + If false, name comparisons are case sensitive. If true, name comparisons are case insensitive. + + + + Create a new that matches methods + with the given name, with parameter types matching the given list. + + Name comparisons are case sensitive. + Method name to match. Wildcards are allowed. + Parameter type names to match, in order. Wildcards are allowed. + + + + Create a new that matches any method + with parameter types matching the given list. + + Name comparisons are case sensitive. + Parameter type names to match, in order. Wildcards are allowed. + + + + Create a new that matches any method + with parameter types matching the given list. + + Parameter type names to match, in order. Wildcards are allowed. + If false, name comparisons are case sensitive. If true, name comparisons are case insensitive. + + + + Check to see if the given method matches the name and signature. + + Member to check. + True if match, false if not. + + + + An that matches members in a given namespace. You can + specify either a single namespace (e.g. System.Data) or a namespace root + (e.g. System.Data.* to match types in that namespace or below. + + + + + Create a new that matches the given + namespace. + + namespace name to match. Comparison is case sensitive. + + + + Create a new that matches the given + namespace. + + namespace name to match. + If false, comparison is case sensitive. If true, comparison is case insensitive. + + + + Create a new that matches any of + the given namespace names. + + Collection of namespace names to match. + + + + Check to see if the given is in a namespace + matched by any of our given namespace names. + + member to check. + True if member is contained in a matching namespace, false if not. + + + + A helper class that encapsulates the name to match, case sensitivity flag, + and the wildcard rules for matching namespaces. + + + + + Construct a new that matches the + given namespace name. + + Namespace name to match. + If false, comparison is case sensitive. If true, comparison is case insensitive. + + + + Check if the given type is in a matching namespace. + + Type to check. + True if type is in a matching namespace, false if not. + + + + An that matches methods that have any parameters + of the given types. + + + + + Creates a new that matches if any of + the method parameters match ones in the given collection. + + Collection of that + describes the types to match. + + + + Check the given member to see if it has any matching parameters. + + Member to match. + true if member matches, false if it doesn't. + + + + The list of describing the parameter types to match. + + The collection of matches. + + + + Describes the type of parameter to match. + + + + + Input parameter + + + + + Output parameter + + + + + Input or output parameter + + + + + Method return value + + + + + A class that stores information about a single type to match. + + + + + Creates a new uninitialized . + + + + + Creates a new matching the given kind of parameter. + + of parameter to match. + + + + Creates a new matching the given parameter + type and kind. + + Parameter name to match. + of parameter to match. + + + + Creates a new matching the given parameter + type and kind. + + Parameter name to match. + If false, compare type names using case-sensitive comparison. + If true, compare type names using case-insensitive comparison. + of parameter to match. + + + + What kind of parameter to match. + + indicating which kind of parameters to match. + + + + An implementation that matches properties + by name. You can match the getter, setter, or both. + + + + + Construct a new that matches the + getter or setter of the given property. + + Name of the property. Name comparison is case sensitive. Wildcards are allowed. + + + + Constructs a new that matches the + given method of the given property. + + Name of the property. Name comparison is case sensitive. Wildcards are allowed. + Match the getter, setter, or both. + + + + Constructs a new that matches the + given method of the given property. + + Name of the property to match. Wildcards are allowed. + Match the getter, setter, or both. + If false, name comparison is case sensitive. If true, name comparison is case insensitive. + + + + Constructs a new that matches any of the + given properties. + + Collection of defining which + properties to match. + + + + Checks if the given member matches the rule. + + Member to check. + True if it matches, false if it does not. + + + + Specifies which methods of a property should be matches by + the . + + + + + Match the property getter method. + + + + + Match the property setter method. + + + + + Match either the getter or setter method. + + + + + Information about a property match. + + + + + Construct a new that matches the get or set methods + of the given property name, and does a case-sensitive comparison. + + Property name to match. + + + + Constructs a new that matches the given methods of + the given property name, doing a case-sensitive comparison. + + Property name to match. + specifying which methods of the property to match. + + + + Construt a new that matches the given methods of + the given property name. + + Property name to match. + specifying which methods of the property to match. + If false, name comparison is case sensitive. If true, name comparison is case insensitive. + + + + The to use when doing name comparisons on this property. + + Specifies which methods of the property to match. + + + + An that checks to see if a member has a specified + type. + + + + + Construct a new that matches + members with the given return type. + + Type to look for. + + + + Construct a new that matches + the given return type by name. + + See the class for details on how + type name matches are done. + Type name to match. Name comparisons are case sensitive. + + + + Construct a new that matches + the given return type by name. + + See the class for details on how + type name matches are done. + Type name to match. + If false, name comparison is case sensitive. If true, comparison + is case insensitive. + + + + Check to see if the given member has a matching return type. + + Member to check. + true if return types match, false if they don't. + + + + A that checks a member for the presence + of the on the method, property, or class, and + that the given string matches. + + + + + Constructs a new , looking for + the given string. The comparison is case sensitive. + + tag string to match. + + + + Constructs a new , looking for + the given string. The comparison is case sensitive if is + false, case insensitive if is true. + + tag string to match. + if false, case-senstive comparison. If true, case-insensitive comparison. + + + + Check the given member for the presence of the and + match the strings. + + Member to check. + True if tag strings match, false if they don't. + + + + A matching rule that matches when the member is declared + in the given type. + + + + + Constructs a new that matches the + given type. + + The type to match. + + + + Constructs a new that matches types + with the given name. + + Comparisons are case sensitive. + Type name to match. + + + + Constructs a new that matches types + with the given name, using the given case sensitivity. + + Type name to match. + if false, do case-sensitive comparison. If true, do case-insensitive. + + + + Constructs a new that will match + any of the type names given in the collection of match information. + + The match information to match. + + + + Checks if the given member matches any of this object's matches. + + Member to match. + True if match, false if not. + + + + Checks if the given type matches any of this object's matches. + + Matches may be on the namespace-qualified type name or just the type name. + Type to check. + True if it matches, false if it doesn't. + + + + An implementation of that wraps a provided array + containing the argument values. + + + + + Construct a new that wraps the + given array of arguments. + + Complete collection of arguments. + Type information about about each parameter. + A that indicates + whether a particular parameter is part of the collection. Used to filter out only input + parameters, for example. + + + + Gets the ParameterInfo for a particular parameter by index. + + Index for this parameter. + ParameterInfo object describing the parameter. + + + + Gets the for the given named parameter. + + Name of parameter. + for the requested parameter. + + + + Gets the name of a parameter based on index. + + Index of parameter to get the name for. + Name of the requested parameter. + + + + Adds to the collection. This is a read only collection, so this method + always throws . + + Object to add. + Nothing, always throws. + Always throws this. + + + + Checks to see if the collection contains the given object. + + Tests for the object using object.Equals. + Object to find. + true if object is in collection, false if it is not. + + + + Remove all items in the collection. This collection is fixed-size, so this + method always throws . + + This is always thrown. + + + + Returns the index of the given object, or -1 if not found. + + Object to find. + zero-based index of found object, or -1 if not found. + + + + Inserts a new item. This is a fixed-size collection, so this method throws . + + Index to insert at. + Always throws. + Always throws this. + + + + Removes the given item. This is a fixed-size collection, so this method throws . + + Always throws. + Always throws this. + + + + Removes the given item. This is a fixed-size collection, so this method throws . + + Always throws. + Always throws this. + + + + Copies the contents of this collection to the given array. + + Destination array. + index to start copying from. + + + + Gets an enumerator object to support the foreach construct. + + Enumerator object. + + + + Fetches a parameter's value by name. + + parameter name. + value of the named parameter. + + + + Gets the value of a parameter based on index. + + Index of parameter to get the value for. + Value of the requested parameter. + + + + Is this collection read only? + + No, it is not read only, the contents can change. + + + + Is this collection fixed size? + + Yes, it is. + + + + Total number of items in the collection. + + The count. + + + + Gets a synchronized version of this collection. WARNING: Not implemented completely, + DO NOT USE THIS METHOD. + + + + + Is the object synchronized for thread safety? + + No, it isn't. + + + + An internal struct that maps the index in the arguments collection to the + corresponding about that argument. + + + + + Construct a new object linking the + given index and object. + + Index into arguments array (zero-based). + for the argument at . + + + + Transient class that supports convenience method for specifying interception policies. + + + + + Adds a reference to matching rule by name. + + The name for the matching rule. + + The than allows further configuration of the policy. + + + The details of how the rule should be created by the container must be specified using a + standard injection specification mechanism. + + + + + Makes a matching rule in the current policy. + + The new for the policy. + + The than allows further configuration of the policy. + + + + + Configures injection for a new and makes it available + as a matching rule in the current policy. + + The type for the new matching rule. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new and makes it available + as a matching rule in the current policy, using the given . + + The type for the new matching rule. + The that controls the lifetime + of the configured matching rule. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new using the specified name + and makes it available as a matching rule in the current policy. + + The type for the new matching rule. + The name for the injection configuration for the matching rule. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new and makes it available + as a matching rule in the current policy, using the given . + + The type for the new matching rule. + The name for the injection configuration for the matching rule. + The that controls the lifetime + of the configured matching rule. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new and makes it available + as a matching rule in the current policy. + + The type for the new matching rule. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new and makes it available + as a matching rule in the current policy, using the given . + + The type for the new matching rule. + The that controls the lifetime + of the configured matching rule. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new using the specified name + and makes it available as a matching rule in the current policy. + + The type for the new matching rule. + The name for the injection configuration for the matching rule. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new using the specified name + and makes it available as a matching rule in the current policy, + using the given . + + The type for the new matching rule. + The name for the injection configuration for the matching rule. + The that controls the lifetime + of the configured matching rule. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Adds a reference to call handler by name. + + The name for the call handler. + + The than allows further configuration of the policy. + + + The details of how the handler should be created by the container must be specified using a + standard injection specification mechanism. + + + + + Makes a call handler in the current policy. + + The new for the policy. + + The than allows further configuration of the policy. + + + + + Configures injection for a new and makes it available + as a call handler in the current policy. + + The type for the new call handler. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new and makes it available + as a call handler in the current policy, using the given . + + The type for the new call handler. + The that controls the lifetime + of the configured call handler. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new using the specified name + and makes it available as a call handler in the current policy. + + The type for the new call handler. + The name for the injection configuration for the call handler. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new using the specified name + and makes it available as a call handler in the current policy, + using the given . + + The type for the new call handler. + The name for the injection configuration for the call handler. + The that controls the lifetime + of the configured call handler. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new and makes it available + as a call handler in the current policy. + + The type for the new call handler. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new and makes it available + as a call handler in the current policy, using the given . + + The type for the new call handler. + The that controls the lifetime + of the configured call handler. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new using the specified name + and makes it available as a call handler in the current policy. + + The type for the new call handler. + The name for the injection configuration for the call handler . + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + Configures injection for a new using the specified name + and makes it available as a call handler in the current policy, + using the given . + + The type for the new call handler. + The name for the injection configuration for the call handler . + The that controls the lifetime + of the configured call handler. + Objects containing the details on which members to inject and how. + + The than allows further configuration of the policy. + + + + + The that is currently being + configured. + + + + + The extension to which the policy was added. + + + Use this property to start adding a new policy. + + + + + A collection of Policy objects. The policies within a PolicySet combine using + an "or" operation. + + + + + Creates a new containing the given policies. + + Policies to put into the policy set. + + + + Gets the policies that apply to the given member. + + Member to get policies for. + Collection of policies that apply to this member. + + + + Gets the policies in the that do not + apply to the given member. + + Member to check. + Collection of policies that do not apply to . + + + + Gets the handlers that apply to the given member based on all policies in the . + + Member to get handlers for. + The to use when creating handlers, + if necessary. + Collection of call handlers for . + + + + Interceptor that performs policy injection. + + + + + Interception behaviors implement this interface and are called for each + invocation of the pipelines that they're included in. + + + + + Implement this method to execute your behavior processing. + + Inputs to the current call to the target. + Delegate to execute to get the next delegate in the behavior chain. + Return value from the target. + + + + Returns the interfaces required by the behavior for the objects it intercepts. + + The required interfaces. + + + + Returns a flag indicating if this behavior will actually do anything when invoked. + + This is used to optimize interception. If the behaviors won't actually + do anything (for example, PIAB where no policies match) then the interception + mechanism can be skipped completely. + + + + Initializes a new instance of the with a pipeline manager. + + The for the new instance. + + + + Initializes a new instance of the with the given information + about what's being intercepted and the current set of injection policies. + + Information about what will be injected. + Current injection policies. + Unity container that can be used to resolve call handlers. + + + + Applies the policy injection handlers configured for the invoked method. + + Inputs to the current call to the target. + Delegate to execute to get the next delegate in the handler + chain. + Return value from the target. + + + + Returns the interfaces required by the behavior for the objects it intercepts. + + An empty array of interfaces. + + + + Returns a flag indicating if this behavior will actually do anything when invoked. + + This is used to optimize interception. If the behaviors won't actually + do anything (for example, PIAB where no policies match) then the interception + mechanism can be skipped completely. + + + + 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 Intercepted abstract method was invoked.. + + + + + Looks up a localized string similar to Additional interfaces do not have an implementation.. + + + + + Looks up a localized string similar to The additional interfaces supplied are invalid: {0}. + + + + + Looks up a localized string similar to Type must be a subclass of System.Attribute.. + + + + + Looks up a localized string similar to Could not create instance of type {0} with no constructor arguments.. + + + + + Looks up a localized string similar to Collection contains a null element.. + + + + + Looks up a localized string similar to The collection of interfaces is null.. + + + + + Looks up a localized string similar to The required interfaces for behavior {1} are invalid: {0}. + + + + + Looks up a localized string similar to The type {0} is not an interface.. + + + + + Looks up a localized string similar to Null type.. + + + + + Looks up a localized string similar to The type {0} is an open generic.. + + + + + Looks up a localized string similar to The type {0} is not interceptable.. + + + + + Looks up a localized string similar to Could not find the implementation of interface method {0}.{1} in type {2}. + + + + + Looks up a localized string similar to Null is not permitted as an interception behavior.. + + + + + A class that wraps the inputs of a into the + interface. + + + + + Constructs a new that wraps the + given method call and arguments. + + The call message. + The arguments. + + + + An implementation of that wraps the + remoting-based in the PIAB call + interface. + + + + + Creates a new implementation that wraps + the given , with the given ultimate + target object. + + Remoting call message object. + Ultimate target of the method call. + + + + Factory method that creates the correct implementation of + IMethodReturn. + + In this implementation we create an instance of . + Return value to be placed in the IMethodReturn object. + All arguments passed or returned as out/byref to the method. + Note that this is the entire argument list, including in parameters. + New IMethodReturn object. + + + + Factory method that creates the correct implementation of + IMethodReturn in the presence of an exception. + + Exception to be set into the returned object. + New IMethodReturn object + + + + Gets the inputs for this call. + + The input collection. + + + + Collection of all parameters to the call: in, out and byref. + + The arguments collection. + + + + Retrieves a dictionary that can be used to store arbitrary additional + values. This allows the user to pass values between call handlers. + + The invocation context dictionary. + + + + The object that the call is made on. + + The target object. + + + + The method on Target that we're aiming at. + + The target method base. + + + + Gets the collection of arguments being passed to the target. + + This method exists becuase the underlying remoting call message + does not let handlers change the arguments. + Array containing the arguments to the target. + + + + An implementation of that wraps the + remoting call and return messages. + + + + + Creates a new object that contains a + return value. + + The original call message that invoked the method. + Return value from the method. + Collections of arguments passed to the method (including the new + values of any out params). + Invocation context dictionary passed into the call. + + + + Creates a new object that contains an + exception thrown by the target. + + Exception that was thrown. + The original call message that invoked the method. + Invocation context dictionary passed into the call. + + + + Constructs a for the remoting + infrastructure based on the contents of this object. + + The instance. + + + + The collection of output parameters. If the method has no output + parameters, this is a zero-length list (never null). + + The output parameter collection. + + + + Return value from the method call. + + This value is null if the method has no return value. + The return value. + + + + If the method threw an exception, the exception object is here. + + The exception, or null if no exception was thrown. + + + + Retrieves a dictionary that can be used to store arbitrary additional + values. This allows the user to pass values between call handlers. + + This is guaranteed to be the same dictionary that was used + in the IMethodInvocation object, so handlers can set context + properties in the pre-call phase and retrieve them in the after-call phase. + + The invocation context dictionary. + + + + A class that wraps the outputs of a into the + interface. + + + + + Constructs a new that wraps the + given method call and arguments. + + The call message. + The arguments. + + + + A policy is a combination of a matching rule set and a set of handlers. + If the policy applies to a member, then the handlers will be enabled for + that member. + + + + + Creates a new object with a set of matching rules + and the names to use when resolving handlers. + + + + + Creates a new object with a name, a set of matching rules + and the names to use when resolving handlers. + + + + + Checks if the rules in this policy match the given member info. + + MemberInfo to check against. + true if ruleset matches, false if it does not. + + + + Return ordered collection of handlers in order that apply to the given member. + + Member that may or may not be assigned handlers by this policy. + The to use when creating handlers, + if necessary. + Collection of handlers (possibly empty) that apply to this member. + + + + A simple attribute used to "tag" classes, methods, or properties with a + string that can later be matched via the . + + + + + Creates a new with the given string. + + The tag string. + + + + The string tag for this attribute. + + the tag. + + + + Stores information about a single to be used on an intercepted object and + configures a container accordingly. + + + + + + Initializes a new instance of the with a + . + + The interception behavior to use. + + + + Initializes a new instance of the with a + given type/name pair. + + Type of behavior to + + + + + Initializes a new instance of the with a + given behavior type. + + Type of behavior to + + + + Get the list of behaviors for the current type so that it can be added to. + + Policy list. + Implementation type to set behaviors for. + Name type is registered under. + An instance of . + + + + A generic version of that lets you + specify behavior types using generic syntax. + + Type of behavior to register. + + + + Initializes a new instance of the with a + given behavior type. + + + + + Initializes a new instance of the with a + given type/name pair. + + Name to use to resolve the behavior. + + + + An that accumulates a sequence of + instances for an intercepted object. + + + + + Get the set of object to be used for the given type and + interceptor. + + + This method will return a sequence of s. These behaviors will + only be included if their properties are true. + + Context for the current build operation. + Interceptor that will be used to invoke the behavior. + Type that interception was requested on. + Type that implements the interception. + + + + + Get the set of that can be used to resolve the + behaviors. + + + + + The InterceptionBehaviorPipeline class encapsulates a list of s + and manages calling them in the proper order with the right inputs. + + + + + Creates a new with an empty pipeline. + + + + + Creates a new with the given collection + of s. + + Collection of interception behaviors to add to the pipeline. + + + + Execute the pipeline with the given input. + + Input to the method call. + The ultimate target of the call. + Return value from the pipeline. + + + + Adds a to the pipeline. + + The interception behavior to add. + + + + Get the number of interceptors in this pipeline. + + + + + This delegate type is the type that points to the next + method to execute in the current pipeline. + + Inputs to the current method call. + Delegate to get the next interceptor in the chain. + Return from the next method in the chain. + + + + This delegate type is passed to each interceptor's Invoke method. + Call the delegate to get the next delegate to call to continue + the chain. + + Next delegate in the interceptor chain to call. + + + + A "glob" is a string matching pattern. It is similar to the + matches available in the file system (*.cs, for example). The Glob + class implements this string matching. + + Glob supports the following metacharacters: + * - match zero or more characters + ? - match any one character + [abc] - match one character if it's in the characters inside the brackets. + All other characters in the glob are literals. + + + + + Constructs a new instance that matches the given pattern. + + + The pattern match is case sensitive by default. + + Pattern to use. See summary for + details of the pattern. + + + + Constructs a new instance that matches the given pattern. + + The pattern to use. See summary for + details of the patterns supported. + If true, perform a case sensitive match. + If false, perform a case insensitive comparison. + + + + Checks to see if the given string matches the pattern. + + String to check. + True if it matches, false if it doesn't. + + + + A collection of utility functions to encapsulate details of + reflection and finding attributes. + + + + + Given a MethodBase for a property's get or set method, + return the corresponding property info. + + MethodBase for the property's get or set method. + PropertyInfo for the property, or null if method is not part of a property. + + + + Given a MethodInfo for a property's get or set method, + return the corresponding property info. + + MethodBase for the property's get or set method. + PropertyInfo for the property, or null if method is not part of a property. + + + + Given a particular MemberInfo, return the custom attributes of the + given type on that member. + + Type of attribute to retrieve. + The member to look at. + True to include attributes inherited from base classes. + Array of found attributes. + + + + Given a particular MemberInfo, find all the attributes that apply to this + member. Specifically, it returns the attributes on the type, then (if it's a + property accessor) on the property, then on the member itself. + + Type of attribute to retrieve. + The member to look at. + true to include attributes inherited from base classes. + Array of found attributes. + + + + A small implementation of that returns the + given object. + + + + + Create a new instance. + + Information about which constructor to select. + + + + Choose the constructor to call for the given type. + + Current build context + The to add any + generated resolver objects into. + The chosen constructor. + + + + MethodInfo objects for the methods we need to generate + calls to on IMethodInvocation. + + + + + Class that handles generating the dynamic types used for interception. + + + + + Create a new that will generate a + wrapper class for the requested . + + Type to generate the wrapper for. + Additional interfaces the proxy must implement. + + + + Create the wrapper class for the given type. + + Wrapper type. + + + + Represents the implementation of a method override. + + + + + Used to throw an for overrides on abstract methods. + + + + + Implementation of used + by the virtual method interceptor. + + + + + Construct a new instance for the + given target object and method, passing the + to the target method. + + Object that is target of this invocation. + Method on to call. + Values for the parameters. + + + + Factory method that creates the correct implementation of + IMethodReturn. + + Return value to be placed in the IMethodReturn object. + All arguments passed or returned as out/byref to the method. + Note that this is the entire argument list, including in parameters. + New IMethodReturn object. + + + + Factory method that creates the correct implementation of + IMethodReturn in the presence of an exception. + + Exception to be set into the returned object. + New IMethodReturn object + + + + Gets the inputs for this call. + + + + + Collection of all parameters to the call: in, out and byref. + + + + + Retrieves a dictionary that can be used to store arbitrary additional + values. This allows the user to pass values between call handlers. + + + + + The object that the call is made on. + + + + + The method on Target that we're aiming at. + + + + + An implementation of used by + the virtual method interception mechanism. + + + + + Construct a instance that returns + a value. + + The method invocation. + Return value (should be null if method returns void). + All arguments (including current values) passed to the method. + + + + Construct a instance for when the target method throws an exception. + + The method invocation. + Exception that was thrown. + + + + The collection of output parameters. If the method has no output + parameters, this is a zero-length list (never null). + + + + + Returns value from the method call. + + This value is null if the method has no return value. + + + + If the method threw an exception, the exception object is here. + + + + + Retrieves a dictionary that can be used to store arbitrary additional + values. This allows the user to pass values between call handlers. + + This is guaranteed to be the same dictionary that was used + in the IMethodInvocation object, so handlers can set context + properties in the pre-call phase and retrieve them in the after-call phase. + + + + diff --git a/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.dll b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.dll new file mode 100644 index 000000000..84f1870df Binary files /dev/null and b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.dll differ diff --git a/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.xml b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.xml new file mode 100644 index 000000000..3e46f33e1 --- /dev/null +++ b/packages/Unity.2.0/lib/20/Microsoft.Practices.Unity.xml @@ -0,0 +1,5910 @@ + + + + Microsoft.Practices.Unity + + + + + Base class for attributes that can be placed on parameters + or properties to specify how to resolve the value for + that parameter or property. + + + + + Create an instance of that + will be used to get the value for the member this attribute is + applied to. + + Type of parameter or property that + this attribute is decoration. + The resolver object. + + + + This attribute is used to indicate which constructor to choose when + the container attempts to build a type. + + + + + This attribute is used to mark methods that should be called when + the container is building an object. + + + + + This attribute is used to mark properties and parameters as targets for injection. + + + For properties, this attribute is necessary for injection to happen. For parameters, + it's not needed unless you want to specify additional information to control how + the parameter is resolved. + + + + + Create an instance of with no name. + + + + + Create an instance of with the given name. + + Name to use when resolving this dependency. + + + + Create an instance of that + will be used to get the value for the member this attribute is + applied to. + + Type of parameter or property that + this attribute is decoration. + The resolver object. + + + + The name specified in the constructor. + + + + + An used to mark a dependency + as optional - the container will try to resolve it, and return null + if the resolution fails rather than throw. + + + + + Construct a new object. + + + + + Construct a new object that + specifies a named dependency. + + Name of the dependency. + + + + Create an instance of that + will be used to get the value for the member this attribute is + applied to. + + Type of parameter or property that + this attribute is decoration. + The resolver object. + + + + Name of the dependency. + + + + + A that composites other + ResolverOverride objects. The GetResolver operation then + returns the resolver from the first child override that + matches the current context and request. + + + + + Base class for all override objects passed in the + method. + + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + Wrap this resolver in one that verifies the type of the object being built. + This allows you to narrow any override down to a specific type easily. + + Type to constrain the override to. + The new override. + + + + Wrap this resolver in one that verifies the type of the object being built. + This allows you to narrow any override down to a specific type easily. + + Type to constrain the override to. + The new override. + + + + Add a new to the collection + that is checked. + + item to add. + + + + Add a setof s to the collection. + + items to add. + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + 2 + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + 1 + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + Class that returns information about the types registered in a container. + + + + + The type that was passed to the method + as the "from" type, or the only type if type mapping wasn't done. + + + + + The type that this registration is mapped to. If no type mapping was done, the + property and this one will have the same value. + + + + + Name the type was registered under. Null for default registration. + + + + + The registered lifetime manager instance. + + + + + The lifetime manager for this registration. + + + This property will be null if this registration is for an open generic. + + + + A class that overrides + the value injected whenever there is a dependency of the + given type, regardless of where it appears in the object graph. + + + + + Create an instance of to override + the given type with the given value. + + Type of the dependency. + Value to use. + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + A convenience version of that lets you + specify the dependency type using generic syntax. + + Type of the dependency to override. + + + + Construct a new object that will + override the given dependency, and pass the given value. + + + + + A convenience form of that lets you + specify multiple parameter overrides in one shot rather than having + to construct multiple objects. + + + This class isn't really a collection, it just implements IEnumerable + so that we get use of the nice C# collection initializer syntax. + + + + + Base helper class for creating collections of objects + for use in passing a bunch of them to the resolve call. This base class provides + the mechanics needed to allow you to use the C# collection initializer syntax. + + Concrete type of the this class collects. + Key used to create the underlying override object. + Value that the override returns. + + + + Add a new override to the collection with the given key and value. + + Key - for example, a parameter or property name. + Value - the value to be returned by the override. + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + 2 + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + 1 + + + + When implemented in derived classes, this method is called from the + method to create the actual objects. + + Key value to create the resolver. + Value to store in the resolver. + The created . + + + + When implemented in derived classes, this method is called from the + method to create the actual objects. + + Key value to create the resolver. + Value to store in the resolver. + The created . + + + + Event argument class for the event. + + + + + Construct a new object with the + given child container object. + + An for the newly created child + container. + + + + The newly created child container. + + + + + An extension context for the created child container. + + + + + Base class for subclasses that let you specify that + an instance of a generic type parameter should be resolved. + + + + + Base type for objects that are used to configure parameters for + constructor or method injection, or for getting the value to + be injected into a property. + + + + + Test to see if this parameter value has a matching type for the given type. + + Type to check. + True if this parameter value is compatible with type , + false if not. + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + Convert the given set of arbitrary values to a sequence of InjectionParameterValue + objects. The rules are: If it's already an InjectionParameterValue, return it. If + it's a Type, return a ResolvedParameter object for that type. Otherwise return + an InjectionParameter object for that value. + + The values to build the sequence from. + The resulting converted sequence. + + + + Convert an arbitrary value to an InjectionParameterValue object. The rules are: + If it's already an InjectionParameterValue, return it. If it's a Type, return a + ResolvedParameter object for that type. Otherwise return an InjectionParameter + object for that value. + + The value to convert. + The resulting . + + + + Name for the type represented by this . + This may be an actual type name or a generic argument name. + + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + name to use when looking up in the container. + + + + Test to see if this parameter value has a matching type for the given type. + + Type to check. + True if this parameter value is compatible with type , + false if not. + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + Return a instance that will + return this types value for the parameter. + + The actual type to resolve. + The resolution key. + The . + + + + Name for the type represented by this . + This may be an actual type name or a generic argument name. + + + + + A that lets you specify that + an instance of a generic type parameter should be resolved, providing the + value if resolving fails. + + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + name to use when looking up in the container. + + + + Return a instance that will + return this types value for the parameter. + + The actual type to resolve. + The resolution key. + The . + + + + A class that lets you specify a factory method the container + will use to create the object. + + This is a significantly easier way to do the same + thing the old static factory extension was used for. + + + + Base class for objects that can be used to configure what + class members get injected by the container. + + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Type to register. + Policy list to add policies to. + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Type of interface being registered. If no interface, + this will be null. + Type of concrete type being registered. + Name used to resolve the type object. + Policy list to add policies to. + + + + Create a new instance of with + the given factory function. + + Factory function. + + + + Create a new instance of with + the given factory function. + + Factory function. + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Type of interface being registered. If no interface, + this will be null. This parameter is ignored in this implementation. + Type of concrete type being registered. + Name used to resolve the type object. + Policy list to add policies to. + + + + A that can be passed to + to configure a + parameter or property as an optional dependency. + + + + + A base class for implementing classes + that deal in explicit types. + + + + + Create a new that exposes + information about the given . + + Type of the parameter. + + + + Test to see if this parameter value has a matching type for the given type. + + Type to check. + True if this parameter value is compatible with type , + false if not. + + + + The type of parameter this object represents. + + + + + Name for the type represented by this . + This may be an actual type name or a generic argument name. + + + + + Construct a new object that + specifies the given . + + Type of the dependency. + + + + Construct a new object that + specifies the given and . + + Type of the dependency. + Name for the dependency. + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + A generic version of that lets you + specify the type of the dependency using generics syntax. + + Type of the dependency. + + + + Construct a new . + + + + + Construct a new with the given + . + + Name of the dependency. + + + + A special lifetime manager which works like , + except that in the presence of child containers, each child gets it's own instance + of the object, instead of sharing one in the common parent. + + + + + A that holds onto the instance given to it. + When the is disposed, + the instance is disposed with it. + + + + + Base class for Lifetime managers which need to synchronize calls to + . + + + + The purpose of this class is to provide a basic implementation of the lifetime manager synchronization pattern. + + + Calls to the method of a + instance acquire a lock, and if the instance has not been initialized with a value yet the lock will only be released + when such an initialization takes place by calling the method or if + the build request which resulted in the call to the GetValue method fails. + + + + + + + Base class for Lifetime managers - classes that control how + and when instances are created by the Unity container. + + + + + A that controls how instances are + persisted and recovered from an external store. Used to implement + things like singletons and per-http-request lifetime. + + + + + Represents a builder policy interface. Since there are no fixed requirements + for policies, it acts as a marker interface from which to derive all other + policy interfaces. + + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + + + + Stores the given value into backing store for retrieval later. + + The object to store. + + + + Remove the value this lifetime policy is managing from backing store. + + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + + + + Stores the given value into backing store for retrieval later. + + The object being stored. + + + + Remove the given object from backing store. + + + + + This interface provides a hook for the builder context to + implement error recovery when a builder strategy throws + an exception. Since we can't get try/finally blocks onto + the call stack for later stages in the chain, we instead + add these objects to the context. If there's an exception, + all the current IRequiresRecovery instances will have + their Recover methods called. + + + + + A method that does whatever is needed to clean up + as part of cleaning up after an exception. + + + Don't do anything that could throw in this method, + it will cause later recover operations to get skipped + and play real havoc with the stack trace. + + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + Calls to this method acquire a lock which is released only if a non-null value + has been set for the lifetime manager. + + + + Performs the actual retrieval of a value from the backing store associated + with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + This method is invoked by + after it has acquired its lock. + + + + Stores the given value into backing store for retrieval later. + + The object being stored. + Setting a value will attempt to release the lock acquired by + . + + + + Performs the actual storage of the given value into backing store for retrieval later. + + The object being stored. + This method is invoked by + before releasing its lock. + + + + Remove the given object from backing store. + + + + + A method that does whatever is needed to clean up + as part of cleaning up after an exception. + + + Don't do anything that could throw in this method, + it will cause later recover operations to get skipped + and play real havoc with the stack trace. + + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + + + + Stores the given value into backing store for retrieval later. + + The object being stored. + + + + Remove the given object from backing store. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + 2 + + + + Standard Dispose pattern implementation. Not needed, but it keeps FxCop happy. + + Always true, since we don't have a finalizer. + + + + This is a custom lifetime manager that acts like , + but also provides a signal to the default build plan, marking the type so that + instances are reused across the build up object graph. + + + + + Construct a new object that does not + itself manage an instance. + + + + + Construct a new object that stores the + give value. This value will be returned by + but is not stored in the lifetime manager, nor is the value disposed. + This Lifetime manager is intended only for internal use, which is why the + normal method is not used here. + + Value to store. + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + + + + Stores the given value into backing store for retrieval later. In this class, + this is a noop, since it has special hooks down in the guts. + + The object being stored. + + + + Remove the given object from backing store. Noop in this class. + + + + + A strategy that handles Hierarchical lifetimes across a set of parent/child + containers. + + + + + Represents a strategy in the chain of responsibility. + Strategies are required to support both BuildUp and TearDown. + + + + + Represents a strategy in the chain of responsibility. + Strategies are required to support both BuildUp and TearDown. Although you + can implement this interface directly, you may also choose to use + as the base class for your strategies, as + this class provides useful helper methods and makes support BuildUp and TearDown + optional. + + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + Context of the build operation. + + + + Called during the chain of responsibility for a build operation. The + PostBuildUp method is called when the chain has finished the PreBuildUp + phase and executes in reverse order from the PreBuildUp calls. + + Context of the build operation. + + + + Called during the chain of responsibility for a teardown operation. The + PreTearDown method is called when the chain is being executed in the + forward direction. + + Context of the teardown operation. + + + + Called during the chain of responsibility for a teardown operation. The + PostTearDown method is called when the chain has finished the PreTearDown + phase and executes in reverse order from the PreTearDown calls. + + Context of the teardown operation. + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + Context of the build operation. + + + + Called during the chain of responsibility for a build operation. The + PostBuildUp method is called when the chain has finished the PreBuildUp + phase and executes in reverse order from the PreBuildUp calls. + + Context of the build operation. + + + + Called during the chain of responsibility for a teardown operation. The + PreTearDown method is called when the chain is being executed in the + forward direction. + + Context of the teardown operation. + + + + Called during the chain of responsibility for a teardown operation. The + PostTearDown method is called when the chain has finished the PreTearDown + phase and executes in reverse order from the PreTearDown calls. + + Context of the teardown operation. + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + Context of the build operation. + + + + A that will attempt to + resolve a value, and return null if it cannot rather than throwing. + + + + + A that is used at build plan execution time + to resolve a dependent value. + + + + + Get the value for a dependency. + + Current build context. + The value for the dependency. + + + + Construct a new object + that will attempt to resolve the given name and type from the container. + + Type to resolve. Must be a reference type. + Name to resolve with. + + + + Construct a new object + that will attempt to resolve the given type from the container. + + Type to resolve. Must be a reference type. + + + + Get the value for a dependency. + + Current build context. + The value for the dependency. + + + + Type this resolver will resolve. + + + + + Name this resolver will resolve. + + + + + Extension methods on to provide convenience + overloads (generic versions, mostly). + + + + + Removes an individual policy type for a build key. + + The type the policy was registered as. + to remove the policy from. + The key the policy applies. + + + + Removes a default policy. + + The type the policy was registered as. + to remove the policy from. + + + + Gets an individual policy. + + The interface the policy is registered under. + to search. + The key the policy applies. + The policy in the list, if present; returns null otherwise. + + + + Gets an individual policy. + + The interface the policy is registered under. + to search. + The key the policy applies. + The policy list that actually contains the returned policy. + The policy in the list, if present; returns null otherwise. + + + + Gets an individual policy. + + to search. + The interface the policy is registered under. + The key the policy applies. + The policy in the list, if present; returns null otherwise. + + + + Gets an individual policy. + + to search. + The interface the policy is registered under. + The key the policy applies. + The policy list that actually contains the returned policy. + The policy in the list, if present; returns null otherwise. + + + + Gets an individual policy. + + The interface the policy is registered under. + to search. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy in the list, if present; returns null otherwise. + + + + Gets an individual policy. + + The interface the policy is registered under. + to search. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy list that actually contains the returned policy. + The policy in the list, if present; returns null otherwise. + + + + Gets an individual policy. + + to search. + The interface the policy is registered under. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy in the list, if present; returns null otherwise. + + + + Get the non default policy. + + The interface the policy is registered under. + to search. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy in the list, if present; returns null otherwise. + + + + Get the non default policy. + + The interface the policy is registered under. + to search. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy list that actually contains the returned policy. + The policy in the list, if present; returns null otherwise. + + + + Get the non default policy. + + to search. + The interface the policy is registered under. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy in the list, if present; returns null otherwise. + + + + Sets an individual policy. + + The interface the policy is registered under. + to add the policy to. + The policy to be registered. + The key the policy applies. + + + + Sets a default policy. When checking for a policy, if no specific individual policy + is available, the default will be used. + + The interface to register the policy under. + to add the policy to. + The default policy to be registered. + + + + Base class for the current operation stored in the build context. + + + + + Create a new . + + Type currently being built. + + + + The type that's currently being built. + + + + + Build plan for that will + return a func that will resolve the requested type + through this container later. + + + + + A build plan is an object that, when invoked, will create a new object + or fill in a given existing one. It encapsulates all the information + gathered by the strategies to construct a particular object. + + + + + Creates an instance of this build plan's type, or fills + in the existing type if passed in. + + Context used to build up the object. + + + + Creates an instance of this build plan's type, or fills + in the existing type if passed in. + + Context used to build up the object. + + + + The almost inevitable collection of extra helper methods on + to augment the rich set of what + Linq already gives us. + + + + + Execute the provided on every item in . + + Type of the items stored in + Sequence of items to process. + Code to run over each item. + + + + Create a single string from a sequenc of items, separated by the provided , + and with the conversion to string done by the given . + + This method does basically the same thing as , + but will work on any sequence of items, not just arrays. + Type of items in the sequence. + Sequence of items to convert. + Separator to place between the items in the string. + The conversion function to change TItem -> string. + The resulting string. + + + + Create a single string from a sequenc of items, separated by the provided , + and with the conversion to string done by the item's method. + + This method does basically the same thing as , + but will work on any sequence of items, not just arrays. + Type of items in the sequence. + Sequence of items to convert. + Separator to place between the items in the string. + The resulting string. + + + + A class that lets you + override a named parameter passed to a constructor. + + + + + Construct a new object that will + override the given named constructor parameter, and pass the given + value. + + Name of the constructor parameter. + Value to pass for the constructor. + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + A convenience form of that lets you + specify multiple parameter overrides in one shot rather than having + to construct multiple objects. + + + + + When implemented in derived classes, this method is called from the + method to create the actual objects. + + Key value to create the resolver. + Value to store in the resolver. + The created . + + + + A that lets you override + the value for a specified property. + + + + + Create an instance of . + + The property name. + Value to use for the property. + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + A convenience form of that lets you + specify multiple property overrides in one shot rather than having + to construct multiple objects. + + + + + When implemented in derived classes, this method is called from the + method to create the actual objects. + + Key value to create the resolver. + Value to store in the resolver. + The created . + + + + Interface defining the configuration interface exposed by the + Static Factory extension. + + + + + Base interface for all extension configuration interfaces. + + + + + Retrieve the container instance that we are currently configuring. + + + + + Register the given factory delegate to be called when the container is + asked to resolve . + + Type that will be requested from the container. + Delegate to invoke to create the instance. + The container extension object this method was invoked on. + + + + Register the given factory delegate to be called when the container is + asked to resolve and . + + Type that will be requested from the container. + The name that will be used when requesting to resolve this type. + Delegate to invoke to create the instance. + The container extension object this method was invoked on. + + + + Represents the context in which a build-up or tear-down operation runs. + + + + + Represents the context in which a build-up or tear-down operation runs. + + + + + Add a new set of resolver override objects to the current build operation. + + objects to add. + + + + Get a object for the given + or null if that dependency hasn't been overridden. + + Type of the dependency. + Resolver to use, or null if no override matches for the current operation. + + + + A convenience method to do a new buildup operation on an existing context. + + Key to use to build up. + Created object. + + + + A convenience method to do a new buildup operation on an existing context. This + overload allows you to specify extra policies which will be in effect for the duration + of the build. + + Key defining what to build up. + A delegate that takes a . This + is invoked with the new child context before the build up process starts. This gives callers + the opportunity to customize the context for the build process. + Created object. + + + + Gets the head of the strategy chain. + + + The strategy that's first in the chain; returns null if there are no + strategies in the chain. + + + + + Gets the associated with the build. + + + The associated with the build. + + + + + Gets the original build key for the build operation. + + + The original build key for the build operation. + + + + + Get the current build key for the current build operation. + + + + + The set of policies that were passed into this context. + + This returns the policies passed into the context. + Policies added here will remain after buildup completes. + The persistent policies for the current context. + + + + Gets the policies for the current context. + + Any policies added to this object are transient + and will be erased at the end of the buildup. + + The policies for the current context. + + + + + Gets the collection of objects + that need to execute in event of an exception. + + + + + The current object being built up or torn down. + + + The current object being manipulated by the build operation. May + be null if the object hasn't been created yet. + + + + Flag indicating if the build operation should continue. + + true means that building should not call any more + strategies, false means continue to the next strategy. + + + + An object representing what is currently being done in the + build chain. Used to report back errors if there's a failure. + + + + + The build context used to resolve a dependency during the build operation represented by this context. + + + + + Initialize a new instance of the class. + + + + + Initialize a new instance of the class with a , + , and the + build key used to start this build operation. + + The to use for this context. + The to use for this context. + The to use for this context. + Build key to start building. + The existing object to build up. + + + + Create a new using the explicitly provided + values. + + The to use for this context. + The to use for this context. + The set of persistent policies to use for this context. + The set of transient policies to use for this context. It is + the caller's responsibility to ensure that the transient and persistent policies are properly + combined. + Build key for this context. + Existing object to build up. + + + + Add a new set of resolver override objects to the current build operation. + + objects to add. + + + + Get a object for the given + or null if that dependency hasn't been overridden. + + Type of the dependency. + Resolver to use, or null if no override matches for the current operation. + + + + A convenience method to do a new buildup operation on an existing context. + + Key to use to build up. + Created object. + + + + A convenience method to do a new buildup operation on an existing context. This + overload allows you to specify extra policies which will be in effect for the duration + of the build. + + Key defining what to build up. + A delegate that takes a . This + is invoked with the new child context before the build up process starts. This gives callers + the opportunity to customize the context for the build process. + Created object. + + + + Gets the head of the strategy chain. + + + The strategy that's first in the chain; returns null if there are no + strategies in the chain. + + + + + Get the current build key for the current build operation. + + + + + The current object being built up or torn down. + + + The current object being manipulated by the build operation. May + be null if the object hasn't been created yet. + + + + Gets the associated with the build. + + + The associated with the build. + + + + + Gets the original build key for the build operation. + + + The original build key for the build operation. + + + + + The set of policies that were passed into this context. + + This returns the policies passed into the context. + Policies added here will remain after buildup completes. + The persistent policies for the current context. + + + + Gets the policies for the current context. + + + Any modifications will be transient (meaning, they will be forgotten when + the outer BuildUp for this context is finished executing). + + + The policies for the current context. + + + + + Gets the collection of objects + that need to execute in event of an exception. + + + + + Flag indicating if the build operation should continue. + + true means that building should not call any more + strategies, false means continue to the next strategy. + + + + An object representing what is currently being done in the + build chain. Used to report back errors if there's a failure. + + + + + The build context used to resolve a dependency during the build operation represented by this context. + + + + + Represents that a dependency could not be resolved. + + + Represents that a dependency could not be resolved. + + + + + Initializes a new instance of the class with no extra information. + + + + + Initializes a new instance of the class with the given message. + + Some random message. + + + + Initialize a new instance of the class with the given + message and inner exception. + + Some random message + Inner exception. + + + + Initializes a new instance of the class with the build key of the object begin built. + + The build key of the object begin built. + + + + Initializes a new instance of the class with serialized data. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + + The exception thrown when injection is attempted on a method + that is an open generic or has out or ref params. + + + The exception thrown when injection is attempted on a method + that is an open generic or has out or ref params. + + + + + Construct a new with no + message. + + + + + Construct a with the given message + + Message to return. + + + + Construct a with the given message + and inner exception. + + Message to return. + Inner exception + + + + Used for serialization. + + Serialization info. + Serialization context. + + + + Extension methods to provide convenience overloads over the + interface. + + + + + Start a recursive build up operation to retrieve the default + value for the given type. + + Type of object to build. + Parent context. + Resulting object. + + + + Start a recursive build up operation to retrieve the named + implementation for the given type. + + Type to resolve. + Parent context. + Name to resolve with. + The resulting object. + + + + Add a set of s to the context, specified as a + variable argument list. + + Context to add overrides to. + The overrides. + + + + Data structure that stores the set of + objects and executes them when requested. + + + + + Add a new object to this + list. + + Object to add. + + + + Execute the method + of everything in the recovery list. Recoveries will execute + in the opposite order of add - it's a stack. + + + + + Return the number of recovery objects currently in the stack. + + + + + Represents a lifetime container. + + + A lifetime container tracks the lifetime of an object, and implements + IDisposable. When the container is disposed, any objects in the + container which implement IDisposable are also disposed. + + + + + Adds an object to the lifetime container. + + The item to be added to the lifetime container. + + + + Determine if a given object is in the lifetime container. + + + The item to locate in the lifetime container. + + + Returns true if the object is contained in the lifetime + container; returns false otherwise. + + + + + Removes an item from the lifetime container. The item is + not disposed. + + The item to be removed. + + + + Gets the number of references in the lifetime container + + + The number of references in the lifetime container + + + + + Represents a lifetime container. + + + A lifetime container tracks the lifetime of an object, and implements + IDisposable. When the container is disposed, any objects in the + container which implement IDisposable are also disposed. + + + + + Adds an object to the lifetime container. + + The item to be added to the lifetime container. + + + + Determine if a given object is in the lifetime container. + + + The item to locate in the lifetime container. + + + Returns true if the object is contained in the lifetime + container; returns false otherwise. + + + + + Releases the resources used by the . + + + + + Releases the managed resources used by the DbDataReader and optionally releases the unmanaged resources. + + + true to release managed and unmanaged resources; false to release only unmanaged resources. + + + + + Returns an enumerator that iterates through the lifetime container. + + + An object that can be used to iterate through the life time container. + + + + + Returns an enumerator that iterates through the lifetime container. + + + An object that can be used to iterate through the life time container. + + + + + Removes an item from the lifetime container. The item is + not disposed. + + The item to be removed. + + + + Gets the number of references in the lifetime container + + + The number of references in the lifetime container + + + + + A custom collection over objects. + + + + + Removes an individual policy type for a build key. + + The type of policy to remove. + The key the policy applies. + + + + Removes all policies from the list. + + + + + Removes a default policy. + + The type the policy was registered as. + + + + Gets an individual policy. + + The interface the policy is registered under. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy list in the chain that the searched for policy was found in, null if the policy was + not found. + The policy in the list, if present; returns null otherwise. + + + + Get the non default policy. + + The interface the policy is registered under. + The key the policy applies to. + True if the search should be in the local policy list only; otherwise false to search up the parent chain. + The policy list in the chain that the searched for policy was found in, null if the policy was + not found. + The policy in the list if present; returns null otherwise. + + + + Sets an individual policy. + + The of the policy. + The policy to be registered. + The key the policy applies. + + + + Sets a default policy. When checking for a policy, if no specific individual policy + is available, the default will be used. + + The interface to register the policy under. + The default policy to be registered. + + + + A custom collection wrapper over objects. + + + + + Initialize a new instance of a class. + + + + + Initialize a new instance of a class with another policy list. + + An inner policy list to search. + + + + Removes an individual policy type for a build key. + + The type of policy to remove. + The key the policy applies. + + + + Removes all policies from the list. + + + + + Removes a default policy. + + The type the policy was registered as. + + + + Gets an individual policy. + + The interface the policy is registered under. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy list in the chain that the searched for policy was found in, null if the policy was + not found. + The policy in the list, if present; returns null otherwise. + + + + Get the non default policy. + + The interface the policy is registered under. + The key the policy applies to. + True if the search should be in the local policy list only; otherwise false to search up the parent chain. + The policy list in the chain that the searched for policy was found in, null if the policy was + not found. + The policy in the list if present; returns null otherwise. + + + + Sets an individual policy. + + The of the policy. + The policy to be registered. + The key the policy applies. + + + + Sets a default policy. When checking for a policy, if no specific individual policy + is available, the default will be used. + + The interface to register the policy under. + The default policy to be registered. + + + + Gets the number of items in the locator. + + + The number of items in the locator. + + + + + An implementation of . + + + + + Add a new object to this + list. + + Object to add. + + + + Execute the method + of everything in the recovery list. Recoveries will execute + in the opposite order of add - it's a stack. + + + + + Return the number of recovery objects currently in the stack. + + + + + Implementation of which will notify an object about + the completion of a BuildUp operation, or start of a TearDown operation. + + + This strategy checks the object that is passing through the builder chain to see if it + implements IBuilderAware and if it does, it will call + and . This strategy is meant to be used from the + stage. + + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + Context of the build operation. + + + + Called during the chain of responsibility for a teardown operation. The + PreTearDown method is called when the chain is being executed in the + forward direction. + + Context of the teardown operation. + + + + Implemented on a class when it wants to receive notifications + about the build process. + + + + + Called by the when the object is being built up. + + The key of the object that was just built up. + + + + Called by the when the object is being torn down. + + + + + Enumeration to represent the object builder stages. + + + The order of the values in the enumeration is the order in which the stages are run. + + + + + Strategies in this stage run before creation. Typical work done in this stage might + include strategies that use reflection to set policies into the context that other + strategies would later use. + + + + + Strategies in this stage create objects. Typically you will only have a single policy-driven + creation strategy in this stage. + + + + + Strategies in this stage work on created objects. Typical work done in this stage might + include setter injection and method calls. + + + + + Strategies in this stage work on objects that are already initialized. Typical work done in + this stage might include looking to see if the object implements some notification interface + to discover when its initialization stage has been completed. + + + + + Represents a builder policy for mapping build keys. + + + + + Represents a builder policy for mapping build keys. + + + + + Maps the build key. + + The build key to map. + Current build context. Used for contextual information + if writing a more sophisticated mapping. This parameter can be null + (called when getting container registrations). + The new build key. + + + + Initialize a new instance of the with the new build key. + + The new build key. + + + + Maps the build key. + + The build key to map. + Current build context. Used for contextual information + if writing a more sophisticated mapping, unused in this implementation. + The new build key. + + + + Represents a strategy for mapping build keys in the build up operation. + + + + + Called during the chain of responsibility for a build operation. Looks for the + and if found maps the build key for the current operation. + + The context for the operation. + + + + An implementation of that can map + generic types. + + + + + Create a new instance + that will map generic types. + + Build key to map to. This must be or contain an open generic type. + + + + Maps the build key. + + The build key to map. + Current build context. Used for contextual information + if writing a more sophisticated mapping. + The new build key. + + + + A that will look for a build plan + in the current context. If it exists, it invokes it, otherwise + it creates one and stores it for later, and invokes it. + + + + + Called during the chain of responsibility for a build operation. + + The context for the operation. + + + + An implementation of that chooses + constructors based on these criteria: first, pick a constructor marked with the + attribute. If there + isn't one, then choose the constructor with the longest parameter list. If that is ambiguous, + then throw. + + Thrown when the constructor to choose is ambiguous. + Attribute used to mark the constructor to call. + + + + Base class that provides an implementation of + which lets you override how the parameter resolvers are created. + + + + + A that, when implemented, + will determine which constructor to call from the build plan. + + + + + Choose the constructor to call for the given type. + + Current build context + The to add any + generated resolver objects into. + The chosen constructor. + + + + Choose the constructor to call for the given type. + + Current build context + The to add any + generated resolver objects into. + The chosen constructor. + + + + Create a instance for the given + . + + Parameter to create the resolver for. + The resolver object. + + + + Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. + + + + Value Condition Less than zerox is less than y.Zerox equals y.Greater than zerox is greater than y. + + + The second object to compare. + The first object to compare. + + + + Create a instance for the given + . + + Parameter to create the resolver for. + The resolver object. + + + + Objects of this type are the return value from . + It encapsulates the desired with the string keys + needed to look up the for each + parameter. + + + + + Base class for return values from selector policies that + return a memberinfo of some sort plus a list of parameter + keys to look up the parameter resolvers. + + + + + Base class for return of selector policies that need + to keep track of a set of parameter keys. + + + + + Add a new parameter key to this object. Keys are assumed + to be in the order of the parameters to the constructor. + + Key for the next parameter to look up. + + + + The set of keys for the constructor parameters. + + + + + Construct a new , storing + the given member info. + + Member info to store. + + + + The member info stored. + + + + + Create a new instance which + contains the given constructor. + + The constructor to wrap. + + + + The constructor this object wraps. + + + + + This class records the information about which constructor argument is currently + being resolved, and is responsible for generating the error string required when + an error has occurred. + + + + + Initializes a new instance of the class. + + The type that is being constructed. + A string representing the constructor being called. + Parameter being resolved. + + + + Generate the string describing what parameter was being resolved. + + The description string. + + + + String describing the constructor being set up. + + + + + Parameter that's being resolved. + + + + + A that emits IL to call constructors + as part of creating a build plan. + + + + + Called during the chain of responsibility for a build operation. + + Existing object is an instance of . + The context for the operation. + + + + A helper method used by the generated IL to throw an exception if + a dependency cannot be resolved. + + The currently being + used for the build of this object. + + + + A helper method used by the generated IL to throw an exception if + a dependency cannot be resolved because of an invalid constructor. + + The currently being + used for the build of this object. + The signature of the invalid constructor. + + + + A helper method used by the generated IL to throw an exception if + no existing object is present, but the user is attempting to build + an interface (usually due to the lack of a type mapping). + + The currently being + used for the build of this object. + + + + A helper method used by the generated IL to store the current operation in the build context. + + + + + A helper method used by the generated IL to store the current operation in the build context. + + + + + A helper method used by the generated IL to set up a PerResolveLifetimeManager lifetime manager + if the current object is such. + + Current build context. + + + + A class that records that a constructor is about to be call, and is + responsible for generating the error string required when + an error has occurred. + + + + + Initializes a new instance of the class. + + + + + Generate the description string. + + The string. + + + + Constructor we're trying to call. + + + + + An implementation of that will + check for full trust and if we're building a class or an interface. If in full + trust, attach to the class or module of the interface respectively. If in partial + trust, attach to the OB2 module instead. + + + + + This interface defines a policy that manages creation of the dynamic methods + used by the ObjectBuilder code generation. This way, we can replace the details + of how the dynamic method is created to handle differences in CLR (like Silverlight + vs desktop) or security policies. + + + + + Create a builder method for the given type, using the given name. + + Type that will be built by the generated method. + Name to give to the method. + A object with the proper signature to use + as part of a build plan. + + + + Create a builder method for the given type, using the given name. + + Type that will be built by the generated method. + Name to give to the method. + A object with the proper signature to use + as part of a build plan. + + + + This object tracks the current state of the build plan generation, + accumulates the IL, provides the preamble & postamble for the dynamic + method, and tracks things like local variables in the generated IL + so that they can be reused across IL generation strategies. + + + + + Create a that is initialized + to handle creation of a dynamic method to build the given type. + + Type that we're trying to create a build plan for. + An object that actually + creates our object. + + + + Completes generation of the dynamic method and returns the + generated dynamic method delegate. + + The created + + + + Emit the IL to put the build context on top of the IL stack. + + + + + Emit the IL to put the current build key on top of the IL stack. + + + + + Emit the IL to put the current "existing" object on the top of the IL stack. + + + + + Emit the IL to make the top of the IL stack our current "existing" object. + + + + + Emit the IL to load the given object onto the top of the IL stack. + + Type to load on the stack. + + + + Emit the IL needed to look up an and + call it to get a value. + + Type of the dependency to resolve. + Key to look up the policy by. + + + + Emit the IL needed to clear the . + + + + + Emit the IL needed to either cast the top of the stack to the target type + or unbox it, if it's a value type. + + Type to convert the top of the stack to. + + + + A helper method used by the generated IL to clear the current operation in the build context. + + + + + Helper method used by generated IL to look up a dependency resolver based on the given key. + + Current build context. + Type of the dependency being resolved. + Key the resolver was stored under. + The found dependency resolver. + + + + A reflection helper method to make it easier to grab a property getter + for the given property. + + Type that implements the property we want. + Type of the property. + Name of the property. + The property getter's . + + + + A reflection helper method that makes it easier to grab a + for a method. + + Type that implements the method we want. + Name of the method. + Types of arguments to the method. + The method's . + + + + The underlying that can be used to + emit IL into the generated dynamic method. + + + + + The type we're currently creating the method to build. + + + + + A delegate type that defines the signature of the + dynamic method created by the build plans. + + used to build up the object. + + + + An implementation of that runs the + given delegate to execute the plan. + + + + + An implementation + that constructs a build plan via dynamic IL emission. + + + + + A that can create and return an + for the given build key. + + + + + Create a build plan using the given context and build key. + + Current build context. + Current build key. + The build plan. + + + + Construct a that + uses the given strategy chain to construct the build plan. + + The strategy chain. + + + + Construct a build plan. + + The current build context. + The current build key. + The created build plan. + + + + A class that records that a constructor is about to be call, and is + responsible for generating the error string required when + an error has occurred. + + + + + Initializes a new instance of the class. + + + + + Generate the description string. + + The string. + + + + Method we're trying to call. + + + + + This class records the information about which constructor argument is currently + being resolved, and is responsible for generating the error string required when + an error has occurred. + + + + + Initializes a new instance of the class. + + The type that is being constructed. + A string representing the method being called. + Parameter being resolved. + + + + Generate the string describing what parameter was being resolved. + + The description string. + + + + String describing the method being set up. + + + + + Parameter that's being resolved. + + + + + A that generates IL to call + chosen methods (as specified by the current ) + as part of object build up. + + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + Context of the build operation. + + + + A helper method used by the generated IL to store the current operation in the build context. + + + + + A helper method used by the generated IL to store the current operation in the build context. + + + + + A base class that holds the information shared by all operations + performed by the container while setting properties. + + + + + Initializes a new instance of the class. + + + + + Generate the description of this operation. + + The string. + + + + Get a format string used to create the description. Called by + the base method. + + The format string. + + + + The property value currently being resolved. + + + + + This class records the information about which property value is currently + being resolved, and is responsible for generating the error string required when + an error has occurred. + + + + + Initializes a new instance of the class. + + + + + Get a format string used to create the description. Called by + the base method. + + The format string. + + + + A that generates IL to resolve properties + on an object being built. + + + + + Called during the chain of responsibility for a build operation. + + The context for the operation. + + + + A helper method used by the generated IL to store the current operation in the build context. + + + + + A helper method used by the generated IL to store the current operation in the build context. + + + + + This class records the information about which property value is currently + being set, and is responsible for generating the error string required when + an error has occurred. + + + + + Initializes a new instance of the class. + + Type property is on. + Name of property being set. + + + + Get a format string used to create the description. Called by + the base method. + + The format string. + + + + Creates an instance of this build plan's type, or fills + in the existing type if passed in. + + Context used to build up the object. + + + + An that will examine the given + types and return a sequence of objects + that should be called as part of building the object. + + + + + Return the sequence of methods to call while building the target object. + + Current build context. + The to add any + generated resolver objects into. + Sequence of methods to call. + + + + An implementation of that selects + methods by looking for the given + attribute on those methods. + + Type of attribute used to mark methods + to inject. + + + + Base class that provides an implementation of + which lets you override how the parameter resolvers are created. + + Attribute that marks methods that should + be called. + + + + Return the sequence of methods to call while building the target object. + + Current build context. + The to add any + generated resolver objects into. + Sequence of methods to call. + + + + Create a instance for the given + . + + Parameter to create the resolver for. + The resolver object. + + + + Create a instance for the given + . + + Parameter to create the resolver for. + The resolver object. + + + + Objects of this type are the return value from . + It encapsulates the desired with the string keys + needed to look up the for each + parameter. + + + + + Create a new instance which + contains the given method. + + The method + + + + The constructor this object wraps. + + + + + An that returns a sequence + of properties that should be injected for the given type. + + + + + Returns sequence of properties on the given type that + should be set as part of building that object. + + Current build context. + The to add any + generated resolver objects into. + Sequence of objects + that contain the properties to set. + + + + Base class that provides an implementation of + which lets you override how the parameter resolvers are created. + + + + + Returns sequence of properties on the given type that + should be set as part of building that object. + + Current build context. + The to add any + generated resolver objects into. + Sequence of objects + that contain the properties to set. + + + + Create a for the given + property. + + Property to create resolver for. + The resolver object. + + + + An implementation of that looks + for properties marked with the + attribute that are also settable and not indexers. + + + + + + Create a for the given + property. + + Property to create resolver for. + The resolver object. + + + + Objects of this type are returned from + . + This class combines the about + the property with the string key used to look up the resolver + for this property's value. + + + + + Create an instance of + with the given and key. + + The property. + Key to use to look up the resolver. + + + + PropertyInfo for this property. + + + + + Key to look up this property's resolver. + + + + + Implementation of . + + + + + A builder policy that lets you keep track of the current + resolvers and will remove them from the given policy set. + + + + + Add a new resolver to track by key. + + Key that was used to add the resolver to the policy set. + + + + Remove the currently tracked resolvers from the given policy list. + + Policy list to remove the resolvers from. + + + + Add a new resolver to track by key. + + Key that was used to add the resolver to the policy set. + + + + Remove the currently tracked resolvers from the given policy list. + + Policy list to remove the resolvers from. + + + + Get an instance that implements , + either the current one in the policy set or creating a new one if it doesn't + exist. + + Policy list to look up from. + Build key to track. + The resolver tracker. + + + + Add a key to be tracked to the current tracker. + + Policy list containing the resolvers and trackers. + Build key for the resolvers being tracked. + Key for the resolver. + + + + Remove the resolvers for the given build key. + + Policy list containing the build key. + Build key. + + + + An implementation of that + calls back into the build chain to build up the dependency, passing + a type given at compile time as its build key. + + + + + Create a new instance storing the given type. + + Type to resolve. + + + + Get the value for a dependency. + + Current build context. + The value for the dependency. + + + + This interface defines a standard method to convert any + regardless + of the stage enum into a regular, flat strategy chain. + + + + + Convert this into + a flat . + + The flattened . + + + + Represents a chain of responsibility for builder strategies. + + + + + Reverse the order of the strategy chain. + + The reversed strategy chain. + + + + Execute this strategy chain against the given context, + calling the Buildup methods on the strategies. + + Context for the build process. + The build up object + + + + Execute this strategy chain against the given context, + calling the TearDown methods on the strategies. + + Context for the teardown process. + + + + A builder policy used to create lifetime policy instances. + Used by the LifetimeStrategy when instantiating open + generic types. + + + + + Create a new instance of . + + The new instance. + + + + The type of Lifetime manager that will be created by this factory. + + + + + An implementation that uses + a to figure out if an object + has already been created and to update or remove that + object from some backing store. + + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + Context of the build operation. + + + + Called during the chain of responsibility for a build operation. The + PostBuildUp method is called when the chain has finished the PreBuildUp + phase and executes in reverse order from the PreBuildUp calls. + + Context of the build operation. + + + + Represents a chain of responsibility for builder strategies partitioned by stages. + + The stage enumeration to partition the strategies. + + + + Initialize a new instance of the class. + + + + + Initialize a new instance of the class with an inner strategy chain to use when building. + + The inner strategy chain to use first when finding strategies in the build operation. + + + + Adds a strategy to the chain at a particular stage. + + The strategy to add to the chain. + The stage to add the strategy. + + + + Add a new strategy for the . + + The of + The stage to add the strategy. + + + + Clear the current strategy chain list. + + + This will not clear the inner strategy chain if this instane was created with one. + + + + + Makes a strategy chain based on this instance. + + A new . + + + + Represents a chain of responsibility for builder strategies. + + + + + Initialzie a new instance of the class. + + + + + Initialzie a new instance of the class with a colleciton of strategies. + + A collection of strategies to initialize the chain. + + + + Adds a strategy to the chain. + + The strategy to add to the chain. + + + + Adds strategies to the chain. + + The strategies to add to the chain. + + + + Reverse the order of the strategy chain. + + The reversed strategy chain. + + + + Execute this strategy chain against the given context to build up. + + Context for the build processes. + The build up object + + + + Execute this strategy chain against the given context, + calling the TearDown methods on the strategies. + + Context for the teardown process. + + + + Returns an enumerator that iterates through the collection. + + + + A that can be used to iterate through the collection. + + 1 + + + + Returns an enumerator that iterates through a collection. + + + + An object that can be used to iterate through the collection. + + 2 + + + + Build key used to combine a type object with a string name. Used by + ObjectBuilder to indicate exactly what is being built. + + + + + Create a new instance with the given + type and name. + + to build. + Key to use to look up type mappings and singletons. + + + + Create a new instance for the default + buildup of the given type. + + to build. + + + + This helper method creates a new instance. It is + initialized for the default key for the given type. + + Type to build. + A new instance. + + + + This helper method creates a new instance for + the given type and key. + + Type to build + Key to use to look up type mappings and singletons. + A new instance initialized with the given type and name. + + + + Compare two instances. + + Two instances compare equal + if they contain the same name and the same type. Also, comparing + against a different type will also return false. + Object to compare to. + True if the two keys are equal, false if not. + + + + Calculate a hash code for this instance. + + A hash code. + + + + Compare two instances for equality. + + Two instances compare equal + if they contain the same name and the same type. + First of the two keys to compare. + Second of the two keys to compare. + True if the values of the keys are the same, else false. + + + + Compare two instances for inequality. + + Two instances compare equal + if they contain the same name and the same type. If either field differs + the keys are not equal. + First of the two keys to compare. + Second of the two keys to compare. + false if the values of the keys are the same, else true. + + + + Formats the build key as a string (primarily for debugging). + + A readable string representation of the build key. + + + + Return the stored in this build key. + + The type to build. + + + + Returns the name stored in this build key. + + The name to use when building. + + + + A generic version of so that + you can new up a key using generic syntax. + + Type for the key. + + + + Construct a new that + specifies the given type. + + + + + Construct a new that + specifies the given type and name. + + Name for the key. + + + + A series of helper methods to deal with sequences - + objects that implement . + + + + + A function that turns an arbitrary parameter list into an + . + + Type of arguments. + The items to put into the collection. + An array that contains the values of the . + + + + Given two sequences, return a new sequence containing the corresponding values + from each one. + + Type of first sequence. + Type of second sequence. + First sequence of items. + Second sequence of items. + New sequence of pairs. This sequence ends when the shorter of sequence1 and sequence2 does. + + + + The exception thrown by the Unity container when + an attempt to resolve a dependency fails. + + + The exception thrown by the Unity container when + an attempt to resolve a dependency fails. + + + + + Constructor to create a from serialized state. + + Serialization info + Serialization context + + + + Serialize this object into the given context. + + Serialization info + Streaming context + + + + Create a new that records + the exception for the given type and name. + + Type requested from the container. + Name requested from the container. + The actual exception that caused the failure of the build. + The build context representing the failed operation. + + + + The type that was being requested from the container at the time of failure. + + + + + The name that was being requested from the container at the time of failure. + + + + + A that lets you register a + delegate with the container to create an object, rather than calling + the object's constructor. + + + + + Base class for all extension objects. + + + + + The container calls this method when the extension is added. + + A instance that gives the + extension access to the internals of the container. + + + + Initial the container with this extension's functionality. + + + When overridden in a derived class, this method will modify the given + by adding strategies, policies, etc. to + install it's functions into the container. + + + + Removes the extension's functions from the container. + + + + This method is called when extensions are being removed from the container. It can be + used to do things like disconnect event handlers or clean up member state. You do not + need to remove strategies or policies here; the container will do that automatically. + + + The default implementation of this method does nothing. + + + + + The container this extension has been added to. + + The that this extension has been added to. + + + + The object used to manipulate + the inner state of the container. + + + + + Initialize this extension. This particular extension requires no + initialization work. + + + + + Register the given factory delegate to be called when the container is + asked to resolve and . + + Type that will be requested from the container. + The name that will be used when requesting to resolve this type. + Delegate to invoke to create the instance. + The container extension object this method was invoked on. + + + + Register the given factory delegate to be called when the container is + asked to resolve . + + Type that will be requested from the container. + Delegate to invoke to create the instance. + The container extension object this method was invoked on. + + + + An implementation of that + acts as a decorator over another . + This checks to see if the current type being built is the + right one before checking the inner . + + + + + Create an instance of + + Type to check for. + Inner override to check after type matches. + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + A convenience version of that lets you + specify the type to construct via generics syntax. + + Type to check for. + + + + Create an instance of . + + Inner override to check after type matches. + + + + Extension class that adds a set of convenience overloads to the + interface. + + + + + Register a type with specific members to be injected. + + Type this registration is for. + Container to configure. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container. + + + + This method is used to tell the container that when asked for type , + actually return an instance of type . This is very useful for + getting instances of interfaces. + + + This overload registers a default mapping and transient lifetime. + + + that will be requested. + that will actually be returned. + Container to configure. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container, where the created instances will use + the given . + + that will be requested. + that will actually be returned. + Container to configure. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container. + + + This method is used to tell the container that when asked for type , + actually return an instance of type . This is very useful for + getting instances of interfaces. + + that will be requested. + that will actually be returned. + Container to configure. + Name of this mapping. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container, where the created instances will use + the given . + + that will be requested. + that will actually be returned. + Container to configure. + Name to use for registration, null if a default registration. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a for the given type with the container. + No type mapping is performed for this type. + + The type to apply the to. + Container to configure. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a for the given type with the container. + No type mapping is performed for this type. + + The type to configure injection on. + Container to configure. + Name that will be used to request the type. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a for the given type and name with the container. + No type mapping is performed for this type. + + The type to apply the to. + Container to configure. + Name that will be used to request the type. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type with specific members to be injected. + + Container to configure. + Type this registration is for. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container. + + + + This method is used to tell the container that when asked for type , + actually return an instance of type . This is very useful for + getting instances of interfaces. + + + This overload registers a default mapping. + + + Container to configure. + that will be requested. + that will actually be returned. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container. + + + This method is used to tell the container that when asked for type , + actually return an instance of type . This is very useful for + getting instances of interfaces. + + Container to configure. + that will be requested. + that will actually be returned. + Name to use for registration, null if a default registration. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container, where the created instances will use + the given . + + Container to configure. + that will be requested. + that will actually be returned. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a for the given type and name with the container. + No type mapping is performed for this type. + + Container to configure. + The to apply the to. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a for the given type and name with the container. + No type mapping is performed for this type. + + Container to configure. + The to configure in the container. + Name to use for registration, null if a default registration. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a for the given type and name with the container. + No type mapping is performed for this type. + + Container to configure. + The to apply the to. + Name to use for registration, null if a default registration. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + This overload does a default registration and has the container take over the lifetime of the instance. + + Type of instance to register (may be an implemented interface instead of the full type). + Container to configure. + Object to returned. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + This overload does a default registration (name = null). + + + Type of instance to register (may be an implemented interface instead of the full type). + Container to configure. + Object to returned. + + object that controls how this instance will be managed by the container. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + This overload automatically has the container take ownership of the . + + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + Container to configure. + Name for registration. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + Container to configure. + Name for registration. + + object that controls how this instance will be managed by the container. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + This overload does a default registration and has the container take over the lifetime of the instance. + + Container to configure. + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + This overload does a default registration (name = null). + + + Container to configure. + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + + object that controls how this instance will be managed by the container. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + This overload automatically has the container take ownership of the . + + Container to configure. + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + Name for registration. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Resolve an instance of the default requested type from the container. + + of object to get from the container. + Container to resolve from. + Any overrides for the resolve call. + The retrieved object. + + + + Resolve an instance of the requested type with the given name from the container. + + of object to get from the container. + Container to resolve from. + Name of the object to retrieve. + Any overrides for the resolve call. + The retrieved object. + + + + Resolve an instance of the default requested type from the container. + + Container to resolve from. + of object to get from the container. + Any overrides for the resolve call. + The retrieved object. + + + + Return instances of all registered types requested. + + + + This method is useful if you've registered multiple types with the same + but different names. + + + Be aware that this method does NOT return an instance for the default (unnamed) registration. + + + The type requested. + Container to resolve from. + Any overrides for the resolve calls. + Set of objects of type . + + + + Run an existing object through the container and perform injection on it. + + + + This method is useful when you don't control the construction of an + instance (ASP.NET pages or objects created via XAML, for instance) + but you still want properties and other injection performed. + + + This overload uses the default registrations. + + + of object to perform injection on. + Container to resolve through. + Instance to build up. + Any overrides for the buildup. + The resulting object. By default, this will be , but + container extensions may add things like automatic proxy creation which would + cause this to return a different object (but still type compatible with ). + + + + Run an existing object through the container and perform injection on it. + + + + This method is useful when you don't control the construction of an + instance (ASP.NET pages or objects created via XAML, for instance) + but you still want properties and other injection performed. + + of object to perform injection on. + Conatiner to resolve through. + Instance to build up. + name to use when looking up the typemappings and other configurations. + Any overrides for the Buildup. + The resulting object. By default, this will be , but + container extensions may add things like automatic proxy creation which would + cause this to return a different object (but still type compatible with ). + + + + Run an existing object through the container and perform injection on it. + + + + This method is useful when you don't control the construction of an + instance (ASP.NET pages or objects created via XAML, for instance) + but you still want properties and other injection performed. + + + This overload uses the default registrations. + + + Container to resolve through. + of object to perform injection on. + Instance to build up. + Any overrides for the Buildup. + The resulting object. By default, this will be , but + container extensions may add things like automatic proxy creation which would + cause this to return a different object (but still type compatible with ). + + + + Creates a new extension object and adds it to the container. + + Type of to add. The extension type + will be resolved from within the supplied . + Container to add the extension to. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Resolve access to a configuration interface exposed by an extension. + + Extensions can expose configuration interfaces as well as adding + strategies and policies to the container. This method walks the list of + added extensions and returns the first one that implements the requested type. + + The configuration interface required. + Container to configure. + The requested extension's configuration interface, or null if not found. + + + + Check if a particular type has been registered with the container with + the default name. + + Container to inspect. + Type to check registration for. + True if this type has been registered, false if not. + + + + Check if a particular type/name pair has been registered with the container. + + Container to inspect. + Type to check registration for. + Name to check registration for. + True if this type/name pair has been registered, false if not. + + + + Check if a particular type has been registered with the container with the default name. + + Type to check registration for. + Container to inspect. + True if this type has been registered, false if not. + + + + Check if a particular type/name pair has been registered with the container. + + Type to check registration for. + Container to inspect. + Name to check registration for. + True if this type/name pair has been registered, false if not. + + + + This extension installs the default strategies and policies into the container + to implement the standard behavior of the Unity container. + + + This extension installs the default strategies and policies into the container + to implement the standard behavior of the Unity container. + + + + + Add the correct to the policy + set. This version adds the appropriate policy for running on the desktop CLR. + + + + + Add the default ObjectBuilder strategies & policies to the container. + + + + + The class provides the means for extension objects + to manipulate the internal state of the . + + + + + Store a type/name pair for later resolution. + + + + When users register type mappings (or other things) with a named key, this method + allows you to register that name with the container so that when the + method is called, that name is included in the list that is returned. + + to register. + Name assocated with that type. + + + + The container that this context is associated with. + + The object. + + + + The strategies this container uses. + + The that the container uses to build objects. + + + + The strategies this container uses to construct build plans. + + The that this container uses when creating + build plans. + + + + The policies this container uses. + + The the that container uses to build objects. + + + + The that this container uses. + + The is used to manage objects that the container is managing. + + + + This event is raised when the method, + or one of its overloads, is called. + + + + + This event is raised when the method, + or one of its overloads, is called. + + + + + This event is raised when the method is called, providing + the newly created child container to extensions to act on as they see fit. + + + + + An EventArgs class that holds a string Name. + + + + + Create a new with a null name. + + + + + Create a new with the given name. + + Name to store. + + + + The name. + + Name used for this event arg object. + + + + Event argument class for the event. + + + + + Create a new instance of . + + Type to map from. + Type to map to. + Name for the registration. + to manage instances. + + + + Type to map from. + + + + + Type to map to. + + + + + to manage instances. + + + + + Event argument class for the event. + + + + + Create a default instance. + + + + + Create a instance initialized with the given arguments. + + Type of instance being registered. + The instance object itself. + Name to register under, null if default registration. + object that handles how + the instance will be owned. + + + + Type of instance being registered. + + + Type of instance being registered. + + + + + Instance object being registered. + + Instance object being registered + + + + that controls ownership of + this instance. + + + + + A that lets you specify that + an instance of a generic type parameter should be resolved. + + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + name to use when looking up in the container. + + + + Return a instance that will + return this types value for the parameter. + + The actual type to resolve. + The resolution key. + The . + + + + A that lets you specify that + an array containing the registered instances of a generic type parameter + should be resolved. + + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + The values for the elements, that will + be converted to objects. + + + + Test to see if this parameter value has a matching type for the given type. + + Type to check. + True if this parameter value is compatible with type , + false if not. + A type is considered compatible if it is an array type of rank one + and its element type is a generic type parameter with a name matching this generic + parameter name configured for the receiver. + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + Name for the type represented by this . + This may be an actual type name or a generic argument name. + + + + + A Unity container extension that allows you to configure + which constructors, properties, and methods get injected + via an API rather than through attributes. + + + + + Initial the container with this extension's functionality. + + + When overridden in a derived class, this method will modify the given + by adding strategies, policies, etc. to + install it's functions into the container. + + + + API to configure the injection settings for a particular type. + + Type the injection is being configured for. + Objects containing the details on which members to inject and how. + This extension object. + + + + API to configure the injection settings for a particular type/name pair. + + Type the injection is being configured for. + Name of registration + Objects containing the details on which members to inject and how. + This extension object. + + + + API to configure the injection settings for a particular type. + + Type to configure. + Objects containing the details on which members to inject and how. + This extension object. + + + + API to configure the injection settings for a particular type/name pair. + + Type to configure. + Name of registration. + Objects containing the details on which members to inject and how. + This extension object. + + + + API to configure the injection settings for a particular type/name pair. + + Type of interface/base class being registered (may be null). + Type of actual implementation class being registered. + Name of registration. + Objects containing the details on which members to inject and how. + This extension object. + + + + A class that holds the collection of information + for a constructor, so that the container can + be configured to call this constructor. + + + + + Create a new instance of that looks + for a constructor with the given set of parameters. + + The values for the parameters, that will + be converted to objects. + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Interface registered, ignored in this implementation. + Type to register. + Name used to resolve the type object. + Policy list to add policies to. + + + + An that configures the + container to call a method as part of buildup. + + + + + Create a new instance which will configure + the container to call the given methods with the given parameters. + + Name of the method to call. + Parameter values for the method. + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Type of interface registered, ignored in this implementation. + Type to register. + Name used to resolve the type object. + Policy list to add policies to. + + + + A small function to handle name matching. You can override this + to do things like case insensitive comparisons. + + MethodInfo for the method you're checking. + Name of the method you're looking for. + True if a match, false if not. + + + + A class that holds on to the given value and provides + the required + when the container is configured. + + + + + Create an instance of that stores + the given value, using the runtime type of that value as the + type of the parameter. + + Value to be injected for this parameter. + + + + Create an instance of that stores + the given value, associated with the given type. + + Type of the parameter. + Value of the parameter + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + A generic version of that makes it a + little easier to specify the type of the parameter. + + Type of parameter. + + + + Create a new . + + Value for the parameter. + + + + This class stores information about which properties to inject, + and will configure the container accordingly. + + + + + Configure the container to inject the given property name, + resolving the value via the container. + + Name of the property to inject. + + + + Configure the container to inject the given property name, + using the value supplied. This value is converted to an + object using the + rules defined by the + method. + + Name of property to inject. + Value for property. + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Interface being registered, ignored in this implemenation. + Type to register. + Name used to resolve the type object. + Policy list to add policies to. + + + + A class that stores a type, and generates a + resolver object that resolves all the named instances or the + type registered in a container. + + + + + Construct a new that + resolves to the given element type and collection of element values. + + The type of elements to resolve. + The values for the elements, that will + be converted to objects. + + + + Construct a new that + resolves to the given array and element types and collection of element values. + + The type for the array of elements to resolve. + The type of elements to resolve. + The values for the elements, that will + be converted to objects. + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + A generic version of for convenience + when creating them by hand. + + Type of the elements for the array of the parameter. + + + + Construct a new that + resolves to the given element generic type with the given element values. + + The values for the elements, that will + be converted to objects. + + + + Interface defining the behavior of the Unity dependency injection container. + + + + + Register a type mapping with the container, where the created instances will use + the given . + + that will be requested. + that will actually be returned. + Name to use for registration, null if a default registration. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + Name for registration. + + object that controls how this instance will be managed by the container. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Resolve an instance of the requested type with the given name from the container. + + of object to get from the container. + Name of the object to retrieve. + Any overrides for the resolve call. + The retrieved object. + + + + Return instances of all registered types requested. + + + + This method is useful if you've registered multiple types with the same + but different names. + + + Be aware that this method does NOT return an instance for the default (unnamed) registration. + + + The type requested. + Any overrides for the resolve calls. + Set of objects of type . + + + + Run an existing object through the container and perform injection on it. + + + + This method is useful when you don't control the construction of an + instance (ASP.NET pages or objects created via XAML, for instance) + but you still want properties and other injection performed. + + of object to perform injection on. + Instance to build up. + name to use when looking up the typemappings and other configurations. + Any overrides for the resolve calls. + The resulting object. By default, this will be , but + container extensions may add things like automatic proxy creation which would + cause this to return a different object (but still type compatible with ). + + + + Run an existing object through the container, and clean it up. + + The object to tear down. + + + + Add an extension object to the container. + + to add. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Resolve access to a configuration interface exposed by an extension. + + Extensions can expose configuration interfaces as well as adding + strategies and policies to the container. This method walks the list of + added extensions and returns the first one that implements the requested type. + + of configuration interface required. + The requested extension's configuration interface, or null if not found. + + + + Remove all installed extensions from this container. + + + + This method removes all extensions from the container, including the default ones + that implement the out-of-the-box behavior. After this method, if you want to use + the container again you will need to either readd the default extensions or replace + them with your own. + + + The registered instances and singletons that have already been set up in this container + do not get removed. + + + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Create a child container. + + + A child container shares the parent's configuration, but can be configured with different + settings or lifetime. + The new child container. + + + + The parent of this container. + + The parent container, or null if this container doesn't have one. + + + + Get a sequence of that describe the current state + of the container. + + + + + A that holds a weak reference to + it's managed instance. + + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + + + + Stores the given value into backing store for retrieval later. + + The object being stored. + + + + Remove the given object from backing store. + + + + + An implementation of that + creates instances of the type of the given Lifetime Manager + by resolving them through the container. + + + + + Create a new that will + return instances of the given type, creating them by + resolving through the container. + + Container to resolve with. + Type of LifetimeManager to create. + + + + Create a new instance of . + + The new instance. + + + + The type of Lifetime manager that will be created by this factory. + + + + + A that holds the instances given to it, + keeping one instance per thread. + + + + This LifetimeManager does not dispose the instances it holds. + + + + + + Initializes a new instance of the class. + + + + + Retrieve a value from the backing store associated with this Lifetime policy for the + current thread. + + the object desired, or if no such object is currently + stored for the current thread. + + + + Stores the given value into backing store for retrieval later when requested + in the current thread. + + The object being stored. + + + + Remove the given object from backing store. + + Not implemented for this lifetime manager. + + + + An implementation that does nothing, + thus ensuring that instances are created new every time. + + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + + + + Stores the given value into backing store for retrieval later. + + The object being stored. + + + + Remove the given object from backing store. + + + + + This strategy implements the logic that will call container.ResolveAll + when an array parameter is detected. + + + + + Do the PreBuildUp stage of construction. This is where the actual work is performed. + + Current build context. + + + + An implementation of that is + aware of the build keys used by the Unity container. + + + + + Create a instance for the given + . + + + This implementation looks for the Unity on the + parameter and uses it to create an instance of + for this parameter. + Parameter to create the resolver for. + The resolver object. + + + + An implementation of that is aware + of the build keys used by the Unity container. + + + + + Create a instance for the given + . + + Parameter to create the resolver for. + The resolver object. + + + + An implementation of that is aware of + the build keys used by the unity container. + + + + + Create a for the given + property. + + Property to create resolver for. + The resolver object. + + + + A implementation that returns + the value set in the constructor. + + + + + Create a new instance of + which will return the given value when resolved. + + The value to return. + + + + Get the value for a dependency. + + Current build context. + The value for the dependency. + + + + An implementation of that stores a + type and name, and at resolution time puts them together into a + . + + + + + Create an instance of + with the given type and name. + + The type. + The name (may be null). + + + + Resolve the value for a dependency. + + Current build context. + The value for the dependency. + + + + The type that this resolver resolves. + + + + + The name that this resolver resolves. + + + + + An implementation of that resolves to + to an array populated with the values that result from resolving other instances + of . + + + + + Create an instance of + with the given type and a collection of + instances to use when populating the result. + + The type. + The resolver policies to use when populating an array. + + + + Resolve the value for a dependency. + + Current build context. + An array pupulated with the results of resolving the resolver policies. + + + + An implementation of that selects + the given constructor and creates the appropriate resolvers to call it with + the specified parameters. + + + + + Create an instance of that + will return the given constructor, being passed the given injection values + as parameters. + + The constructor to call. + Set of objects + that describes how to obtain the values for the constructor parameters. + + + + Choose the constructor to call for the given type. + + Current build context + The to add any + generated resolver objects into. + The chosen constructor. + + + + Helper class for implementing selector policies that need to + set up dependency resolver policies. + + + + + Add dependency resolvers to the parameter set. + + Type that's currently being built (used to resolve open generics). + PolicyList to add the resolvers to. + Objects supplying the dependency resolvers. + Result object to store the keys in. + + + + A implementation that calls the specific + methods with the given parameters. + + + + + Add the given method and parameter collection to the list of methods + that will be returned when the selector's + method is called. + + Method to call. + sequence of objects + that describe how to create the method parameter values. + + + + Return the sequence of methods to call while building the target object. + + Current build context. + The to add any + generated resolver objects into. + Sequence of methods to call. + + + + An implemnetation of which returns + the set of specific properties that the selector was configured with. + + + + + Add a property that will be par of the set returned when the + is called. + + The property to set. + object describing + how to create the value to inject. + + + + Returns sequence of properties on the given type that + should be set as part of building that object. + + Current build context. + The to add any + generated resolver objects into. + Sequence of objects + that contain the properties to set. + + + + A class that stores a name and type, and generates a + resolver object that resolves the parameter via the + container. + + + + + Construct a new that + resolves to the given type. + + Type of this parameter. + + + + Construct a new that + resolves the given type and name. + + Type of this parameter. + Name to use when resolving parameter. + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + A generic version of for convenience + when creating them by hand. + + Type of the parameter + + + + Create a new for the given + generic type and the default name. + + + + + Create a new for the given + generic type and name. + + Name to use to resolve this parameter. + + + + An implementation of that wraps a Unity container. + + + + + Initializes a new instance of the class for a container. + + The to wrap with the + interface implementation. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + 2 + + + + When implemented by inheriting classes, this method will do the actual work of resolving + the requested service instance. + + Type of instance requested.Name of registered service you want. May be null. + + The requested service instance. + + + + + When implemented by inheriting classes, this method will do the actual work of + resolving all the requested service instances. + + Type of service requested. + + Sequence of service instance objects. + + + + + A static helper class that includes various parameter checking routines. + + + + + Throws if the given argument is null. + + if tested value if null. + Argument value to test. + Name of the argument being tested. + + + + Throws an exception if the tested string argument is null or the empty string. + + Thrown if string value is null. + Thrown if the string is empty + Argument value to check. + Name of argument being checked. + + + + Verifies that an argument type is assignable from the provided type (meaning + interfaces are implemented, or classes exist in the base class hierarchy). + + The argument type that will be assigned to. + The type of the value being assigned. + Argument name. + + + + Verifies that an argument instance is assignable from the provided type (meaning + interfaces are implemented, or classes exist in the base class hierarchy, or instance can be + assigned through a runtime wrapper, as is the case for COM Objects). + + The argument type that will be assigned to. + The instance that will be assigned. + Argument name. + + + + The build stages we use in the Unity container + strategy pipeline. + + + + + First stage. By default, nothing happens here. + + + + + Second stage. Type mapping occurs here. + + + + + Third stage. lifetime managers are checked here, + and if they're available the rest of the pipeline is skipped. + + + + + Fourth stage. Reflection over constructors, properties, etc. is + performed here. + + + + + Fifth stage. Instance creation happens here. + + + + + Sixth stage. Property sets and method injection happens here. + + + + + Seventh and final stage. By default, nothing happens here. + + + + + 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 The type {0} has multiple constructors of length {1}. Unable to disambiguate.. + + + + + Looks up a localized string similar to The provided string argument must not be empty.. + + + + + Looks up a localized string similar to The current build operation (build key {2}) failed: {3} (Strategy type {0}, index {1}). + + + + + Looks up a localized string similar to The current type, {0}, is an interface and cannot be constructed. Are you missing a type mapping?. + + + + + Looks up a localized string similar to Cannot extract type from build key {0}.. + + + + + Looks up a localized string similar to The method {0}.{1}({2}) is an open generic method. Open generic methods cannot be injected.. + + + + + Looks up a localized string similar to The property {0} on type {1} is an indexer. Indexed properties cannot be injected.. + + + + + Looks up a localized string similar to The method {1} on type {0} has an out parameter. Injection cannot be performed.. + + + + + Looks up a localized string similar to The method {0}.{1}({2}) has at least one out parameter. Methods with out parameters cannot be injected.. + + + + + Looks up a localized string similar to The method {0}.{1}({2}) has at least one ref parameter.Methods with ref parameters cannot be injected.. + + + + + Looks up a localized string similar to The method {1} on type {0} is marked for injection, but it is an open generic method. Injection cannot be performed.. + + + + + Looks up a localized string similar to The method {0}.{1}({2}) is static. Static methods cannot be injected.. + + + + + Looks up a localized string similar to The type {0} is an open generic type. An open generic type cannot be resolved.. + + + + + Looks up a localized string similar to Resolving parameter "{0}" of constructor {1}. + + + + + Looks up a localized string similar to The parameter {0} could not be resolved when attempting to call constructor {1}.. + + + + + Looks up a localized string similar to Parameter type inference does not work for null values. Indicate the parameter type explicitly using a properly configured instance of the InjectionParameter or InjectionParameter<T> classes.. + + + + + Looks up a localized string similar to Calling constructor {0}. + + + + + Looks up a localized string similar to Calling method {0}.{1}. + + + + + Looks up a localized string similar to An item with the given key is already present in the dictionary.. + + + + + Looks up a localized string similar to The lifetime manager is already registered. Lifetime managers cannot be reused, please create a new one.. + + + + + Looks up a localized string similar to The override marker build plan policy has been invoked. This should never happen, looks like a bug in the container.. + + + + + Looks up a localized string similar to Resolving parameter "{0}" of method {1}.{2}. + + + + + Looks up a localized string similar to The value for parameter "{1}" of method {0} could not be resolved. . + + + + + Looks up a localized string similar to Could not resolve dependency for build key {0}.. + + + + + Looks up a localized string similar to The type {0} has multiple constructors marked with the InjectionConstructor attribute. Unable to disambiguate.. + + + + + Looks up a localized string similar to The supplied type {0} must be an open generic type.. + + + + + Looks up a localized string similar to The supplied type {0} does not have the same number of generic arguments as the target type {1}.. + + + + + Looks up a localized string similar to The type {0} does not have an accessible constructor.. + + + + + Looks up a localized string similar to The type {0} does not have a generic argument named "{1}". + + + + + Looks up a localized string similar to while resolving. + + + + + Looks up a localized string similar to The type {0} does not have a constructor that takes the parameters ({1}).. + + + + + Looks up a localized string similar to The type {0} does not have a public method named {1} that takes the parameters ({2}).. + + + + + Looks up a localized string similar to The type {0} does not contain an instance property named {1}.. + + + + + Looks up a localized string similar to The type {0} is not a generic type, and you are attempting to inject a generic parameter named "{1}".. + + + + + Looks up a localized string similar to The type {0} is not an array type with rank 1, and you are attempting to use a [DependencyArray] attribute on a parameter or property with this type.. + + + + + Looks up a localized string similar to Optional dependencies must be reference types. The type {0} is a value type.. + + + + + Looks up a localized string similar to The property {0} on type {1} is not settable.. + + + + + Looks up a localized string similar to The property {0} on type {1} is of type {2}, and cannot be injected with a value of type {3}.. + + + + + Looks up a localized string similar to The value for the property "{0}" could not be resolved.. + + + + + Looks up a localized string similar to The provided string argument must not be empty.. + + + + + Looks up a localized string similar to Resolution of the dependency failed, type = "{0}", name = "{1}". + Exception occurred while: {2}. + Exception is: {3} - {4} + ----------------------------------------------- + At the time of the exception, the container was: + . + + + + + Looks up a localized string similar to Resolving {0},{1}. + + + + + Looks up a localized string similar to Resolving {0},{1} (mapped from {2}, {3}). + + + + + Looks up a localized string similar to Resolving value for property {0}.{1}. + + + + + Looks up a localized string similar to The constructor {1} selected for type {0} has ref or out parameters. Such parameters are not supported for constructor injection.. + + + + + Looks up a localized string similar to Setting value for property {0}.{1}. + + + + + Looks up a localized string similar to The type {0} cannot be constructed. You must configure the container to supply this value.. + + + + + Looks up a localized string similar to The type {1} cannot be assigned to variables of type {0}.. + + + + + Looks up a localized string similar to <unknown>. + + + + + A simple, extensible dependency injection container. + + + + + Create a default . + + + + + Create a with the given parent container. + + The parent . The current object + will apply its own settings first, and then check the parent for additional ones. + + + + RegisterType a type mapping with the container, where the created instances will use + the given . + + that will be requested. + that will actually be returned. + Name to use for registration, null if a default registration. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + RegisterType an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + Name for registration. + + If true, the container will take over the lifetime of the instance, + calling Dispose on it (if it's ) when the container is Disposed. + + If false, container will not maintain a strong reference to . User is reponsible + for disposing instance, and for keeping the instance from being garbage collected. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Get an instance of the requested type with the given name from the container. + + of object to get from the container. + Name of the object to retrieve. + Any overrides for the resolve call. + The retrieved object. + + + + Return instances of all registered types requested. + + + + This method is useful if you've registered multiple types with the same + but different names. + + + Be aware that this method does NOT return an instance for the default (unnamed) registration. + + + The type requested. + Any overrides for the resolve calls. + Set of objects of type . + + + + Run an existing object through the container and perform injection on it. + + + + This method is useful when you don't control the construction of an + instance (ASP.NET pages or objects created via XAML, for instance) + but you still want properties and other injection performed. + + of object to perform injection on. + Instance to build up. + name to use when looking up the typemappings and other configurations. + Any overrides for the buildup. + The resulting object. By default, this will be , but + container extensions may add things like automatic proxy creation which would + cause this to return a different object (but still type compatible with ). + + + + Run an existing object through the container, and clean it up. + + The object to tear down. + + + + Add an extension object to the container. + + to add. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Get access to a configuration interface exposed by an extension. + + Extensions can expose configuration interfaces as well as adding + strategies and policies to the container. This method walks the list of + added extensions and returns the first one that implements the requested type. + + of configuration interface required. + The requested extension's configuration interface, or null if not found. + + + + Remove all installed extensions from this container. + + + + This method removes all extensions from the container, including the default ones + that implement the out-of-the-box behavior. After this method, if you want to use + the container again you will need to either readd the default extensions or replace + them with your own. + + + The registered instances and singletons that have already been set up in this container + do not get removed. + + + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Create a child container. + + + A child container shares the parent's configuration, but can be configured with different + settings or lifetime. + The new child container. + + + + Dispose this container instance. + + + Disposing the container also disposes any child containers, + and disposes any instances whose lifetimes are managed + by the container. + + + + + Dispose this container instance. + + + This class doesn't have a finalizer, so will always be true. + True if being called from the IDisposable.Dispose + method, false if being called from a finalizer. + + + + Remove policies associated with building this type. This removes the + compiled build plan so that it can be rebuilt with the new settings + the next time this type is resolved. + + Type of object to clear the plan for. + Name the object is being registered with. + + + + The parent of this container. + + The parent container, or null if this container doesn't have one. + + + + Get a sequence of that describe the current state + of the container. + + + + + Implementation of the ExtensionContext that is actually used + by the UnityContainer implementation. + + + This is a nested class so that it can access state in the + container that would otherwise be inaccessible. + + + + + This event is raised when the method, + or one of its overloads, is called. + + + + + This extension supplies the default behavior of the UnityContainer API + by handling the context events and setting policies. + + + + + Install the default container behavior into the container. + + + + + Remove the default behavior from the container. + + + + + Helper class to wrap common reflection stuff dealing with + methods. + + + + + Create a new instance that + lets us do more reflection stuff on that method. + + The method to reflect on. + + + + Given our set of generic type arguments, + + The generic type arguments. + An array with closed parameter types. + + + + Returns true if any of the parameters of this method + are open generics. + + + + + Return the of each parameter for this + method. + + Sequence of objects, one for + each parameter in order. + + + + A helper class that encapsulates two different + data items together into a a single item. + + + + + Create a new containing + the two values give. + + First value + Second value + + + + The first value of the pair. + + + + + The second value of the pair. + + + + + Container for a Pair helper method. + + + + + A helper factory method that lets users take advantage of type inference. + + Type of first value. + Type of second value. + First value. + Second value. + A new instance. + + + + A utility class that handles the logic of matching parameter + lists, so we can find the right constructor and method overloads. + + + + + Create a new that will attempt to + match the given parameter types. + + Target parameters to match against. + + + + Tests to see if the given set of types matches the ones + we're looking for. + + parameter list to look for. + true if they match, false if they don't. + + + + Tests to see if the given set of types matches the ones we're looking for. + + Candidate method signature to look for. + True if they match, false if they don't. + + + + Another reflection helper class that has extra methods + for dealing with ParameterInfos. + + + + + A small helper class to encapsulate details of the + reflection API, particularly around generics. + + + + + Create a new instance that + lets you look at information about the given type. + + Type to do reflection on. + + + + Test the given object, looking at + the parameters. Determine if any of the parameters are + open generic types that need type attributes filled in. + + The method to check. + True if any of the parameters are open generics. False if not. + + + + If this type is an open generic, use the + given array to + determine what the required closed type is and return that. + + If the parameter is not an open type, just + return this parameter's type. + Type arguments to substitute in for + the open type parameters. + Corresponding closed type of this parameter. + + + + Given a generic argument name, return the corresponding type for this + closed type. For example, if the current type is SomeType<User>, and the + corresponding definition was SomeType<TSomething>, calling this method + and passing "TSomething" will return typeof(User). + + Name of the generic parameter. + Type of the corresponding generic parameter, or null if there + is no matching name. + + + + The object we're reflecting over. + + + + + Is this type generic? + + + + + Is this type an open generic (no type parameter specified) + + + + + Is this type an array type? + + + + + Is this type an array of generic elements? + + + + + The type of the elements in this type (if it's an array). + + + + + Create a new instance of that + lets you query information about the given ParameterInfo object. + + Parameter to query. + + + + A set of helper methods to pick through lambdas and pull out + from them. + + + + + Pull out a object from an expression of the form + () => SomeClass.SomeMethod() + + Expression describing the method to call. + Corresponding . + + + + Pull out a object from an expression of the form + x => x.SomeMethod() + + The type where the method is defined. + Expression describing the method to call. + Corresponding . + + + + Pull out a object for the get method from an expression of the form + x => x.SomeProperty + + The type where the method is defined. + The type for the property. + Expression describing the property for which the get method is to be extracted. + Corresponding . + + + + Pull out a object for the set method from an expression of the form + x => x.SomeProperty + + The type where the method is defined. + The type for the property. + Expression describing the property for which the set method is to be extracted. + Corresponding . + + + + Pull out a object from an expression of the form () => new SomeType() + + The type where the constructor is defined. + Expression invoking the desired constructor. + Corresponding . + + + diff --git a/packages/Unity.2.0/lib/SL30/Microsoft.Practices.ServiceLocation.dll b/packages/Unity.2.0/lib/SL30/Microsoft.Practices.ServiceLocation.dll new file mode 100644 index 000000000..fa752370c Binary files /dev/null and b/packages/Unity.2.0/lib/SL30/Microsoft.Practices.ServiceLocation.dll differ diff --git a/packages/Unity.2.0/lib/SL30/Microsoft.Practices.Unity.Silverlight.dll b/packages/Unity.2.0/lib/SL30/Microsoft.Practices.Unity.Silverlight.dll new file mode 100644 index 000000000..0ce1d2818 Binary files /dev/null and b/packages/Unity.2.0/lib/SL30/Microsoft.Practices.Unity.Silverlight.dll differ diff --git a/packages/Unity.2.0/lib/SL30/Microsoft.Practices.Unity.Silverlight.xml b/packages/Unity.2.0/lib/SL30/Microsoft.Practices.Unity.Silverlight.xml new file mode 100644 index 000000000..37c7a1172 --- /dev/null +++ b/packages/Unity.2.0/lib/SL30/Microsoft.Practices.Unity.Silverlight.xml @@ -0,0 +1,5871 @@ + + + + Microsoft.Practices.Unity.Silverlight + + + + + This attribute is used to mark properties and parameters as targets for injection. + + + For properties, this attribute is necessary for injection to happen. For parameters, + it's not needed unless you want to specify additional information to control how + the parameter is resolved. + + + + + Base class for attributes that can be placed on parameters + or properties to specify how to resolve the value for + that parameter or property. + + + + + Create an instance of that + will be used to get the value for the member this attribute is + applied to. + + Type of parameter or property that + this attribute is decoration. + The resolver object. + + + + Create an instance of with no name. + + + + + Create an instance of with the given name. + + Name to use when resolving this dependency. + + + + Create an instance of that + will be used to get the value for the member this attribute is + applied to. + + Type of parameter or property that + this attribute is decoration. + The resolver object. + + + + The name specified in the constructor. + + + + + This attribute is used to indicate which constructor to choose when + the container attempts to build a type. + + + + + This attribute is used to mark methods that should be called when + the container is building an object. + + + + + An used to mark a dependency + as optional - the container will try to resolve it, and return null + if the resolution fails rather than throw. + + + + + Construct a new object. + + + + + Construct a new object that + specifies a named dependency. + + Name of the dependency. + + + + Create an instance of that + will be used to get the value for the member this attribute is + applied to. + + Type of parameter or property that + this attribute is decoration. + The resolver object. + + + + Name of the dependency. + + + + + A that composites other + ResolverOverride objects. The GetResolver operation then + returns the resolver from the first child override that + matches the current context and request. + + + + + Base class for all override objects passed in the + method. + + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + Wrap this resolver in one that verifies the type of the object being built. + This allows you to narrow any override down to a specific type easily. + + Type to constrain the override to. + The new override. + + + + Wrap this resolver in one that verifies the type of the object being built. + This allows you to narrow any override down to a specific type easily. + + Type to constrain the override to. + The new override. + + + + Add a new to the collection + that is checked. + + item to add. + + + + Add a setof s to the collection. + + items to add. + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + 2 + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + 1 + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + Class that returns information about the types registered in a container. + + + + + The type that was passed to the method + as the "from" type, or the only type if type mapping wasn't done. + + + + + The type that this registration is mapped to. If no type mapping was done, the + property and this one will have the same value. + + + + + Name the type was registered under. Null for default registration. + + + + + The registered lifetime manager instance. + + + + + The lifetime manager for this registration. + + + This property will be null if this registration is for an open generic. + + + + A class that overrides + the value injected whenever there is a dependency of the + given type, regardless of where it appears in the object graph. + + + + + Create an instance of to override + the given type with the given value. + + Type of the dependency. + Value to use. + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + A convenience version of that lets you + specify the dependency type using generic syntax. + + Type of the dependency to override. + + + + Construct a new object that will + override the given dependency, and pass the given value. + + + + + A convenience form of that lets you + specify multiple parameter overrides in one shot rather than having + to construct multiple objects. + + + This class isn't really a collection, it just implements IEnumerable + so that we get use of the nice C# collection initializer syntax. + + + + + Base helper class for creating collections of objects + for use in passing a bunch of them to the resolve call. This base class provides + the mechanics needed to allow you to use the C# collection initializer syntax. + + Concrete type of the this class collects. + Key used to create the underlying override object. + Value that the override returns. + + + + Add a new override to the collection with the given key and value. + + Key - for example, a parameter or property name. + Value - the value to be returned by the override. + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + 2 + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + 1 + + + + When implemented in derived classes, this method is called from the + method to create the actual objects. + + Key value to create the resolver. + Value to store in the resolver. + The created . + + + + When implemented in derived classes, this method is called from the + method to create the actual objects. + + Key value to create the resolver. + Value to store in the resolver. + The created . + + + + Event argument class for the event. + + + + + Construct a new object with the + given child container object. + + An for the newly created child + container. + + + + The newly created child container. + + + + + An extension context for the created child container. + + + + + The class provides the means for extension objects + to manipulate the internal state of the . + + + + + Store a type/name pair for later resolution. + + + + When users register type mappings (or other things) with a named key, this method + allows you to register that name with the container so that when the + method is called, that name is included in the list that is returned. + + to register. + Name assocated with that type. + + + + The container that this context is associated with. + + The object. + + + + The strategies this container uses. + + The that the container uses to build objects. + + + + The strategies this container uses to construct build plans. + + The that this container uses when creating + build plans. + + + + The policies this container uses. + + The the that container uses to build objects. + + + + The that this container uses. + + The is used to manage objects that the container is managing. + + + + This event is raised when the method, + or one of its overloads, is called. + + + + + This event is raised when the method, + or one of its overloads, is called. + + + + + This event is raised when the method is called, providing + the newly created child container to extensions to act on as they see fit. + + + + + Base interface for all extension configuration interfaces. + + + + + Retrieve the container instance that we are currently configuring. + + + + + An EventArgs class that holds a string Name. + + + + + Create a new with a null name. + + + + + Create a new with the given name. + + Name to store. + + + + The name. + + Name used for this event arg object. + + + + Event argument class for the event. + + + + + Create a new instance of . + + Type to map from. + Type to map to. + Name for the registration. + to manage instances. + + + + Type to map from. + + + + + Type to map to. + + + + + to manage instances. + + + + + Event argument class for the event. + + + + + Create a default instance. + + + + + Create a instance initialized with the given arguments. + + Type of instance being registered. + The instance object itself. + Name to register under, null if default registration. + object that handles how + the instance will be owned. + + + + Type of instance being registered. + + + Type of instance being registered. + + + + + Instance object being registered. + + Instance object being registered + + + + that controls ownership of + this instance. + + + + + Base class for all extension objects. + + + + + The container calls this method when the extension is added. + + A instance that gives the + extension access to the internals of the container. + + + + Initial the container with this extension's functionality. + + + When overridden in a derived class, this method will modify the given + by adding strategies, policies, etc. to + install it's functions into the container. + + + + Removes the extension's functions from the container. + + + + This method is called when extensions are being removed from the container. It can be + used to do things like disconnect event handlers or clean up member state. You do not + need to remove strategies or policies here; the container will do that automatically. + + + The default implementation of this method does nothing. + + + + + The container this extension has been added to. + + The that this extension has been added to. + + + + The object used to manipulate + the inner state of the container. + + + + + A that lets you specify that + an instance of a generic type parameter should be resolved. + + + + + Base class for subclasses that let you specify that + an instance of a generic type parameter should be resolved. + + + + + Base type for objects that are used to configure parameters for + constructor or method injection, or for getting the value to + be injected into a property. + + + + + Test to see if this parameter value has a matching type for the given type. + + Type to check. + True if this parameter value is compatible with type , + false if not. + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + Convert the given set of arbitrary values to a sequence of InjectionParameterValue + objects. The rules are: If it's already an InjectionParameterValue, return it. If + it's a Type, return a ResolvedParameter object for that type. Otherwise return + an InjectionParameter object for that value. + + The values to build the sequence from. + The resulting converted sequence. + + + + Convert an arbitrary value to an InjectionParameterValue object. The rules are: + If it's already an InjectionParameterValue, return it. If it's a Type, return a + ResolvedParameter object for that type. Otherwise return an InjectionParameter + object for that value. + + The value to convert. + The resulting . + + + + Name for the type represented by this . + This may be an actual type name or a generic argument name. + + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + name to use when looking up in the container. + + + + Test to see if this parameter value has a matching type for the given type. + + Type to check. + True if this parameter value is compatible with type , + false if not. + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + Return a instance that will + return this types value for the parameter. + + The actual type to resolve. + The resolution key. + The . + + + + Name for the type represented by this . + This may be an actual type name or a generic argument name. + + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + name to use when looking up in the container. + + + + Return a instance that will + return this types value for the parameter. + + The actual type to resolve. + The resolution key. + The . + + + + A that lets you specify that + an array containing the registered instances of a generic type parameter + should be resolved. + + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + The values for the elements, that will + be converted to objects. + + + + Test to see if this parameter value has a matching type for the given type. + + Type to check. + True if this parameter value is compatible with type , + false if not. + A type is considered compatible if it is an array type of rank one + and its element type is a generic type parameter with a name matching this generic + parameter name configured for the receiver. + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + Name for the type represented by this . + This may be an actual type name or a generic argument name. + + + + + A Unity container extension that allows you to configure + which constructors, properties, and methods get injected + via an API rather than through attributes. + + + + + Initial the container with this extension's functionality. + + + When overridden in a derived class, this method will modify the given + by adding strategies, policies, etc. to + install it's functions into the container. + + + + API to configure the injection settings for a particular type. + + Type the injection is being configured for. + Objects containing the details on which members to inject and how. + This extension object. + + + + API to configure the injection settings for a particular type/name pair. + + Type the injection is being configured for. + Name of registration + Objects containing the details on which members to inject and how. + This extension object. + + + + API to configure the injection settings for a particular type. + + Type to configure. + Objects containing the details on which members to inject and how. + This extension object. + + + + API to configure the injection settings for a particular type/name pair. + + Type to configure. + Name of registration. + Objects containing the details on which members to inject and how. + This extension object. + + + + API to configure the injection settings for a particular type/name pair. + + Type of interface/base class being registered (may be null). + Type of actual implementation class being registered. + Name of registration. + Objects containing the details on which members to inject and how. + This extension object. + + + + A class that holds the collection of information + for a constructor, so that the container can + be configured to call this constructor. + + + + + Base class for objects that can be used to configure what + class members get injected by the container. + + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Type to register. + Policy list to add policies to. + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Type of interface being registered. If no interface, + this will be null. + Type of concrete type being registered. + Name used to resolve the type object. + Policy list to add policies to. + + + + Create a new instance of that looks + for a constructor with the given set of parameters. + + The values for the parameters, that will + be converted to objects. + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Interface registered, ignored in this implementation. + Type to register. + Name used to resolve the type object. + Policy list to add policies to. + + + + A class that lets you specify a factory method the container + will use to create the object. + + This is a significantly easier way to do the same + thing the old static factory extension was used for. + + + + Create a new instance of with + the given factory function. + + Factory function. + + + + Create a new instance of with + the given factory function. + + Factory function. + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Type of interface being registered. If no interface, + this will be null. This parameter is ignored in this implementation. + Type of concrete type being registered. + Name used to resolve the type object. + Policy list to add policies to. + + + + An that configures the + container to call a method as part of buildup. + + + + + Create a new instance which will configure + the container to call the given methods with the given parameters. + + Name of the method to call. + Parameter values for the method. + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Type of interface registered, ignored in this implementation. + Type to register. + Name used to resolve the type object. + Policy list to add policies to. + + + + A small function to handle name matching. You can override this + to do things like case insensitive comparisons. + + MethodInfo for the method you're checking. + Name of the method you're looking for. + True if a match, false if not. + + + + A class that holds on to the given value and provides + the required + when the container is configured. + + + + + A base class for implementing classes + that deal in explicit types. + + + + + Create a new that exposes + information about the given . + + Type of the parameter. + + + + Test to see if this parameter value has a matching type for the given type. + + Type to check. + True if this parameter value is compatible with type , + false if not. + + + + The type of parameter this object represents. + + + + + Name for the type represented by this . + This may be an actual type name or a generic argument name. + + + + + Create an instance of that stores + the given value, using the runtime type of that value as the + type of the parameter. + + Value to be injected for this parameter. + + + + Create an instance of that stores + the given value, associated with the given type. + + Type of the parameter. + Value of the parameter + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + A generic version of that makes it a + little easier to specify the type of the parameter. + + Type of parameter. + + + + Create a new . + + Value for the parameter. + + + + This class stores information about which properties to inject, + and will configure the container accordingly. + + + + + Configure the container to inject the given property name, + resolving the value via the container. + + Name of the property to inject. + + + + Configure the container to inject the given property name, + using the value supplied. This value is converted to an + object using the + rules defined by the + method. + + Name of property to inject. + Value for property. + + + + Add policies to the to configure the + container to call this constructor with the appropriate parameter values. + + Interface being registered, ignored in this implemenation. + Type to register. + Name used to resolve the type object. + Policy list to add policies to. + + + + A that lets you specify that + an instance of a generic type parameter should be resolved, providing the + value if resolving fails. + + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + + + + Create a new instance that specifies + that the given named generic parameter should be resolved. + + The generic parameter name to resolve. + name to use when looking up in the container. + + + + Return a instance that will + return this types value for the parameter. + + The actual type to resolve. + The resolution key. + The . + + + + A that can be passed to + to configure a + parameter or property as an optional dependency. + + + + + Construct a new object that + specifies the given . + + Type of the dependency. + + + + Construct a new object that + specifies the given and . + + Type of the dependency. + Name for the dependency. + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + A generic version of that lets you + specify the type of the dependency using generics syntax. + + Type of the dependency. + + + + Construct a new . + + + + + Construct a new with the given + . + + Name of the dependency. + + + + A class that stores a type, and generates a + resolver object that resolves all the named instances or the + type registered in a container. + + + + + Construct a new that + resolves to the given element type and collection of element values. + + The type of elements to resolve. + The values for the elements, that will + be converted to objects. + + + + Construct a new that + resolves to the given array and element types and collection of element values. + + The type for the array of elements to resolve. + The type of elements to resolve. + The values for the elements, that will + be converted to objects. + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + A generic version of for convenience + when creating them by hand. + + Type of the elements for the array of the parameter. + + + + Construct a new that + resolves to the given element generic type with the given element values. + + The values for the elements, that will + be converted to objects. + + + + A class that stores a name and type, and generates a + resolver object that resolves the parameter via the + container. + + + + + Construct a new that + resolves to the given type. + + Type of this parameter. + + + + Construct a new that + resolves the given type and name. + + Type of this parameter. + Name to use when resolving parameter. + + + + Return a instance that will + return this types value for the parameter. + + Type that contains the member that needs this parameter. Used + to resolve open generic parameters. + The . + + + + A generic version of for convenience + when creating them by hand. + + Type of the parameter + + + + Create a new for the given + generic type and the default name. + + + + + Create a new for the given + generic type and name. + + Name to use to resolve this parameter. + + + + Interface defining the behavior of the Unity dependency injection container. + + + + + Register a type mapping with the container, where the created instances will use + the given . + + that will be requested. + that will actually be returned. + Name to use for registration, null if a default registration. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + Name for registration. + + object that controls how this instance will be managed by the container. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Resolve an instance of the requested type with the given name from the container. + + of object to get from the container. + Name of the object to retrieve. + Any overrides for the resolve call. + The retrieved object. + + + + Return instances of all registered types requested. + + + + This method is useful if you've registered multiple types with the same + but different names. + + + Be aware that this method does NOT return an instance for the default (unnamed) registration. + + + The type requested. + Any overrides for the resolve calls. + Set of objects of type . + + + + Run an existing object through the container and perform injection on it. + + + + This method is useful when you don't control the construction of an + instance (ASP.NET pages or objects created via XAML, for instance) + but you still want properties and other injection performed. + + of object to perform injection on. + Instance to build up. + name to use when looking up the typemappings and other configurations. + Any overrides for the resolve calls. + The resulting object. By default, this will be , but + container extensions may add things like automatic proxy creation which would + cause this to return a different object (but still type compatible with ). + + + + Run an existing object through the container, and clean it up. + + The object to tear down. + + + + Add an extension object to the container. + + to add. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Resolve access to a configuration interface exposed by an extension. + + Extensions can expose configuration interfaces as well as adding + strategies and policies to the container. This method walks the list of + added extensions and returns the first one that implements the requested type. + + of configuration interface required. + The requested extension's configuration interface, or null if not found. + + + + Remove all installed extensions from this container. + + + + This method removes all extensions from the container, including the default ones + that implement the out-of-the-box behavior. After this method, if you want to use + the container again you will need to either readd the default extensions or replace + them with your own. + + + The registered instances and singletons that have already been set up in this container + do not get removed. + + + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Create a child container. + + + A child container shares the parent's configuration, but can be configured with different + settings or lifetime. + The new child container. + + + + The parent of this container. + + The parent container, or null if this container doesn't have one. + + + + Get a sequence of that describe the current state + of the container. + + + + + A that holds onto the instance given to it. + When the is disposed, + the instance is disposed with it. + + + + + Base class for Lifetime managers which need to synchronize calls to + . + + + + The purpose of this class is to provide a basic implementation of the lifetime manager synchronization pattern. + + + Calls to the method of a + instance acquire a lock, and if the instance has not been initialized with a value yet the lock will only be released + when such an initialization takes place by calling the method or if + the build request which resulted in the call to the GetValue method fails. + + + + + + + Base class for Lifetime managers - classes that control how + and when instances are created by the Unity container. + + + + + A that controls how instances are + persisted and recovered from an external store. Used to implement + things like singletons and per-http-request lifetime. + + + + + Represents a builder policy interface. Since there are no fixed requirements + for policies, it acts as a marker interface from which to derive all other + policy interfaces. + + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + + + + Stores the given value into backing store for retrieval later. + + The object to store. + + + + Remove the value this lifetime policy is managing from backing store. + + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + + + + Stores the given value into backing store for retrieval later. + + The object being stored. + + + + Remove the given object from backing store. + + + + + This interface provides a hook for the builder context to + implement error recovery when a builder strategy throws + an exception. Since we can't get try/finally blocks onto + the call stack for later stages in the chain, we instead + add these objects to the context. If there's an exception, + all the current IRequiresRecovery instances will have + their Recover methods called. + + + + + A method that does whatever is needed to clean up + as part of cleaning up after an exception. + + + Don't do anything that could throw in this method, + it will cause later recover operations to get skipped + and play real havoc with the stack trace. + + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + Calls to this method acquire a lock which is released only if a non-null value + has been set for the lifetime manager. + + + + Performs the actual retrieval of a value from the backing store associated + with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + This method is invoked by + after it has acquired its lock. + + + + Stores the given value into backing store for retrieval later. + + The object being stored. + Setting a value will attempt to release the lock acquired by + . + + + + Performs the actual storage of the given value into backing store for retrieval later. + + The object being stored. + This method is invoked by + before releasing its lock. + + + + Remove the given object from backing store. + + + + + A method that does whatever is needed to clean up + as part of cleaning up after an exception. + + + Don't do anything that could throw in this method, + it will cause later recover operations to get skipped + and play real havoc with the stack trace. + + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + + + + Stores the given value into backing store for retrieval later. + + The object being stored. + + + + Remove the given object from backing store. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + 2 + + + + Standard Dispose pattern implementation. Not needed, but it keeps FxCop happy. + + Always true, since we don't have a finalizer. + + + + A that holds a weak reference to + it's managed instance. + + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + + + + Stores the given value into backing store for retrieval later. + + The object being stored. + + + + Remove the given object from backing store. + + + + + A special lifetime manager which works like , + except that in the presence of child containers, each child gets it's own instance + of the object, instead of sharing one in the common parent. + + + + + An implementation of that + creates instances of the type of the given Lifetime Manager + by resolving them through the container. + + + + + A builder policy used to create lifetime policy instances. + Used by the LifetimeStrategy when instantiating open + generic types. + + + + + Create a new instance of . + + The new instance. + + + + The type of Lifetime manager that will be created by this factory. + + + + + Create a new that will + return instances of the given type, creating them by + resolving through the container. + + Container to resolve with. + Type of LifetimeManager to create. + + + + Create a new instance of . + + The new instance. + + + + The type of Lifetime manager that will be created by this factory. + + + + + This is a custom lifetime manager that acts like , + but also provides a signal to the default build plan, marking the type so that + instances are reused across the build up object graph. + + + + + Construct a new object that does not + itself manage an instance. + + + + + Construct a new object that stores the + give value. This value will be returned by + but is not stored in the lifetime manager, nor is the value disposed. + This Lifetime manager is intended only for internal use, which is why the + normal method is not used here. + + Value to store. + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + + + + Stores the given value into backing store for retrieval later. In this class, + this is a noop, since it has special hooks down in the guts. + + The object being stored. + + + + Remove the given object from backing store. Noop in this class. + + + + + A that holds the instances given to it, + keeping one instance per thread. + + + + This LifetimeManager does not dispose the instances it holds. + + + + + + Initializes a new instance of the class. + + + + + Retrieve a value from the backing store associated with this Lifetime policy for the + current thread. + + the object desired, or if no such object is currently + stored for the current thread. + + + + Stores the given value into backing store for retrieval later when requested + in the current thread. + + The object being stored. + + + + Remove the given object from backing store. + + Not implemented for this lifetime manager. + + + + An implementation that does nothing, + thus ensuring that instances are created new every time. + + + + + Retrieve a value from the backing store associated with this Lifetime policy. + + the object desired, or null if no such object is currently stored. + + + + Stores the given value into backing store for retrieval later. + + The object being stored. + + + + Remove the given object from backing store. + + + + + This strategy implements the logic that will call container.ResolveAll + when an array parameter is detected. + + + + + Represents a strategy in the chain of responsibility. + Strategies are required to support both BuildUp and TearDown. + + + + + Represents a strategy in the chain of responsibility. + Strategies are required to support both BuildUp and TearDown. Although you + can implement this interface directly, you may also choose to use + as the base class for your strategies, as + this class provides useful helper methods and makes support BuildUp and TearDown + optional. + + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + Context of the build operation. + + + + Called during the chain of responsibility for a build operation. The + PostBuildUp method is called when the chain has finished the PreBuildUp + phase and executes in reverse order from the PreBuildUp calls. + + Context of the build operation. + + + + Called during the chain of responsibility for a teardown operation. The + PreTearDown method is called when the chain is being executed in the + forward direction. + + Context of the teardown operation. + + + + Called during the chain of responsibility for a teardown operation. The + PostTearDown method is called when the chain has finished the PreTearDown + phase and executes in reverse order from the PreTearDown calls. + + Context of the teardown operation. + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + Context of the build operation. + + + + Called during the chain of responsibility for a build operation. The + PostBuildUp method is called when the chain has finished the PreBuildUp + phase and executes in reverse order from the PreBuildUp calls. + + Context of the build operation. + + + + Called during the chain of responsibility for a teardown operation. The + PreTearDown method is called when the chain is being executed in the + forward direction. + + Context of the teardown operation. + + + + Called during the chain of responsibility for a teardown operation. The + PostTearDown method is called when the chain has finished the PreTearDown + phase and executes in reverse order from the PreTearDown calls. + + Context of the teardown operation. + + + + Do the PreBuildUp stage of construction. This is where the actual work is performed. + + Current build context. + + + + An implementation of that is + aware of the build keys used by the Unity container. + + + + + Base class that provides an implementation of + which lets you override how the parameter resolvers are created. + + + + + A that, when implemented, + will determine which constructor to call from the build plan. + + + + + Choose the constructor to call for the given type. + + Current build context + The to add any + generated resolver objects into. + The chosen constructor. + + + + Choose the constructor to call for the given type. + + Current build context + The to add any + generated resolver objects into. + The chosen constructor. + + + + Create a instance for the given + . + + Parameter to create the resolver for. + The resolver object. + + + + Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. + + + + Value Condition Less than zerox is less than y.Zerox equals y.Greater than zerox is greater than y. + + + The second object to compare. + The first object to compare. + + + + Create a instance for the given + . + + + This implementation looks for the Unity on the + parameter and uses it to create an instance of + for this parameter. + Parameter to create the resolver for. + The resolver object. + + + + An implementation of that is aware + of the build keys used by the Unity container. + + + + + Base class that provides an implementation of + which lets you override how the parameter resolvers are created. + + Attribute that marks methods that should + be called. + + + + An that will examine the given + types and return a sequence of objects + that should be called as part of building the object. + + + + + Return the sequence of methods to call while building the target object. + + Current build context. + The to add any + generated resolver objects into. + Sequence of methods to call. + + + + Return the sequence of methods to call while building the target object. + + Current build context. + The to add any + generated resolver objects into. + Sequence of methods to call. + + + + Create a instance for the given + . + + Parameter to create the resolver for. + The resolver object. + + + + Create a instance for the given + . + + Parameter to create the resolver for. + The resolver object. + + + + An implementation of that is aware of + the build keys used by the unity container. + + + + + Base class that provides an implementation of + which lets you override how the parameter resolvers are created. + + + + + An that returns a sequence + of properties that should be injected for the given type. + + + + + Returns sequence of properties on the given type that + should be set as part of building that object. + + Current build context. + The to add any + generated resolver objects into. + Sequence of objects + that contain the properties to set. + + + + Returns sequence of properties on the given type that + should be set as part of building that object. + + Current build context. + The to add any + generated resolver objects into. + Sequence of objects + that contain the properties to set. + + + + Create a for the given + property. + + Property to create resolver for. + The resolver object. + + + + Create a for the given + property. + + Property to create resolver for. + The resolver object. + + + + A strategy that handles Hierarchical lifetimes across a set of parent/child + containers. + + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + Context of the build operation. + + + + A implementation that returns + the value set in the constructor. + + + + + A that is used at build plan execution time + to resolve a dependent value. + + + + + Get the value for a dependency. + + Current build context. + The value for the dependency. + + + + Create a new instance of + which will return the given value when resolved. + + The value to return. + + + + Get the value for a dependency. + + Current build context. + The value for the dependency. + + + + An implementation of that stores a + type and name, and at resolution time puts them together into a + . + + + + + Create an instance of + with the given type and name. + + The type. + The name (may be null). + + + + Resolve the value for a dependency. + + Current build context. + The value for the dependency. + + + + The type that this resolver resolves. + + + + + The name that this resolver resolves. + + + + + A that will attempt to + resolve a value, and return null if it cannot rather than throwing. + + + + + Construct a new object + that will attempt to resolve the given name and type from the container. + + Type to resolve. Must be a reference type. + Name to resolve with. + + + + Construct a new object + that will attempt to resolve the given type from the container. + + Type to resolve. Must be a reference type. + + + + Get the value for a dependency. + + Current build context. + The value for the dependency. + + + + Type this resolver will resolve. + + + + + Name this resolver will resolve. + + + + + An implementation of that resolves to + to an array populated with the values that result from resolving other instances + of . + + + + + Create an instance of + with the given type and a collection of + instances to use when populating the result. + + The type. + The resolver policies to use when populating an array. + + + + Resolve the value for a dependency. + + Current build context. + An array pupulated with the results of resolving the resolver policies. + + + + An implementation of that selects + the given constructor and creates the appropriate resolvers to call it with + the specified parameters. + + + + + Create an instance of that + will return the given constructor, being passed the given injection values + as parameters. + + The constructor to call. + Set of objects + that describes how to obtain the values for the constructor parameters. + + + + Choose the constructor to call for the given type. + + Current build context + The to add any + generated resolver objects into. + The chosen constructor. + + + + Helper class for implementing selector policies that need to + set up dependency resolver policies. + + + + + Add dependency resolvers to the parameter set. + + Type that's currently being built (used to resolve open generics). + PolicyList to add the resolvers to. + Objects supplying the dependency resolvers. + Result object to store the keys in. + + + + A implementation that calls the specific + methods with the given parameters. + + + + + Add the given method and parameter collection to the list of methods + that will be returned when the selector's + method is called. + + Method to call. + sequence of objects + that describe how to create the method parameter values. + + + + Return the sequence of methods to call while building the target object. + + Current build context. + The to add any + generated resolver objects into. + Sequence of methods to call. + + + + An implemnetation of which returns + the set of specific properties that the selector was configured with. + + + + + Add a property that will be par of the set returned when the + is called. + + The property to set. + object describing + how to create the value to inject. + + + + Returns sequence of properties on the given type that + should be set as part of building that object. + + Current build context. + The to add any + generated resolver objects into. + Sequence of objects + that contain the properties to set. + + + + The build stages we use in the Unity container + strategy pipeline. + + + + + First stage. By default, nothing happens here. + + + + + Second stage. Type mapping occurs here. + + + + + Third stage. lifetime managers are checked here, + and if they're available the rest of the pipeline is skipped. + + + + + Fourth stage. Reflection over constructors, properties, etc. is + performed here. + + + + + Fifth stage. Instance creation happens here. + + + + + Sixth stage. Property sets and method injection happens here. + + + + + Seventh and final stage. By default, nothing happens here. + + + + + Represents the context in which a build-up or tear-down operation runs. + + + + + Represents the context in which a build-up or tear-down operation runs. + + + + + Add a new set of resolver override objects to the current build operation. + + objects to add. + + + + Get a object for the given + or null if that dependency hasn't been overridden. + + Type of the dependency. + Resolver to use, or null if no override matches for the current operation. + + + + A convenience method to do a new buildup operation on an existing context. + + Key to use to build up. + Created object. + + + + A convenience method to do a new buildup operation on an existing context. This + overload allows you to specify extra policies which will be in effect for the duration + of the build. + + Key defining what to build up. + A delegate that takes a . This + is invoked with the new child context before the build up process starts. This gives callers + the opportunity to customize the context for the build process. + Created object. + + + + Gets the head of the strategy chain. + + + The strategy that's first in the chain; returns null if there are no + strategies in the chain. + + + + + Gets the associated with the build. + + + The associated with the build. + + + + + Gets the original build key for the build operation. + + + The original build key for the build operation. + + + + + Get the current build key for the current build operation. + + + + + The set of policies that were passed into this context. + + This returns the policies passed into the context. + Policies added here will remain after buildup completes. + The persistent policies for the current context. + + + + Gets the policies for the current context. + + Any policies added to this object are transient + and will be erased at the end of the buildup. + + The policies for the current context. + + + + + Gets the collection of objects + that need to execute in event of an exception. + + + + + The current object being built up or torn down. + + + The current object being manipulated by the build operation. May + be null if the object hasn't been created yet. + + + + Flag indicating if the build operation should continue. + + true means that building should not call any more + strategies, false means continue to the next strategy. + + + + An object representing what is currently being done in the + build chain. Used to report back errors if there's a failure. + + + + + The build context used to resolve a dependency during the build operation represented by this context. + + + + + Initialize a new instance of the class. + + + + + Initialize a new instance of the class with a , + , and the + build key used to start this build operation. + + The to use for this context. + The to use for this context. + The to use for this context. + Build key to start building. + The existing object to build up. + + + + Create a new using the explicitly provided + values. + + The to use for this context. + The to use for this context. + The set of persistent policies to use for this context. + The set of transient policies to use for this context. It is + the caller's responsibility to ensure that the transient and persistent policies are properly + combined. + Build key for this context. + Existing object to build up. + + + + Add a new set of resolver override objects to the current build operation. + + objects to add. + + + + Get a object for the given + or null if that dependency hasn't been overridden. + + Type of the dependency. + Resolver to use, or null if no override matches for the current operation. + + + + A convenience method to do a new buildup operation on an existing context. + + Key to use to build up. + Created object. + + + + A convenience method to do a new buildup operation on an existing context. This + overload allows you to specify extra policies which will be in effect for the duration + of the build. + + Key defining what to build up. + A delegate that takes a . This + is invoked with the new child context before the build up process starts. This gives callers + the opportunity to customize the context for the build process. + Created object. + + + + Gets the head of the strategy chain. + + + The strategy that's first in the chain; returns null if there are no + strategies in the chain. + + + + + Get the current build key for the current build operation. + + + + + The current object being built up or torn down. + + + The current object being manipulated by the build operation. May + be null if the object hasn't been created yet. + + + + Gets the associated with the build. + + + The associated with the build. + + + + + Gets the original build key for the build operation. + + + The original build key for the build operation. + + + + + The set of policies that were passed into this context. + + This returns the policies passed into the context. + Policies added here will remain after buildup completes. + The persistent policies for the current context. + + + + Gets the policies for the current context. + + + Any modifications will be transient (meaning, they will be forgotten when + the outer BuildUp for this context is finished executing). + + + The policies for the current context. + + + + + Gets the collection of objects + that need to execute in event of an exception. + + + + + Flag indicating if the build operation should continue. + + true means that building should not call any more + strategies, false means continue to the next strategy. + + + + An object representing what is currently being done in the + build chain. Used to report back errors if there's a failure. + + + + + The build context used to resolve a dependency during the build operation represented by this context. + + + + + Represents that a dependency could not be resolved. + + + + + Initializes a new instance of the class with no extra information. + + + + + Initializes a new instance of the class with the given message. + + Some random message. + + + + Initialize a new instance of the class with the given + message and inner exception. + + Some random message + Inner exception. + + + + Initializes a new instance of the class with the build key of the object begin built. + + The build key of the object begin built. + + + + The exception thrown when injection is attempted on a method + that is an open generic or has out or ref params. + + + + + Construct a new with no + message. + + + + + Construct a with the given message + + Message to return. + + + + Construct a with the given message + and inner exception. + + Message to return. + Inner exception + + + + Extension methods to provide convenience overloads over the + interface. + + + + + Start a recursive build up operation to retrieve the default + value for the given type. + + Type of object to build. + Parent context. + Resulting object. + + + + Start a recursive build up operation to retrieve the named + implementation for the given type. + + Type to resolve. + Parent context. + Name to resolve with. + The resulting object. + + + + Add a set of s to the context, specified as a + variable argument list. + + Context to add overrides to. + The overrides. + + + + Data structure that stores the set of + objects and executes them when requested. + + + + + Add a new object to this + list. + + Object to add. + + + + Execute the method + of everything in the recovery list. Recoveries will execute + in the opposite order of add - it's a stack. + + + + + Return the number of recovery objects currently in the stack. + + + + + Represents a lifetime container. + + + A lifetime container tracks the lifetime of an object, and implements + IDisposable. When the container is disposed, any objects in the + container which implement IDisposable are also disposed. + + + + + Adds an object to the lifetime container. + + The item to be added to the lifetime container. + + + + Determine if a given object is in the lifetime container. + + + The item to locate in the lifetime container. + + + Returns true if the object is contained in the lifetime + container; returns false otherwise. + + + + + Removes an item from the lifetime container. The item is + not disposed. + + The item to be removed. + + + + Gets the number of references in the lifetime container + + + The number of references in the lifetime container + + + + + Represents a lifetime container. + + + A lifetime container tracks the lifetime of an object, and implements + IDisposable. When the container is disposed, any objects in the + container which implement IDisposable are also disposed. + + + + + Adds an object to the lifetime container. + + The item to be added to the lifetime container. + + + + Determine if a given object is in the lifetime container. + + + The item to locate in the lifetime container. + + + Returns true if the object is contained in the lifetime + container; returns false otherwise. + + + + + Releases the resources used by the . + + + + + Releases the managed resources used by the DbDataReader and optionally releases the unmanaged resources. + + + true to release managed and unmanaged resources; false to release only unmanaged resources. + + + + + Returns an enumerator that iterates through the lifetime container. + + + An object that can be used to iterate through the life time container. + + + + + Returns an enumerator that iterates through the lifetime container. + + + An object that can be used to iterate through the life time container. + + + + + Removes an item from the lifetime container. The item is + not disposed. + + The item to be removed. + + + + Gets the number of references in the lifetime container + + + The number of references in the lifetime container + + + + + A custom collection over objects. + + + + + Removes an individual policy type for a build key. + + The type of policy to remove. + The key the policy applies. + + + + Removes all policies from the list. + + + + + Removes a default policy. + + The type the policy was registered as. + + + + Gets an individual policy. + + The interface the policy is registered under. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy list in the chain that the searched for policy was found in, null if the policy was + not found. + The policy in the list, if present; returns null otherwise. + + + + Get the non default policy. + + The interface the policy is registered under. + The key the policy applies to. + True if the search should be in the local policy list only; otherwise false to search up the parent chain. + The policy list in the chain that the searched for policy was found in, null if the policy was + not found. + The policy in the list if present; returns null otherwise. + + + + Sets an individual policy. + + The of the policy. + The policy to be registered. + The key the policy applies. + + + + Sets a default policy. When checking for a policy, if no specific individual policy + is available, the default will be used. + + The interface to register the policy under. + The default policy to be registered. + + + + A custom collection wrapper over objects. + + + + + Initialize a new instance of a class. + + + + + Initialize a new instance of a class with another policy list. + + An inner policy list to search. + + + + Removes an individual policy type for a build key. + + The type of policy to remove. + The key the policy applies. + + + + Removes all policies from the list. + + + + + Removes a default policy. + + The type the policy was registered as. + + + + Gets an individual policy. + + The interface the policy is registered under. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy list in the chain that the searched for policy was found in, null if the policy was + not found. + The policy in the list, if present; returns null otherwise. + + + + Get the non default policy. + + The interface the policy is registered under. + The key the policy applies to. + True if the search should be in the local policy list only; otherwise false to search up the parent chain. + The policy list in the chain that the searched for policy was found in, null if the policy was + not found. + The policy in the list if present; returns null otherwise. + + + + Sets an individual policy. + + The of the policy. + The policy to be registered. + The key the policy applies. + + + + Sets a default policy. When checking for a policy, if no specific individual policy + is available, the default will be used. + + The interface to register the policy under. + The default policy to be registered. + + + + Gets the number of items in the locator. + + + The number of items in the locator. + + + + + Extension methods on to provide convenience + overloads (generic versions, mostly). + + + + + Removes an individual policy type for a build key. + + The type the policy was registered as. + to remove the policy from. + The key the policy applies. + + + + Removes a default policy. + + The type the policy was registered as. + to remove the policy from. + + + + Gets an individual policy. + + The interface the policy is registered under. + to search. + The key the policy applies. + The policy in the list, if present; returns null otherwise. + + + + Gets an individual policy. + + The interface the policy is registered under. + to search. + The key the policy applies. + The policy list that actually contains the returned policy. + The policy in the list, if present; returns null otherwise. + + + + Gets an individual policy. + + to search. + The interface the policy is registered under. + The key the policy applies. + The policy in the list, if present; returns null otherwise. + + + + Gets an individual policy. + + to search. + The interface the policy is registered under. + The key the policy applies. + The policy list that actually contains the returned policy. + The policy in the list, if present; returns null otherwise. + + + + Gets an individual policy. + + The interface the policy is registered under. + to search. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy in the list, if present; returns null otherwise. + + + + Gets an individual policy. + + The interface the policy is registered under. + to search. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy list that actually contains the returned policy. + The policy in the list, if present; returns null otherwise. + + + + Gets an individual policy. + + to search. + The interface the policy is registered under. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy in the list, if present; returns null otherwise. + + + + Get the non default policy. + + The interface the policy is registered under. + to search. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy in the list, if present; returns null otherwise. + + + + Get the non default policy. + + The interface the policy is registered under. + to search. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy list that actually contains the returned policy. + The policy in the list, if present; returns null otherwise. + + + + Get the non default policy. + + to search. + The interface the policy is registered under. + The key the policy applies. + true if the policy searches local only; otherwise false to seach up the parent chain. + The policy in the list, if present; returns null otherwise. + + + + Sets an individual policy. + + The interface the policy is registered under. + to add the policy to. + The policy to be registered. + The key the policy applies. + + + + Sets a default policy. When checking for a policy, if no specific individual policy + is available, the default will be used. + + The interface to register the policy under. + to add the policy to. + The default policy to be registered. + + + + An implementation of . + + + + + Add a new object to this + list. + + Object to add. + + + + Execute the method + of everything in the recovery list. Recoveries will execute + in the opposite order of add - it's a stack. + + + + + Return the number of recovery objects currently in the stack. + + + + + Implementation of which will notify an object about + the completion of a BuildUp operation, or start of a TearDown operation. + + + This strategy checks the object that is passing through the builder chain to see if it + implements IBuilderAware and if it does, it will call + and . This strategy is meant to be used from the + stage. + + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + Context of the build operation. + + + + Called during the chain of responsibility for a teardown operation. The + PreTearDown method is called when the chain is being executed in the + forward direction. + + Context of the teardown operation. + + + + Implemented on a class when it wants to receive notifications + about the build process. + + + + + Called by the when the object is being built up. + + The key of the object that was just built up. + + + + Called by the when the object is being torn down. + + + + + Enumeration to represent the object builder stages. + + + The order of the values in the enumeration is the order in which the stages are run. + + + + + Strategies in this stage run before creation. Typical work done in this stage might + include strategies that use reflection to set policies into the context that other + strategies would later use. + + + + + Strategies in this stage create objects. Typically you will only have a single policy-driven + creation strategy in this stage. + + + + + Strategies in this stage work on created objects. Typical work done in this stage might + include setter injection and method calls. + + + + + Strategies in this stage work on objects that are already initialized. Typical work done in + this stage might include looking to see if the object implements some notification interface + to discover when its initialization stage has been completed. + + + + + Represents a builder policy for mapping build keys. + + + + + Represents a builder policy for mapping build keys. + + + + + Maps the build key. + + The build key to map. + Current build context. Used for contextual information + if writing a more sophisticated mapping. This parameter can be null + (called when getting container registrations). + The new build key. + + + + Initialize a new instance of the with the new build key. + + The new build key. + + + + Maps the build key. + + The build key to map. + Current build context. Used for contextual information + if writing a more sophisticated mapping, unused in this implementation. + The new build key. + + + + Represents a strategy for mapping build keys in the build up operation. + + + + + Called during the chain of responsibility for a build operation. Looks for the + and if found maps the build key for the current operation. + + The context for the operation. + + + + An implementation of that can map + generic types. + + + + + Create a new instance + that will map generic types. + + Build key to map to. This must be or contain an open generic type. + + + + Maps the build key. + + The build key to map. + Current build context. Used for contextual information + if writing a more sophisticated mapping. + The new build key. + + + + Base class for the current operation stored in the build context. + + + + + Create a new . + + Type currently being built. + + + + The type that's currently being built. + + + + + A that will look for a build plan + in the current context. If it exists, it invokes it, otherwise + it creates one and stores it for later, and invokes it. + + + + + Called during the chain of responsibility for a build operation. + + The context for the operation. + + + + An implementation of that chooses + constructors based on these criteria: first, pick a constructor marked with the + attribute. If there + isn't one, then choose the constructor with the longest parameter list. If that is ambiguous, + then throw. + + Thrown when the constructor to choose is ambiguous. + Attribute used to mark the constructor to call. + + + + Create a instance for the given + . + + Parameter to create the resolver for. + The resolver object. + + + + Objects of this type are the return value from . + It encapsulates the desired with the string keys + needed to look up the for each + parameter. + + + + + Base class for return values from selector policies that + return a memberinfo of some sort plus a list of parameter + keys to look up the parameter resolvers. + + + + + Base class for return of selector policies that need + to keep track of a set of parameter keys. + + + + + Add a new parameter key to this object. Keys are assumed + to be in the order of the parameters to the constructor. + + Key for the next parameter to look up. + + + + The set of keys for the constructor parameters. + + + + + Construct a new , storing + the given member info. + + Member info to store. + + + + The member info stored. + + + + + Create a new instance which + contains the given constructor. + + The constructor to wrap. + + + + The constructor this object wraps. + + + + + Create a object used to host the + dynamically generated build plan. This class creates the + dynamic method in the anonymous hosting assembly provided by + the Silverlight runtime. + + + + + This interface defines a policy that manages creation of the dynamic methods + used by the ObjectBuilder code generation. This way, we can replace the details + of how the dynamic method is created to handle differences in CLR (like Silverlight + vs desktop) or security policies. + + + + + Create a builder method for the given type, using the given name. + + Type that will be built by the generated method. + Name to give to the method. + A object with the proper signature to use + as part of a build plan. + + + + Create a builder method for the given type, using the given name. + + Type that will be built by the generated method. + Name to give to the method. + A object with the proper signature to use + as part of a build plan. + + + + This class records the information about which constructor argument is currently + being resolved, and is responsible for generating the error string required when + an error has occurred. + + + + + Initializes a new instance of the class. + + The type that is being constructed. + A string representing the constructor being called. + Parameter being resolved. + + + + Generate the string describing what parameter was being resolved. + + The description string. + + + + String describing the constructor being set up. + + + + + Parameter that's being resolved. + + + + + A that emits IL to call constructors + as part of creating a build plan. + + + + + Called during the chain of responsibility for a build operation. + + Existing object is an instance of . + The context for the operation. + + + + A helper method used by the generated IL to throw an exception if + a dependency cannot be resolved. + + The currently being + used for the build of this object. + + + + A helper method used by the generated IL to throw an exception if + a dependency cannot be resolved because of an invalid constructor. + + The currently being + used for the build of this object. + The signature of the invalid constructor. + + + + A helper method used by the generated IL to throw an exception if + no existing object is present, but the user is attempting to build + an interface (usually due to the lack of a type mapping). + + The currently being + used for the build of this object. + + + + A helper method used by the generated IL to store the current operation in the build context. + + + + + A helper method used by the generated IL to store the current operation in the build context. + + + + + A helper method used by the generated IL to set up a PerResolveLifetimeManager lifetime manager + if the current object is such. + + Current build context. + + + + A class that records that a constructor is about to be call, and is + responsible for generating the error string required when + an error has occurred. + + + + + Initializes a new instance of the class. + + + + + Generate the description string. + + The string. + + + + Constructor we're trying to call. + + + + + This object tracks the current state of the build plan generation, + accumulates the IL, provides the preamble & postamble for the dynamic + method, and tracks things like local variables in the generated IL + so that they can be reused across IL generation strategies. + + + + + Create a that is initialized + to handle creation of a dynamic method to build the given type. + + Type that we're trying to create a build plan for. + An object that actually + creates our object. + + + + Completes generation of the dynamic method and returns the + generated dynamic method delegate. + + The created + + + + Emit the IL to put the build context on top of the IL stack. + + + + + Emit the IL to put the current build key on top of the IL stack. + + + + + Emit the IL to put the current "existing" object on the top of the IL stack. + + + + + Emit the IL to make the top of the IL stack our current "existing" object. + + + + + Emit the IL to load the given object onto the top of the IL stack. + + Type to load on the stack. + + + + Emit the IL needed to look up an and + call it to get a value. + + Type of the dependency to resolve. + Key to look up the policy by. + + + + Emit the IL needed to clear the . + + + + + Emit the IL needed to either cast the top of the stack to the target type + or unbox it, if it's a value type. + + Type to convert the top of the stack to. + + + + A helper method used by the generated IL to clear the current operation in the build context. + + + + + Helper method used by generated IL to look up a dependency resolver based on the given key. + + Current build context. + Type of the dependency being resolved. + Key the resolver was stored under. + The found dependency resolver. + + + + A reflection helper method to make it easier to grab a property getter + for the given property. + + Type that implements the property we want. + Type of the property. + Name of the property. + The property getter's . + + + + A reflection helper method that makes it easier to grab a + for a method. + + Type that implements the method we want. + Name of the method. + Types of arguments to the method. + The method's . + + + + The underlying that can be used to + emit IL into the generated dynamic method. + + + + + The type we're currently creating the method to build. + + + + + A delegate type that defines the signature of the + dynamic method created by the build plans. + + used to build up the object. + + + + An implementation of that runs the + given delegate to execute the plan. + + + + + A build plan is an object that, when invoked, will create a new object + or fill in a given existing one. It encapsulates all the information + gathered by the strategies to construct a particular object. + + + + + Creates an instance of this build plan's type, or fills + in the existing type if passed in. + + Context used to build up the object. + + + + An implementation + that constructs a build plan via dynamic IL emission. + + + + + A that can create and return an + for the given build key. + + + + + Create a build plan using the given context and build key. + + Current build context. + Current build key. + The build plan. + + + + Construct a that + uses the given strategy chain to construct the build plan. + + The strategy chain. + + + + Construct a build plan. + + The current build context. + The current build key. + The created build plan. + + + + A that generates IL to call + chosen methods (as specified by the current ) + as part of object build up. + + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + Context of the build operation. + + + + A helper method used by the generated IL to store the current operation in the build context. + + + + + A helper method used by the generated IL to store the current operation in the build context. + + + + + A class that records that a constructor is about to be call, and is + responsible for generating the error string required when + an error has occurred. + + + + + Initializes a new instance of the class. + + + + + Generate the description string. + + The string. + + + + Method we're trying to call. + + + + + This class records the information about which constructor argument is currently + being resolved, and is responsible for generating the error string required when + an error has occurred. + + + + + Initializes a new instance of the class. + + The type that is being constructed. + A string representing the method being called. + Parameter being resolved. + + + + Generate the string describing what parameter was being resolved. + + The description string. + + + + String describing the method being set up. + + + + + Parameter that's being resolved. + + + + + A that generates IL to resolve properties + on an object being built. + + + + + Called during the chain of responsibility for a build operation. + + The context for the operation. + + + + A helper method used by the generated IL to store the current operation in the build context. + + + + + A helper method used by the generated IL to store the current operation in the build context. + + + + + A base class that holds the information shared by all operations + performed by the container while setting properties. + + + + + Initializes a new instance of the class. + + + + + Generate the description of this operation. + + The string. + + + + Get a format string used to create the description. Called by + the base method. + + The format string. + + + + The property value currently being resolved. + + + + + This class records the information about which property value is currently + being resolved, and is responsible for generating the error string required when + an error has occurred. + + + + + Initializes a new instance of the class. + + + + + Get a format string used to create the description. Called by + the base method. + + The format string. + + + + This class records the information about which property value is currently + being set, and is responsible for generating the error string required when + an error has occurred. + + + + + Initializes a new instance of the class. + + Type property is on. + Name of property being set. + + + + Get a format string used to create the description. Called by + the base method. + + The format string. + + + + Build plan for that will + return a func that will resolve the requested type + through this container later. + + + + + Creates an instance of this build plan's type, or fills + in the existing type if passed in. + + Context used to build up the object. + + + + An implementation of that selects + methods by looking for the given + attribute on those methods. + + Type of attribute used to mark methods + to inject. + + + + Create a instance for the given + . + + Parameter to create the resolver for. + The resolver object. + + + + Objects of this type are the return value from . + It encapsulates the desired with the string keys + needed to look up the for each + parameter. + + + + + Create a new instance which + contains the given method. + + The method + + + + The constructor this object wraps. + + + + + Creates an instance of this build plan's type, or fills + in the existing type if passed in. + + Context used to build up the object. + + + + An implementation of that looks + for properties marked with the + attribute that are also settable and not indexers. + + + + + + Create a for the given + property. + + Property to create resolver for. + The resolver object. + + + + Objects of this type are returned from + . + This class combines the about + the property with the string key used to look up the resolver + for this property's value. + + + + + Create an instance of + with the given and key. + + The property. + Key to use to look up the resolver. + + + + PropertyInfo for this property. + + + + + Key to look up this property's resolver. + + + + + Implementation of . + + + + + A builder policy that lets you keep track of the current + resolvers and will remove them from the given policy set. + + + + + Add a new resolver to track by key. + + Key that was used to add the resolver to the policy set. + + + + Remove the currently tracked resolvers from the given policy list. + + Policy list to remove the resolvers from. + + + + Add a new resolver to track by key. + + Key that was used to add the resolver to the policy set. + + + + Remove the currently tracked resolvers from the given policy list. + + Policy list to remove the resolvers from. + + + + Get an instance that implements , + either the current one in the policy set or creating a new one if it doesn't + exist. + + Policy list to look up from. + Build key to track. + The resolver tracker. + + + + Add a key to be tracked to the current tracker. + + Policy list containing the resolvers and trackers. + Build key for the resolvers being tracked. + Key for the resolver. + + + + Remove the resolvers for the given build key. + + Policy list containing the build key. + Build key. + + + + An implementation of that + calls back into the build chain to build up the dependency, passing + a type given at compile time as its build key. + + + + + Create a new instance storing the given type. + + Type to resolve. + + + + Get the value for a dependency. + + Current build context. + The value for the dependency. + + + + This interface defines a standard method to convert any + regardless + of the stage enum into a regular, flat strategy chain. + + + + + Convert this into + a flat . + + The flattened . + + + + Represents a chain of responsibility for builder strategies. + + + + + Reverse the order of the strategy chain. + + The reversed strategy chain. + + + + Execute this strategy chain against the given context, + calling the Buildup methods on the strategies. + + Context for the build process. + The build up object + + + + Execute this strategy chain against the given context, + calling the TearDown methods on the strategies. + + Context for the teardown process. + + + + An implementation that uses + a to figure out if an object + has already been created and to update or remove that + object from some backing store. + + + + + Called during the chain of responsibility for a build operation. The + PreBuildUp method is called when the chain is being executed in the + forward direction. + + Context of the build operation. + + + + Called during the chain of responsibility for a build operation. The + PostBuildUp method is called when the chain has finished the PreBuildUp + phase and executes in reverse order from the PreBuildUp calls. + + Context of the build operation. + + + + Represents a chain of responsibility for builder strategies partitioned by stages. + + The stage enumeration to partition the strategies. + + + + Initialize a new instance of the class. + + + + + Initialize a new instance of the class with an inner strategy chain to use when building. + + The inner strategy chain to use first when finding strategies in the build operation. + + + + Adds a strategy to the chain at a particular stage. + + The strategy to add to the chain. + The stage to add the strategy. + + + + Add a new strategy for the . + + The of + The stage to add the strategy. + + + + Clear the current strategy chain list. + + + This will not clear the inner strategy chain if this instane was created with one. + + + + + Makes a strategy chain based on this instance. + + A new . + + + + Represents a chain of responsibility for builder strategies. + + + + + Initialzie a new instance of the class. + + + + + Initialzie a new instance of the class with a colleciton of strategies. + + A collection of strategies to initialize the chain. + + + + Adds a strategy to the chain. + + The strategy to add to the chain. + + + + Adds strategies to the chain. + + The strategies to add to the chain. + + + + Reverse the order of the strategy chain. + + The reversed strategy chain. + + + + Execute this strategy chain against the given context to build up. + + Context for the build processes. + The build up object + + + + Execute this strategy chain against the given context, + calling the TearDown methods on the strategies. + + Context for the teardown process. + + + + Returns an enumerator that iterates through the collection. + + + + A that can be used to iterate through the collection. + + 1 + + + + Returns an enumerator that iterates through a collection. + + + + An object that can be used to iterate through the collection. + + 2 + + + + The almost inevitable collection of extra helper methods on + to augment the rich set of what + Linq already gives us. + + + + + Execute the provided on every item in . + + Type of the items stored in + Sequence of items to process. + Code to run over each item. + + + + Create a single string from a sequenc of items, separated by the provided , + and with the conversion to string done by the given . + + This method does basically the same thing as , + but will work on any sequence of items, not just arrays. + Type of items in the sequence. + Sequence of items to convert. + Separator to place between the items in the string. + The conversion function to change TItem -> string. + The resulting string. + + + + Create a single string from a sequenc of items, separated by the provided , + and with the conversion to string done by the item's method. + + This method does basically the same thing as , + but will work on any sequence of items, not just arrays. + Type of items in the sequence. + Sequence of items to convert. + Separator to place between the items in the string. + The resulting string. + + + + Build key used to combine a type object with a string name. Used by + ObjectBuilder to indicate exactly what is being built. + + + + + Create a new instance with the given + type and name. + + to build. + Key to use to look up type mappings and singletons. + + + + Create a new instance for the default + buildup of the given type. + + to build. + + + + This helper method creates a new instance. It is + initialized for the default key for the given type. + + Type to build. + A new instance. + + + + This helper method creates a new instance for + the given type and key. + + Type to build + Key to use to look up type mappings and singletons. + A new instance initialized with the given type and name. + + + + Compare two instances. + + Two instances compare equal + if they contain the same name and the same type. Also, comparing + against a different type will also return false. + Object to compare to. + True if the two keys are equal, false if not. + + + + Calculate a hash code for this instance. + + A hash code. + + + + Compare two instances for equality. + + Two instances compare equal + if they contain the same name and the same type. + First of the two keys to compare. + Second of the two keys to compare. + True if the values of the keys are the same, else false. + + + + Compare two instances for inequality. + + Two instances compare equal + if they contain the same name and the same type. If either field differs + the keys are not equal. + First of the two keys to compare. + Second of the two keys to compare. + false if the values of the keys are the same, else true. + + + + Formats the build key as a string (primarily for debugging). + + A readable string representation of the build key. + + + + Return the stored in this build key. + + The type to build. + + + + Returns the name stored in this build key. + + The name to use when building. + + + + A generic version of so that + you can new up a key using generic syntax. + + Type for the key. + + + + Construct a new that + specifies the given type. + + + + + Construct a new that + specifies the given type and name. + + Name for the key. + + + + A series of helper methods to deal with sequences - + objects that implement . + + + + + A function that turns an arbitrary parameter list into an + . + + Type of arguments. + The items to put into the collection. + An array that contains the values of the . + + + + Given two sequences, return a new sequence containing the corresponding values + from each one. + + Type of first sequence. + Type of second sequence. + First sequence of items. + Second sequence of items. + New sequence of pairs. This sequence ends when the shorter of sequence1 and sequence2 does. + + + + A class that lets you + override a named parameter passed to a constructor. + + + + + Construct a new object that will + override the given named constructor parameter, and pass the given + value. + + Name of the constructor parameter. + Value to pass for the constructor. + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + A convenience form of that lets you + specify multiple parameter overrides in one shot rather than having + to construct multiple objects. + + + + + When implemented in derived classes, this method is called from the + method to create the actual objects. + + Key value to create the resolver. + Value to store in the resolver. + The created . + + + + 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 The type {0} has multiple constructors of length {1}. Unable to disambiguate.. + + + + + Looks up a localized string similar to The provided string argument must not be empty.. + + + + + Looks up a localized string similar to The current build operation (build key {2}) failed: {3} (Strategy type {0}, index {1}). + + + + + Looks up a localized string similar to The current type, {0}, is an interface and cannot be constructed. Are you missing a type mapping?. + + + + + Looks up a localized string similar to Cannot extract type from build key {0}.. + + + + + Looks up a localized string similar to The method {0}.{1}({2}) is an open generic method. Open generic methods cannot be injected.. + + + + + Looks up a localized string similar to The property {0} on type {1} is an indexer. Indexed properties cannot be injected.. + + + + + Looks up a localized string similar to The method {1} on type {0} has an out parameter. Injection cannot be performed.. + + + + + Looks up a localized string similar to The method {0}.{1}({2}) has at least one out parameter. Methods with out parameters cannot be injected.. + + + + + Looks up a localized string similar to The method {0}.{1}({2}) has at least one ref parameter.Methods with ref parameters cannot be injected.. + + + + + Looks up a localized string similar to The method {1} on type {0} is marked for injection, but it is an open generic method. Injection cannot be performed.. + + + + + Looks up a localized string similar to The method {0}.{1}({2}) is static. Static methods cannot be injected.. + + + + + Looks up a localized string similar to The type {0} is an open generic type. An open generic type cannot be resolved.. + + + + + Looks up a localized string similar to Resolving parameter "{0}" of constructor {1}. + + + + + Looks up a localized string similar to The parameter {0} could not be resolved when attempting to call constructor {1}.. + + + + + Looks up a localized string similar to Parameter type inference does not work for null values. Indicate the parameter type explicitly using a properly configured instance of the InjectionParameter or InjectionParameter<T> classes.. + + + + + Looks up a localized string similar to Calling constructor {0}. + + + + + Looks up a localized string similar to Calling method {0}.{1}. + + + + + Looks up a localized string similar to An item with the given key is already present in the dictionary.. + + + + + Looks up a localized string similar to The lifetime manager is already registered. Lifetime managers cannot be reused, please create a new one.. + + + + + Looks up a localized string similar to The override marker build plan policy has been invoked. This should never happen, looks like a bug in the container.. + + + + + Looks up a localized string similar to Resolving parameter "{0}" of method {1}.{2}. + + + + + Looks up a localized string similar to The value for parameter "{1}" of method {0} could not be resolved. . + + + + + Looks up a localized string similar to Could not resolve dependency for build key {0}.. + + + + + Looks up a localized string similar to The type {0} has multiple constructors marked with the InjectionConstructor attribute. Unable to disambiguate.. + + + + + Looks up a localized string similar to The supplied type {0} must be an open generic type.. + + + + + Looks up a localized string similar to The supplied type {0} does not have the same number of generic arguments as the target type {1}.. + + + + + Looks up a localized string similar to The type {0} does not have an accessible constructor.. + + + + + Looks up a localized string similar to The type {0} does not have a generic argument named "{1}". + + + + + Looks up a localized string similar to while resolving. + + + + + Looks up a localized string similar to The type {0} does not have a constructor that takes the parameters ({1}).. + + + + + Looks up a localized string similar to The type {0} does not have a public method named {1} that takes the parameters ({2}).. + + + + + Looks up a localized string similar to The type {0} does not contain an instance property named {1}.. + + + + + Looks up a localized string similar to The type {0} is not a generic type, and you are attempting to inject a generic parameter named "{1}".. + + + + + Looks up a localized string similar to The type {0} is not an array type with rank 1, and you are attempting to use a [DependencyArray] attribute on a parameter or property with this type.. + + + + + Looks up a localized string similar to Optional dependencies must be reference types. The type {0} is a value type.. + + + + + Looks up a localized string similar to The property {0} on type {1} is not settable.. + + + + + Looks up a localized string similar to The property {0} on type {1} is of type {2}, and cannot be injected with a value of type {3}.. + + + + + Looks up a localized string similar to The value for the property "{0}" could not be resolved.. + + + + + Looks up a localized string similar to The provided string argument must not be empty.. + + + + + Looks up a localized string similar to Resolution of the dependency failed, type = "{0}", name = "{1}". + Exception occurred while: {2}. + Exception is: {3} - {4} + ----------------------------------------------- + At the time of the exception, the container was: + . + + + + + Looks up a localized string similar to Resolving {0},{1}. + + + + + Looks up a localized string similar to Resolving {0},{1} (mapped from {2}, {3}). + + + + + Looks up a localized string similar to Resolving value for property {0}.{1}. + + + + + Looks up a localized string similar to The constructor {1} selected for type {0} has ref or out parameters. Such parameters are not supported for constructor injection.. + + + + + Looks up a localized string similar to Setting value for property {0}.{1}. + + + + + Looks up a localized string similar to The type {0} cannot be constructed. You must configure the container to supply this value.. + + + + + Looks up a localized string similar to The type {1} cannot be assigned to variables of type {0}.. + + + + + Looks up a localized string similar to <unknown>. + + + + + A that lets you override + the value for a specified property. + + + + + Create an instance of . + + The property name. + Value to use for the property. + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + A convenience form of that lets you + specify multiple property overrides in one shot rather than having + to construct multiple objects. + + + + + When implemented in derived classes, this method is called from the + method to create the actual objects. + + Key value to create the resolver. + Value to store in the resolver. + The created . + + + + The exception thrown by the Unity container when + an attempt to resolve a dependency fails. + + + + + Create a new that records + the exception for the given type and name. + + Type requested from the container. + Name requested from the container. + The actual exception that caused the failure of the build. + The build context representing the failed operation. + + + + The type that was being requested from the container at the time of failure. + + + + + The name that was being requested from the container at the time of failure. + + + + + Interface defining the configuration interface exposed by the + Static Factory extension. + + + + + Register the given factory delegate to be called when the container is + asked to resolve . + + Type that will be requested from the container. + Delegate to invoke to create the instance. + The container extension object this method was invoked on. + + + + Register the given factory delegate to be called when the container is + asked to resolve and . + + Type that will be requested from the container. + The name that will be used when requesting to resolve this type. + Delegate to invoke to create the instance. + The container extension object this method was invoked on. + + + + A that lets you register a + delegate with the container to create an object, rather than calling + the object's constructor. + + + + + Initialize this extension. This particular extension requires no + initialization work. + + + + + Register the given factory delegate to be called when the container is + asked to resolve and . + + Type that will be requested from the container. + The name that will be used when requesting to resolve this type. + Delegate to invoke to create the instance. + The container extension object this method was invoked on. + + + + Register the given factory delegate to be called when the container is + asked to resolve . + + Type that will be requested from the container. + Delegate to invoke to create the instance. + The container extension object this method was invoked on. + + + + An implementation of that + acts as a decorator over another . + This checks to see if the current type being built is the + right one before checking the inner . + + + + + Create an instance of + + Type to check for. + Inner override to check after type matches. + + + + Return a that can be used to give a value + for the given desired dependency. + + Current build context. + Type of dependency desired. + a object if this override applies, null if not. + + + + A convenience version of that lets you + specify the type to construct via generics syntax. + + Type to check for. + + + + Create an instance of . + + Inner override to check after type matches. + + + + A simple, extensible dependency injection container. + + + + + Create a default . + + + + + Create a with the given parent container. + + The parent . The current object + will apply its own settings first, and then check the parent for additional ones. + + + + RegisterType a type mapping with the container, where the created instances will use + the given . + + that will be requested. + that will actually be returned. + Name to use for registration, null if a default registration. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + RegisterType an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + Name for registration. + + If true, the container will take over the lifetime of the instance, + calling Dispose on it (if it's ) when the container is Disposed. + + If false, container will not maintain a strong reference to . User is reponsible + for disposing instance, and for keeping the instance from being garbage collected. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Get an instance of the requested type with the given name from the container. + + of object to get from the container. + Name of the object to retrieve. + Any overrides for the resolve call. + The retrieved object. + + + + Return instances of all registered types requested. + + + + This method is useful if you've registered multiple types with the same + but different names. + + + Be aware that this method does NOT return an instance for the default (unnamed) registration. + + + The type requested. + Any overrides for the resolve calls. + Set of objects of type . + + + + Run an existing object through the container and perform injection on it. + + + + This method is useful when you don't control the construction of an + instance (ASP.NET pages or objects created via XAML, for instance) + but you still want properties and other injection performed. + + of object to perform injection on. + Instance to build up. + name to use when looking up the typemappings and other configurations. + Any overrides for the buildup. + The resulting object. By default, this will be , but + container extensions may add things like automatic proxy creation which would + cause this to return a different object (but still type compatible with ). + + + + Run an existing object through the container, and clean it up. + + The object to tear down. + + + + Add an extension object to the container. + + to add. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Get access to a configuration interface exposed by an extension. + + Extensions can expose configuration interfaces as well as adding + strategies and policies to the container. This method walks the list of + added extensions and returns the first one that implements the requested type. + + of configuration interface required. + The requested extension's configuration interface, or null if not found. + + + + Remove all installed extensions from this container. + + + + This method removes all extensions from the container, including the default ones + that implement the out-of-the-box behavior. After this method, if you want to use + the container again you will need to either readd the default extensions or replace + them with your own. + + + The registered instances and singletons that have already been set up in this container + do not get removed. + + + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Create a child container. + + + A child container shares the parent's configuration, but can be configured with different + settings or lifetime. + The new child container. + + + + Dispose this container instance. + + + Disposing the container also disposes any child containers, + and disposes any instances whose lifetimes are managed + by the container. + + + + + Dispose this container instance. + + + This class doesn't have a finalizer, so will always be true. + True if being called from the IDisposable.Dispose + method, false if being called from a finalizer. + + + + Remove policies associated with building this type. This removes the + compiled build plan so that it can be rebuilt with the new settings + the next time this type is resolved. + + Type of object to clear the plan for. + Name the object is being registered with. + + + + The parent of this container. + + The parent container, or null if this container doesn't have one. + + + + Get a sequence of that describe the current state + of the container. + + + + + Implementation of the ExtensionContext that is actually used + by the UnityContainer implementation. + + + This is a nested class so that it can access state in the + container that would otherwise be inaccessible. + + + + + This event is raised when the method, + or one of its overloads, is called. + + + + + Extension class that adds a set of convenience overloads to the + interface. + + + + + Register a type with specific members to be injected. + + Type this registration is for. + Container to configure. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container. + + + + This method is used to tell the container that when asked for type , + actually return an instance of type . This is very useful for + getting instances of interfaces. + + + This overload registers a default mapping and transient lifetime. + + + that will be requested. + that will actually be returned. + Container to configure. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container, where the created instances will use + the given . + + that will be requested. + that will actually be returned. + Container to configure. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container. + + + This method is used to tell the container that when asked for type , + actually return an instance of type . This is very useful for + getting instances of interfaces. + + that will be requested. + that will actually be returned. + Container to configure. + Name of this mapping. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container, where the created instances will use + the given . + + that will be requested. + that will actually be returned. + Container to configure. + Name to use for registration, null if a default registration. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a for the given type with the container. + No type mapping is performed for this type. + + The type to apply the to. + Container to configure. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a for the given type with the container. + No type mapping is performed for this type. + + The type to configure injection on. + Container to configure. + Name that will be used to request the type. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a for the given type and name with the container. + No type mapping is performed for this type. + + The type to apply the to. + Container to configure. + Name that will be used to request the type. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type with specific members to be injected. + + Container to configure. + Type this registration is for. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container. + + + + This method is used to tell the container that when asked for type , + actually return an instance of type . This is very useful for + getting instances of interfaces. + + + This overload registers a default mapping. + + + Container to configure. + that will be requested. + that will actually be returned. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container. + + + This method is used to tell the container that when asked for type , + actually return an instance of type . This is very useful for + getting instances of interfaces. + + Container to configure. + that will be requested. + that will actually be returned. + Name to use for registration, null if a default registration. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a type mapping with the container, where the created instances will use + the given . + + Container to configure. + that will be requested. + that will actually be returned. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a for the given type and name with the container. + No type mapping is performed for this type. + + Container to configure. + The to apply the to. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a for the given type and name with the container. + No type mapping is performed for this type. + + Container to configure. + The to configure in the container. + Name to use for registration, null if a default registration. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register a for the given type and name with the container. + No type mapping is performed for this type. + + Container to configure. + The to apply the to. + Name to use for registration, null if a default registration. + The that controls the lifetime + of the returned instance. + Injection configuration objects. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + This overload does a default registration and has the container take over the lifetime of the instance. + + Type of instance to register (may be an implemented interface instead of the full type). + Container to configure. + Object to returned. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + This overload does a default registration (name = null). + + + Type of instance to register (may be an implemented interface instead of the full type). + Container to configure. + Object to returned. + + object that controls how this instance will be managed by the container. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + This overload automatically has the container take ownership of the . + + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + Container to configure. + Name for registration. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + Container to configure. + Name for registration. + + object that controls how this instance will be managed by the container. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + This overload does a default registration and has the container take over the lifetime of the instance. + + Container to configure. + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + This overload does a default registration (name = null). + + + Container to configure. + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + + object that controls how this instance will be managed by the container. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Register an instance with the container. + + + + Instance registration is much like setting a type as a singleton, except that instead + of the container creating the instance the first time it is requested, the user + creates the instance ahead of type and adds that instance to the container. + + + This overload automatically has the container take ownership of the . + + Container to configure. + Type of instance to register (may be an implemented interface instead of the full type). + Object to returned. + Name for registration. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Resolve an instance of the default requested type from the container. + + of object to get from the container. + Container to resolve from. + Any overrides for the resolve call. + The retrieved object. + + + + Resolve an instance of the requested type with the given name from the container. + + of object to get from the container. + Container to resolve from. + Name of the object to retrieve. + Any overrides for the resolve call. + The retrieved object. + + + + Resolve an instance of the default requested type from the container. + + Container to resolve from. + of object to get from the container. + Any overrides for the resolve call. + The retrieved object. + + + + Return instances of all registered types requested. + + + + This method is useful if you've registered multiple types with the same + but different names. + + + Be aware that this method does NOT return an instance for the default (unnamed) registration. + + + The type requested. + Container to resolve from. + Any overrides for the resolve calls. + Set of objects of type . + + + + Run an existing object through the container and perform injection on it. + + + + This method is useful when you don't control the construction of an + instance (ASP.NET pages or objects created via XAML, for instance) + but you still want properties and other injection performed. + + + This overload uses the default registrations. + + + of object to perform injection on. + Container to resolve through. + Instance to build up. + Any overrides for the buildup. + The resulting object. By default, this will be , but + container extensions may add things like automatic proxy creation which would + cause this to return a different object (but still type compatible with ). + + + + Run an existing object through the container and perform injection on it. + + + + This method is useful when you don't control the construction of an + instance (ASP.NET pages or objects created via XAML, for instance) + but you still want properties and other injection performed. + + of object to perform injection on. + Conatiner to resolve through. + Instance to build up. + name to use when looking up the typemappings and other configurations. + Any overrides for the Buildup. + The resulting object. By default, this will be , but + container extensions may add things like automatic proxy creation which would + cause this to return a different object (but still type compatible with ). + + + + Run an existing object through the container and perform injection on it. + + + + This method is useful when you don't control the construction of an + instance (ASP.NET pages or objects created via XAML, for instance) + but you still want properties and other injection performed. + + + This overload uses the default registrations. + + + Container to resolve through. + of object to perform injection on. + Instance to build up. + Any overrides for the Buildup. + The resulting object. By default, this will be , but + container extensions may add things like automatic proxy creation which would + cause this to return a different object (but still type compatible with ). + + + + Creates a new extension object and adds it to the container. + + Type of to add. The extension type + will be resolved from within the supplied . + Container to add the extension to. + The object that this method was called on (this in C#, Me in Visual Basic). + + + + Resolve access to a configuration interface exposed by an extension. + + Extensions can expose configuration interfaces as well as adding + strategies and policies to the container. This method walks the list of + added extensions and returns the first one that implements the requested type. + + The configuration interface required. + Container to configure. + The requested extension's configuration interface, or null if not found. + + + + Check if a particular type has been registered with the container with + the default name. + + Container to inspect. + Type to check registration for. + True if this type has been registered, false if not. + + + + Check if a particular type/name pair has been registered with the container. + + Container to inspect. + Type to check registration for. + Name to check registration for. + True if this type/name pair has been registered, false if not. + + + + Check if a particular type has been registered with the container with the default name. + + Type to check registration for. + Container to inspect. + True if this type has been registered, false if not. + + + + Check if a particular type/name pair has been registered with the container. + + Type to check registration for. + Container to inspect. + Name to check registration for. + True if this type/name pair has been registered, false if not. + + + + This extension supplies the default behavior of the UnityContainer API + by handling the context events and setting policies. + + + + + Install the default container behavior into the container. + + + + + Remove the default behavior from the container. + + + + + This extension installs the default strategies and policies into the container + to implement the standard behavior of the Unity container. + + + This extension installs the default strategies and policies into the container + to implement the standard behavior of the Unity container. + + + + + Add the default ObjectBuilder strategies & policies to the container. + + + + + Add the correct to the policy + set. This version adds the appropriate policy for running on the desktop CLR. + + + + + An implementation of that wraps a Unity container. + + + + + Initializes a new instance of the class for a container. + + The to wrap with the + interface implementation. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + 2 + + + + When implemented by inheriting classes, this method will do the actual work of resolving + the requested service instance. + + Type of instance requested.Name of registered service you want. May be null. + + The requested service instance. + + + + + When implemented by inheriting classes, this method will do the actual work of + resolving all the requested service instances. + + Type of service requested. + + Sequence of service instance objects. + + + + + A static helper class that includes various parameter checking routines. + + + + + Throws if the given argument is null. + + if tested value if null. + Argument value to test. + Name of the argument being tested. + + + + Throws an exception if the tested string argument is null or the empty string. + + Thrown if string value is null. + Thrown if the string is empty + Argument value to check. + Name of argument being checked. + + + + Verifies that an argument type is assignable from the provided type (meaning + interfaces are implemented, or classes exist in the base class hierarchy). + + The argument type that will be assigned to. + The type of the value being assigned. + Argument name. + + + + Verifies that an argument instance is assignable from the provided type (meaning + interfaces are implemented, or classes exist in the base class hierarchy, or instance can be + assigned through a runtime wrapper, as is the case for COM Objects). + + The argument type that will be assigned to. + The instance that will be assigned. + Argument name. + + + + Helper class to wrap common reflection stuff dealing with + methods. + + + + + Create a new instance that + lets us do more reflection stuff on that method. + + The method to reflect on. + + + + Given our set of generic type arguments, + + The generic type arguments. + An array with closed parameter types. + + + + Returns true if any of the parameters of this method + are open generics. + + + + + Return the of each parameter for this + method. + + Sequence of objects, one for + each parameter in order. + + + + A helper class that encapsulates two different + data items together into a a single item. + + + + + Create a new containing + the two values give. + + First value + Second value + + + + The first value of the pair. + + + + + The second value of the pair. + + + + + Container for a Pair helper method. + + + + + A helper factory method that lets users take advantage of type inference. + + Type of first value. + Type of second value. + First value. + Second value. + A new instance. + + + + A utility class that handles the logic of matching parameter + lists, so we can find the right constructor and method overloads. + + + + + Create a new that will attempt to + match the given parameter types. + + Target parameters to match against. + + + + Tests to see if the given set of types matches the ones + we're looking for. + + parameter list to look for. + true if they match, false if they don't. + + + + Tests to see if the given set of types matches the ones we're looking for. + + Candidate method signature to look for. + True if they match, false if they don't. + + + + Another reflection helper class that has extra methods + for dealing with ParameterInfos. + + + + + A small helper class to encapsulate details of the + reflection API, particularly around generics. + + + + + Create a new instance that + lets you look at information about the given type. + + Type to do reflection on. + + + + Test the given object, looking at + the parameters. Determine if any of the parameters are + open generic types that need type attributes filled in. + + The method to check. + True if any of the parameters are open generics. False if not. + + + + If this type is an open generic, use the + given array to + determine what the required closed type is and return that. + + If the parameter is not an open type, just + return this parameter's type. + Type arguments to substitute in for + the open type parameters. + Corresponding closed type of this parameter. + + + + Given a generic argument name, return the corresponding type for this + closed type. For example, if the current type is SomeType<User>, and the + corresponding definition was SomeType<TSomething>, calling this method + and passing "TSomething" will return typeof(User). + + Name of the generic parameter. + Type of the corresponding generic parameter, or null if there + is no matching name. + + + + The object we're reflecting over. + + + + + Is this type generic? + + + + + Is this type an open generic (no type parameter specified) + + + + + Is this type an array type? + + + + + Is this type an array of generic elements? + + + + + The type of the elements in this type (if it's an array). + + + + + Create a new instance of that + lets you query information about the given ParameterInfo object. + + Parameter to query. + + + + A set of helper methods to pick through lambdas and pull out + from them. + + + + + Pull out a object from an expression of the form + () => SomeClass.SomeMethod() + + Expression describing the method to call. + Corresponding . + + + + Pull out a object from an expression of the form + x => x.SomeMethod() + + The type where the method is defined. + Expression describing the method to call. + Corresponding . + + + + Pull out a object for the get method from an expression of the form + x => x.SomeProperty + + The type where the method is defined. + The type for the property. + Expression describing the property for which the get method is to be extracted. + Corresponding . + + + + Pull out a object for the set method from an expression of the form + x => x.SomeProperty + + The type where the method is defined. + The type for the property. + Expression describing the property for which the set method is to be extracted. + Corresponding . + + + + Pull out a object from an expression of the form () => new SomeType() + + The type where the constructor is defined. + Expression invoking the desired constructor. + Corresponding . + + +