remove old container
This commit is contained in:
Родитель
a07b59ddc3
Коммит
495d1aa415
|
@ -19,7 +19,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Telerik.JustMock;
|
||||
using Telerik.JustMock.Container;
|
||||
using Telerik.JustMock.AutoMock;
|
||||
|
||||
namespace JustMock.NonElevatedExamples.BasicUsage.Automocking
|
||||
{
|
||||
|
|
|
@ -49,9 +49,6 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\Program Files (x86)\Telerik\JustMock\Libraries\Telerik.JustMock.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Telerik.JustMock.Container">
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\Program Files (x86)\Telerik\JustMock\Libraries\Telerik.JustMock.Container.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
Imports System.Text
|
||||
Imports Microsoft.VisualStudio.TestTools.UnitTesting
|
||||
Imports Telerik.JustMock.Container
|
||||
Imports Telerik.JustMock.AutoMock
|
||||
|
||||
Namespace JustMock.NonElevatedExamples.BasicUsage.Automocking
|
||||
''' <summary>
|
||||
|
|
|
@ -62,9 +62,6 @@
|
|||
<Reference Include="Telerik.JustMock">
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\Program Files (x86)\Telerik\JustMock\Libraries\Telerik.JustMock.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Telerik.JustMock.Container">
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\Program Files (x86)\Telerik\JustMock\Libraries\Telerik.JustMock.Container.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="System" />
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
JustMock Lite
|
||||
Copyright © 2010-2014 Telerik AD
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Telerik.JustMock.Container.Abstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides an abstraction between service locator and IOC container.
|
||||
/// </summary>
|
||||
public interface IContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers the specified instance for its corresponding type.
|
||||
/// </summary>
|
||||
void Register(Type @interface, object instance);
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the target instance with dependencies.
|
||||
/// </summary>
|
||||
object Resolve(Type targetType);
|
||||
|
||||
/// <summary>
|
||||
/// Resolves all registered instances for a specific service type.
|
||||
/// </summary>
|
||||
IList<object> ResolveAll(Type serviceType);
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
JustMock Lite
|
||||
Copyright © 2010-2014 Telerik AD
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Telerik.JustMock.Container
|
||||
{
|
||||
/// <summary>
|
||||
/// The exception thrown by the mocking container.
|
||||
/// </summary>
|
||||
public sealed class AutoMockException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AutoMockException" /> class.
|
||||
/// </summary>
|
||||
/// <param name="message">The message of the exception.</param>
|
||||
public AutoMockException(string message) : base(message)
|
||||
{
|
||||
// intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
JustMock Lite
|
||||
Copyright © 2010-2014 Telerik AD
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Practices.ServiceLocation;
|
||||
using Telerik.JustMock.Container.Abstraction;
|
||||
|
||||
namespace Telerik.JustMock.Container
|
||||
{
|
||||
/// <summary>
|
||||
/// JustMockServiceLocator class.
|
||||
/// </summary>
|
||||
public sealed class JustMockServiceLocator : ServiceLocatorImplBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JustMockServiceLocator"/> class.
|
||||
/// </summary>
|
||||
internal JustMockServiceLocator(IContainer container)
|
||||
{
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the container associated with this locator.
|
||||
/// </summary>
|
||||
internal IContainer Container
|
||||
{
|
||||
get
|
||||
{
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the instances for a target type.
|
||||
/// </summary>
|
||||
protected override IEnumerable<object> DoGetAllInstances(Type serviceType)
|
||||
{
|
||||
if (serviceType != null)
|
||||
{
|
||||
return container.ResolveAll(serviceType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specific instance for target type.
|
||||
/// </summary>
|
||||
protected override object DoGetInstance(Type serviceType, string key)
|
||||
{
|
||||
if (serviceType != null)
|
||||
{
|
||||
return container.Resolve(serviceType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private readonly IContainer container;
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
JustMock Lite
|
||||
Copyright © 2010-2014 Telerik AD
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18010
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Telerik.JustMock.Container {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Messages {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Messages() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Telerik.JustMock.Container.Messages", typeof(Messages).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Profiler must enabled to auto mock concrete dependencies.
|
||||
/// </summary>
|
||||
internal static string ProfilerMustBeEnabled {
|
||||
get {
|
||||
return ResourceManager.GetString("ProfilerMustBeEnabled", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="ProfilerMustBeEnabled" xml:space="preserve">
|
||||
<value>Profiler must enabled to auto mock concrete dependencies</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1,325 +0,0 @@
|
|||
/*
|
||||
JustMock Lite
|
||||
Copyright © 2010-2014 Telerik AD
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.Practices.ServiceLocation;
|
||||
using Telerik.JustMock.Container.Abstraction;
|
||||
using Telerik.JustMock.Helpers;
|
||||
using Telerik.JustMock.Expectations;
|
||||
using System.Linq.Expressions;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Telerik.JustMock.Container
|
||||
{
|
||||
/// <summary>
|
||||
/// Entry-point class for auto mocking.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the mocked class.</typeparam>
|
||||
[Obsolete("The entire assembly will be removed in the Q2 release. Migrate your tests to use the NInject-based Telerik.JustMock.AutoMock.MockingContainer")]
|
||||
public class MockingContainer<T> where T : class
|
||||
{
|
||||
private readonly IServiceLocator serviceLocator;
|
||||
|
||||
private T instance;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MockingContainer{T}" /> class.
|
||||
/// <param name="dependenciesType">Specifies the type(s) on which the constructor is dependent.
|
||||
/// <remarks>Empty for resolving container with default/first constructor.</remarks></param>
|
||||
/// </summary>
|
||||
/// <param name="dependenciesType">Type of the dependencies.</param>
|
||||
public MockingContainer(params Type[] dependenciesType)
|
||||
{
|
||||
this.container = new UnityContainer(dependenciesType);
|
||||
|
||||
this.serviceLocator = new JustMockServiceLocator(container);
|
||||
|
||||
this.dependencies = new List<object>();
|
||||
|
||||
RegisterDependencies(typeof(T));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the instance of the underlying type with all dependencies injected.
|
||||
/// </summary>
|
||||
public T Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = (T)container.Resolve(typeof(T));
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry-point for setting expectations.
|
||||
/// </summary>
|
||||
/// <typeparam name="TInterface">Mocking interface</typeparam>
|
||||
/// <param name="expression">Target expression</param>
|
||||
/// <returns>
|
||||
/// Reference to <see cref="FuncExpectation{TResult}"/> to setup the mock.
|
||||
/// </returns>
|
||||
public FuncExpectation<object> Arrange<TInterface>(Expression<Func<TInterface, object>> expression)
|
||||
{
|
||||
return this.serviceLocator.GetInstance<TInterface>().Arrange(expression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry-point for setting expectations.
|
||||
/// </summary>
|
||||
/// <typeparam name="TInterface">Mocking interface</typeparam>
|
||||
/// <param name="expression">Target expression</param>
|
||||
/// <param name="take">Specifics the instance to resolve.</param>
|
||||
/// <returns>
|
||||
/// Reference to <see cref="FuncExpectation{TResult}" /> to setup the mock.
|
||||
/// </returns>
|
||||
public FuncExpectation<object> Arrange<TInterface>(Expression<Func<TInterface, object>> expression, Take take)
|
||||
{
|
||||
return take.Instance<TInterface>(this.serviceLocator).Arrange(expression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry-point for setting expectations.
|
||||
/// </summary>
|
||||
/// <typeparam name="TInterface">
|
||||
/// Mocking interface
|
||||
/// </typeparam>
|
||||
/// <param name="expression">Target expression</param>
|
||||
/// <param name="take">Specifics the instance to resolve</param>
|
||||
/// <returns>
|
||||
/// Reference to <see cref="ActionExpectation"/> to setup the mock.
|
||||
/// </returns>
|
||||
public ActionExpectation Arrange<TInterface>(Expression<Action<TInterface>> expression)
|
||||
{
|
||||
return this.serviceLocator.GetInstance<TInterface>().Arrange(expression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry-point for setting expectations.
|
||||
/// </summary>
|
||||
/// <typeparam name="TInterface">
|
||||
/// Mocking interface
|
||||
/// </typeparam>
|
||||
/// <param name="expression">Target expression</param>
|
||||
/// <param name="take">Specifics the instance to resolve.</param>
|
||||
/// <returns>
|
||||
/// Reference to <see cref="ActionExpectation"/> to setup the mock.
|
||||
/// </returns>
|
||||
public ActionExpectation Arrange<TInterface>(Expression<Action<TInterface>> expression, Take take)
|
||||
{
|
||||
return take.Instance<TInterface>(this.serviceLocator).Arrange(expression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts all expected setups.
|
||||
/// </summary>
|
||||
public void AssertAll()
|
||||
{
|
||||
foreach (Type serviceType in dependencies)
|
||||
{
|
||||
this.serviceLocator.GetAllInstances(serviceType).ToList().ForEach(x => x.AssertAll());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts all expected calls that are marked as must or
|
||||
/// to be occurred a certain number of times.
|
||||
/// </summary>
|
||||
public void Assert()
|
||||
{
|
||||
foreach (Type serviceType in dependencies)
|
||||
{
|
||||
this.serviceLocator.GetAllInstances(serviceType).ToList().ForEach(x => x.Assert());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts the specific call
|
||||
/// </summary>
|
||||
/// <typeparam name="TService">Service type.</typeparam>
|
||||
/// <param name="expression">Target expression.</param>
|
||||
public void Assert<TService>(Expression<Action<TService>> expression)
|
||||
{
|
||||
this.serviceLocator.GetInstance<TService>().Assert(expression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts the specific call
|
||||
/// </summary>
|
||||
/// <typeparam name="TService">Service type.</typeparam>
|
||||
/// <param name="expression">Target expression</param>
|
||||
public void Assert<TService>(Expression<Func<TService, object>> expression)
|
||||
{
|
||||
Assert(expression, Occurs.NotAvailable());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts a specific dependency
|
||||
/// </summary>
|
||||
/// <typeparam name="TService">Service type.</typeparam>
|
||||
public void Assert<TService>()
|
||||
{
|
||||
this.serviceLocator.GetInstance<TService>().Assert();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts a specific dependency
|
||||
/// </summary>
|
||||
/// <typeparam name="TService">Service Type.</typeparam>
|
||||
/// <param name="take">Specifies the instance to resolve.</param>
|
||||
public void Assert<TService>(Take take)
|
||||
{
|
||||
take.Instance<TService>(this.serviceLocator).Assert();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts the specific call
|
||||
/// </summary>
|
||||
/// <typeparam name="TService">Service Type.</typeparam>
|
||||
/// <param name="expression">Target expression.</param>
|
||||
/// <param name="occurs">Specifies the number of times a mock call should occur.</param>
|
||||
public void Assert<TService>(Expression<Func<TService, object>> expression, Occurs occurs)
|
||||
{
|
||||
this.serviceLocator.GetInstance<TService>().Assert(expression, occurs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts the specific call
|
||||
/// </summary>
|
||||
/// <typeparam name="TService">Service Type.</typeparam>
|
||||
/// <param name="expression">Target expression</param>
|
||||
/// <param name="occurs">Specifies the number of times a mock call should occur.</param>
|
||||
public void Assert<TService>(Expression<Action<TService>> expression, Occurs occurs)
|
||||
{
|
||||
this.serviceLocator.GetInstance<TService>().Assert(expression, occurs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts the specific call
|
||||
/// </summary>
|
||||
/// <typeparam name="TService">Service Type.</typeparam>
|
||||
/// <param name="expression">Target expression.</param>
|
||||
/// <param name="take">Specifies the instance to resolve.</param>
|
||||
public void Assert<TService>(Expression<Func<TService, object>> expression, Take take)
|
||||
{
|
||||
take.Instance<TService>(this.serviceLocator).Assert(expression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts the specific call
|
||||
/// </summary>
|
||||
/// <typeparam name="TService">Service Type.</typeparam>
|
||||
/// <param name="expression">Target expression.</param>
|
||||
/// <param name="take">Specifies the instance to resolve.</param>
|
||||
public void Assert<TService>(Expression<Action<TService>> expression, Take take)
|
||||
{
|
||||
take.Instance<TService>(this.serviceLocator).Assert(expression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts the specific call
|
||||
/// </summary>
|
||||
/// <typeparam name="TService">Service Type.</typeparam>
|
||||
/// <param name="expression">Target expression.</param>
|
||||
/// <param name="occurs">Specifies the number of times a mock call should occur.</param>
|
||||
/// <param name="take">Specifies the instance to resolve.</param>
|
||||
public void Assert<TService>(Expression<Func<TService, object>> expression, Occurs occurs, Take take)
|
||||
{
|
||||
take.Instance<TService>(this.serviceLocator).Assert(expression, occurs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts the specific call
|
||||
/// </summary>
|
||||
/// <typeparam name="TService">Service Type.</typeparam>
|
||||
/// <param name="expression">Target expression.</param>
|
||||
/// <param name="occurs">Specifies the number of times a mock call should occur.</param>
|
||||
/// <param name="take">Specifies the instance to resolve.</param>
|
||||
public void Assert<TService>(Expression<Action<TService>> expression, Occurs occurs, Take take)
|
||||
{
|
||||
take.Instance<TService>(this.serviceLocator).Assert(expression, occurs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the registered service instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="TService">Service Type.</typeparam>
|
||||
/// <returns>The resolved instance.</returns>
|
||||
public TService Get<TService>()
|
||||
{
|
||||
return this.serviceLocator.GetInstance<TService>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the registered service instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="TService">The type of instance to resolve.</typeparam>
|
||||
/// <param name="take">Specifies the kind of instance to resolve.</param>
|
||||
/// <returns>The resolved instance.</returns>
|
||||
public TService Get<TService>(Take take)
|
||||
{
|
||||
return take.Instance<TService>(this.serviceLocator);
|
||||
}
|
||||
|
||||
private void RegisterDependencies(Type targetType, params Type[] dependenciesType)
|
||||
{
|
||||
foreach (var constructor in targetType.GetConstructors())
|
||||
{
|
||||
var parameterInfos = constructor.GetParameters();
|
||||
foreach (var parameterInfo in parameterInfos)
|
||||
{
|
||||
RegisterService(parameterInfo.ParameterType);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RegisterService(Type serviceType)
|
||||
{
|
||||
if (!serviceType.IsInterface && serviceType.GetConstructors().Length > 0)
|
||||
{
|
||||
if (serviceType.GetConstructor(Type.EmptyTypes) == null)
|
||||
{
|
||||
RegisterDependencies(serviceType);
|
||||
AppendToDependenciesList(serviceType);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (serviceType.IsSealed && !Mock.IsProfilerEnabled)
|
||||
throw new AutoMockException(Messages.ProfilerMustBeEnabled);
|
||||
|
||||
container.Register(serviceType, Mock.Create(serviceType));
|
||||
|
||||
AppendToDependenciesList(serviceType);
|
||||
}
|
||||
|
||||
private void AppendToDependenciesList(Type serviceType)
|
||||
{
|
||||
if (!dependencies.Contains(serviceType))
|
||||
dependencies.Add(serviceType);
|
||||
}
|
||||
|
||||
private readonly IList dependencies;
|
||||
private readonly IContainer container;
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
JustMock Lite
|
||||
Copyright © 2010-2014 Telerik AD
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Telerik.JustMock.Container")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("07ed19c4-e5d5-43b3-8ba5-d296311af3c4")]
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
JustMock Lite
|
||||
Copyright © 2010-2014 Telerik AD
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.Practices.ServiceLocation;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Telerik.JustMock.Container
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the auto mocking instance to resolve.
|
||||
/// </summary>
|
||||
public sealed class Take
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Take" /> class.
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate of the instance.</param>
|
||||
public Take(Expression<Func<IServiceLocator, Type, object>> predicate)
|
||||
{
|
||||
this.predicate = predicate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies to resolve the first instance.
|
||||
/// </summary>
|
||||
/// <returns>Take configuration.</returns>
|
||||
public static Take First()
|
||||
{
|
||||
return new Take((serviceLocator, x) => serviceLocator.GetAllInstances(x).First());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies to resolve the last instance.
|
||||
/// </summary>
|
||||
/// <returns>Take configuration.</returns>
|
||||
public static Take Last()
|
||||
{
|
||||
return new Take((serviceLocator, x) => serviceLocator.GetAllInstances(x).Last());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies to resolve instance at index.
|
||||
/// </summary>
|
||||
/// <param name="index">Position of the instance that will be taken.</param>
|
||||
/// <returns>Take configuration.</returns>
|
||||
public static Take At(int index)
|
||||
{
|
||||
return new Take((serviceLocator, x) => serviceLocator.GetAllInstances(x).Skip(index).First());
|
||||
}
|
||||
|
||||
internal TInterface Instance<TInterface>(IServiceLocator serviceLocator)
|
||||
{
|
||||
return (TInterface) predicate.Compile()(serviceLocator, typeof(TInterface));
|
||||
}
|
||||
|
||||
private readonly Expression<Func<IServiceLocator, Type, object>> predicate;
|
||||
}
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{780F30EF-9715-4FA4-A4CD-7410F86D0853}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Telerik.JustMock.Container</RootNamespace>
|
||||
<AssemblyName>Telerik.JustMock.Container</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\Binaries\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\..\Binaries\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>..\..\..\Binaries\Release\Telerik.JustMock.Container.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>..\Solution Items\snkey_lite.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseFree|AnyCPU'">
|
||||
<OutputPath>..\..\..\Binaries\ReleaseFree\</OutputPath>
|
||||
<DefineConstants>TRACE;LITE_EDITION</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
|
||||
<DocumentationFile>..\..\..\Binaries\ReleaseFree\Telerik.JustMock.Container.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugFree|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\..\Binaries\DebugFree\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;LITE_EDITION</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Practices.ServiceLocation">
|
||||
<HintPath>..\packages\CommonServiceLocator.1.0\lib\NET35\Microsoft.Practices.ServiceLocation.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Practices.Unity, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Unity.2.1.505.2\lib\NET35\Microsoft.Practices.Unity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Practices.Unity.Configuration">
|
||||
<HintPath>..\packages\Unity.2.1.505.2\lib\NET35\Microsoft.Practices.Unity.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\JustMockLite\CommonAssemblyInfo.cs">
|
||||
<Link>Properties\CommonAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Abstraction\IContainer.cs" />
|
||||
<Compile Include="AutoMockException.cs" />
|
||||
<Compile Include="JustMockServiceLocator.cs" />
|
||||
<Compile Include="Messages.Designer.cs" />
|
||||
<Compile Include="MockingContainer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Take.cs" />
|
||||
<Compile Include="UnityContainer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Messages.resx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\JustMockLite\Telerik.JustMock\Telerik.JustMock.csproj">
|
||||
<Project>{0749EBC2-4E83-4960-BF28-1FF5C2DEB2B9}</Project>
|
||||
<Name>Telerik.JustMock</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Solution Items\snkey_lite.snk">
|
||||
<Link>snkey_lite.snk</Link>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -1,126 +0,0 @@
|
|||
/*
|
||||
JustMock Lite
|
||||
Copyright © 2010-2014 Telerik AD
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Microsoft.Practices.Unity;
|
||||
using Telerik.JustMock.Container.Abstraction;
|
||||
|
||||
namespace Telerik.JustMock.Container
|
||||
{
|
||||
/// <summary>
|
||||
/// Wrapper over original unity container.
|
||||
/// </summary>
|
||||
public class UnityContainer : IContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UnityContainer" /> class.
|
||||
/// </summary>
|
||||
/// <param name="dependenciesType">Type of the dependencies.</param>
|
||||
public UnityContainer(params Type[] dependenciesType)
|
||||
{
|
||||
this.dependenciesType = dependenciesType;
|
||||
this.container = new Microsoft.Practices.Unity.UnityContainer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the specified instance for its corresponding type.
|
||||
/// </summary>
|
||||
/// <param name="serviceType">Corresponding type.</param>
|
||||
/// <param name="instance">Instance to be registered.</param>
|
||||
public void Register(Type serviceType, object instance)
|
||||
{
|
||||
string instanceName = string.Format("{0}+{1}", serviceType.Name, instance.GetHashCode());
|
||||
|
||||
if (!container.IsRegistered(serviceType, instanceName))
|
||||
{
|
||||
container.RegisterInstance(serviceType, instanceName, instance);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolve the target type with necessary dependencies.
|
||||
/// </summary>
|
||||
/// <param name="serviceType">Service type.</param>
|
||||
/// <returns>Resolved object.</returns>
|
||||
public object Resolve(Type serviceType)
|
||||
{
|
||||
var instance = ResolveAll(serviceType).FirstOrDefault();
|
||||
if (instance != null)
|
||||
return instance;
|
||||
|
||||
if (!serviceType.IsInterface)
|
||||
{
|
||||
var constructor = serviceType.GetConstructor(dependenciesType);
|
||||
|
||||
if (constructor == null && dependenciesType.Length == 0)
|
||||
constructor = serviceType.GetConstructors().FirstOrDefault();
|
||||
|
||||
if (constructor.GetParameters().Length > 0)
|
||||
return ResolveInstance(constructor);
|
||||
else
|
||||
return constructor.Invoke(null);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private object ResolveInstance(ConstructorInfo constructor)
|
||||
{
|
||||
var parameterInfos = constructor.GetParameters();
|
||||
|
||||
var parameters = new List<object>();
|
||||
|
||||
int count = 0;
|
||||
Type lastParameterType = null;
|
||||
|
||||
for (int index = 0; index < parameterInfos.Length; index++)
|
||||
{
|
||||
Type parameterType = parameterInfos[index].ParameterType;
|
||||
if (lastParameterType != parameterType)
|
||||
count = 0;
|
||||
|
||||
IList<object> instances = ResolveAll(parameterType);
|
||||
|
||||
// add the concrete type directly if not registered.
|
||||
if (instances.Count > 0)
|
||||
parameters.Add(instances[count++]);
|
||||
else if (parameterType.IsClass)
|
||||
parameters.Add(ResolveInstance(parameterType.GetConstructors().First()));
|
||||
|
||||
lastParameterType = parameterType;
|
||||
}
|
||||
|
||||
return constructor.Invoke(parameters.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves all registered instances for a specific service type.
|
||||
/// </summary>
|
||||
/// <param name="serviceType">Service type.</param>
|
||||
/// <returns>Returns collection of the resolved objects.</returns>
|
||||
public IList<object> ResolveAll(Type serviceType)
|
||||
{
|
||||
return container.ResolveAll(serviceType).ToList();
|
||||
}
|
||||
|
||||
private readonly IUnityContainer container;
|
||||
private readonly Type[] dependenciesType;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telerik.JustMock", "Telerik.JustMock\Telerik.JustMock.csproj", "{0749EBC2-4E83-4960-BF28-1FF5C2DEB2B9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telerik.JustMock.Silverlight", "Telerik.JustMock.Silverlight\Telerik.JustMock.Silverlight.csproj", "{C06AD7FF-E22C-4EAD-B1DB-0588E906D6CA}"
|
||||
|
@ -9,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telerik.JustMock.Silverligh
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telerik.JustMock.Tests", "Telerik.JustMock.Tests\Telerik.JustMock.Tests.csproj", "{83F0C270-DB35-4B80-BEDA-5AED79C0FB2D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telerik.JustMock.Container", "Telerik.JustMock.Container\Telerik.JustMock.Container.csproj", "{780F30EF-9715-4FA4-A4CD-7410F86D0853}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telerik.JustMock.DemoLib", "Telerik.JustMock.DemoLib\Telerik.JustMock.DemoLib.csproj", "{1F725764-5FB5-475D-9BF2-355F073E3233}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Telerik.JustMock.DemoLibSigned", "Telerik.JustMock.DemoLibSigned\Telerik.JustMock.DemoLibSigned.csproj", "{84156592-CA84-4B6D-83F2-DCFE9E4843F0}"
|
||||
|
@ -32,8 +32,8 @@ Global
|
|||
{0749EBC2-4E83-4960-BF28-1FF5C2DEB2B9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0749EBC2-4E83-4960-BF28-1FF5C2DEB2B9}.ReleaseFree|Any CPU.ActiveCfg = ReleaseFree|Any CPU
|
||||
{0749EBC2-4E83-4960-BF28-1FF5C2DEB2B9}.ReleaseFree|Any CPU.Build.0 = ReleaseFree|Any CPU
|
||||
{0749EBC2-4E83-4960-BF28-1FF5C2DEB2B9}.ReleaseTrial|Any CPU.ActiveCfg = ReleaseTrial|Any CPU
|
||||
{0749EBC2-4E83-4960-BF28-1FF5C2DEB2B9}.ReleaseTrial|Any CPU.Build.0 = ReleaseTrial|Any CPU
|
||||
{0749EBC2-4E83-4960-BF28-1FF5C2DEB2B9}.ReleaseTrial|Any CPU.ActiveCfg = ReleaseFree|Any CPU
|
||||
{0749EBC2-4E83-4960-BF28-1FF5C2DEB2B9}.ReleaseTrial|Any CPU.Build.0 = ReleaseFree|Any CPU
|
||||
{C06AD7FF-E22C-4EAD-B1DB-0588E906D6CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C06AD7FF-E22C-4EAD-B1DB-0588E906D6CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C06AD7FF-E22C-4EAD-B1DB-0588E906D6CA}.DebugFree|Any CPU.ActiveCfg = DebugFree|Any CPU
|
||||
|
@ -42,8 +42,8 @@ Global
|
|||
{C06AD7FF-E22C-4EAD-B1DB-0588E906D6CA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C06AD7FF-E22C-4EAD-B1DB-0588E906D6CA}.ReleaseFree|Any CPU.ActiveCfg = ReleaseFree|Any CPU
|
||||
{C06AD7FF-E22C-4EAD-B1DB-0588E906D6CA}.ReleaseFree|Any CPU.Build.0 = ReleaseFree|Any CPU
|
||||
{C06AD7FF-E22C-4EAD-B1DB-0588E906D6CA}.ReleaseTrial|Any CPU.ActiveCfg = ReleaseTrial|Any CPU
|
||||
{C06AD7FF-E22C-4EAD-B1DB-0588E906D6CA}.ReleaseTrial|Any CPU.Build.0 = ReleaseTrial|Any CPU
|
||||
{C06AD7FF-E22C-4EAD-B1DB-0588E906D6CA}.ReleaseTrial|Any CPU.ActiveCfg = ReleaseFree|Any CPU
|
||||
{C06AD7FF-E22C-4EAD-B1DB-0588E906D6CA}.ReleaseTrial|Any CPU.Build.0 = ReleaseFree|Any CPU
|
||||
{0652C434-40F7-4C58-92C8-F4FAE0CB5922}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0652C434-40F7-4C58-92C8-F4FAE0CB5922}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0652C434-40F7-4C58-92C8-F4FAE0CB5922}.DebugFree|Any CPU.ActiveCfg = DebugFree|Any CPU
|
||||
|
@ -52,8 +52,8 @@ Global
|
|||
{0652C434-40F7-4C58-92C8-F4FAE0CB5922}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0652C434-40F7-4C58-92C8-F4FAE0CB5922}.ReleaseFree|Any CPU.ActiveCfg = ReleaseFree|Any CPU
|
||||
{0652C434-40F7-4C58-92C8-F4FAE0CB5922}.ReleaseFree|Any CPU.Build.0 = ReleaseFree|Any CPU
|
||||
{0652C434-40F7-4C58-92C8-F4FAE0CB5922}.ReleaseTrial|Any CPU.ActiveCfg = ReleaseTrial|Any CPU
|
||||
{0652C434-40F7-4C58-92C8-F4FAE0CB5922}.ReleaseTrial|Any CPU.Build.0 = ReleaseTrial|Any CPU
|
||||
{0652C434-40F7-4C58-92C8-F4FAE0CB5922}.ReleaseTrial|Any CPU.ActiveCfg = ReleaseFree|Any CPU
|
||||
{0652C434-40F7-4C58-92C8-F4FAE0CB5922}.ReleaseTrial|Any CPU.Build.0 = ReleaseFree|Any CPU
|
||||
{83F0C270-DB35-4B80-BEDA-5AED79C0FB2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{83F0C270-DB35-4B80-BEDA-5AED79C0FB2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{83F0C270-DB35-4B80-BEDA-5AED79C0FB2D}.DebugFree|Any CPU.ActiveCfg = DebugFree|Any CPU
|
||||
|
@ -64,16 +64,6 @@ Global
|
|||
{83F0C270-DB35-4B80-BEDA-5AED79C0FB2D}.ReleaseFree|Any CPU.Build.0 = ReleaseFree|Any CPU
|
||||
{83F0C270-DB35-4B80-BEDA-5AED79C0FB2D}.ReleaseTrial|Any CPU.ActiveCfg = ReleaseFree|Any CPU
|
||||
{83F0C270-DB35-4B80-BEDA-5AED79C0FB2D}.ReleaseTrial|Any CPU.Build.0 = ReleaseFree|Any CPU
|
||||
{780F30EF-9715-4FA4-A4CD-7410F86D0853}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{780F30EF-9715-4FA4-A4CD-7410F86D0853}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{780F30EF-9715-4FA4-A4CD-7410F86D0853}.DebugFree|Any CPU.ActiveCfg = DebugFree|Any CPU
|
||||
{780F30EF-9715-4FA4-A4CD-7410F86D0853}.DebugFree|Any CPU.Build.0 = DebugFree|Any CPU
|
||||
{780F30EF-9715-4FA4-A4CD-7410F86D0853}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{780F30EF-9715-4FA4-A4CD-7410F86D0853}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{780F30EF-9715-4FA4-A4CD-7410F86D0853}.ReleaseFree|Any CPU.ActiveCfg = ReleaseFree|Any CPU
|
||||
{780F30EF-9715-4FA4-A4CD-7410F86D0853}.ReleaseFree|Any CPU.Build.0 = ReleaseFree|Any CPU
|
||||
{780F30EF-9715-4FA4-A4CD-7410F86D0853}.ReleaseTrial|Any CPU.ActiveCfg = ReleaseTrial|Any CPU
|
||||
{780F30EF-9715-4FA4-A4CD-7410F86D0853}.ReleaseTrial|Any CPU.Build.0 = ReleaseTrial|Any CPU
|
||||
{1F725764-5FB5-475D-9BF2-355F073E3233}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1F725764-5FB5-475D-9BF2-355F073E3233}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1F725764-5FB5-475D-9BF2-355F073E3233}.DebugFree|Any CPU.ActiveCfg = DebugFree|Any CPU
|
||||
|
|
Двоичный файл не отображается.
|
@ -1,280 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Microsoft.Practices.ServiceLocation</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Microsoft.Practices.ServiceLocation.ActivationException">
|
||||
<summary>
|
||||
The standard exception thrown when a ServiceLocator has an error in resolving an object.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:System.Exception" /> class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:System.Exception" /> class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">
|
||||
The message that describes the error.
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:System.Exception" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.
|
||||
</summary>
|
||||
<param name="message">
|
||||
The error message that explains the reason for the exception.
|
||||
</param>
|
||||
<param name="innerException">
|
||||
The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:System.Exception" /> class with serialized data.
|
||||
</summary>
|
||||
<param name="info">
|
||||
The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.
|
||||
</param>
|
||||
<param name="context">
|
||||
The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.
|
||||
</param>
|
||||
<exception cref="T:System.ArgumentNullException">
|
||||
The <paramref name="info" /> parameter is null.
|
||||
</exception>
|
||||
<exception cref="T:System.Runtime.Serialization.SerializationException">
|
||||
The class name is null or <see cref="P:System.Exception.HResult" /> is zero (0).
|
||||
</exception>
|
||||
</member>
|
||||
<member name="T:Microsoft.Practices.ServiceLocation.IServiceLocator">
|
||||
<summary>
|
||||
The generic Service Locator interface. This interface is used
|
||||
to retrieve services (instances identified by type and optional
|
||||
name) from a container.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance(System.Type)">
|
||||
<summary>
|
||||
Get an instance of the given <paramref name="serviceType"/>.
|
||||
</summary>
|
||||
<param name="serviceType">Type of object requested.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance(System.Type,System.String)">
|
||||
<summary>
|
||||
Get an instance of the given named <paramref name="serviceType"/>.
|
||||
</summary>
|
||||
<param name="serviceType">Type of object requested.</param>
|
||||
<param name="key">Name the object was registered with.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetAllInstances(System.Type)">
|
||||
<summary>
|
||||
Get all instances of the given <paramref name="serviceType"/> currently
|
||||
registered in the container.
|
||||
</summary>
|
||||
<param name="serviceType">Type of object requested.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>A sequence of instances of the requested <paramref name="serviceType"/>.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance``1">
|
||||
<summary>
|
||||
Get an instance of the given <typeparamref name="TService"/>.
|
||||
</summary>
|
||||
<typeparam name="TService">Type of object requested.</typeparam>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance``1(System.String)">
|
||||
<summary>
|
||||
Get an instance of the given named <typeparamref name="TService"/>.
|
||||
</summary>
|
||||
<typeparam name="TService">Type of object requested.</typeparam>
|
||||
<param name="key">Name the object was registered with.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetAllInstances``1">
|
||||
<summary>
|
||||
Get all instances of the given <typeparamref name="TService"/> currently
|
||||
registered in the container.
|
||||
</summary>
|
||||
<typeparam name="TService">Type of object requested.</typeparam>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>A sequence of instances of the requested <typeparamref name="TService"/>.</returns>
|
||||
</member>
|
||||
<member name="T:Microsoft.Practices.ServiceLocation.Properties.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.ActivateAllExceptionMessage">
|
||||
<summary>
|
||||
Looks up a localized string similar to Activation error occured while trying to get all instances of type {0}.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.ActivationExceptionMessage">
|
||||
<summary>
|
||||
Looks up a localized string similar to Activation error occured while trying to get instance of type {0}, key "{1}".
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Microsoft.Practices.ServiceLocation.ServiceLocator">
|
||||
<summary>
|
||||
This class provides the ambient container for this application. If your
|
||||
framework defines such an ambient container, use ServiceLocator.Current
|
||||
to get it.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocator.SetLocatorProvider(Microsoft.Practices.ServiceLocation.ServiceLocatorProvider)">
|
||||
<summary>
|
||||
Set the delegate that is used to retrieve the current container.
|
||||
</summary>
|
||||
<param name="newProvider">Delegate that, when called, will return
|
||||
the current ambient container.</param>
|
||||
</member>
|
||||
<member name="P:Microsoft.Practices.ServiceLocation.ServiceLocator.Current">
|
||||
<summary>
|
||||
The current ambient container.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase">
|
||||
<summary>
|
||||
This class is a helper that provides a default implementation
|
||||
for most of the methods of <see cref="T:Microsoft.Practices.ServiceLocation.IServiceLocator"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetService(System.Type)">
|
||||
<summary>
|
||||
Implementation of <see cref="M:System.IServiceProvider.GetService(System.Type)"/>.
|
||||
</summary>
|
||||
<param name="serviceType">The requested service.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error in resolving the service instance.</exception>
|
||||
<returns>The requested object.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(System.Type)">
|
||||
<summary>
|
||||
Get an instance of the given <paramref name="serviceType"/>.
|
||||
</summary>
|
||||
<param name="serviceType">Type of object requested.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(System.Type,System.String)">
|
||||
<summary>
|
||||
Get an instance of the given named <paramref name="serviceType"/>.
|
||||
</summary>
|
||||
<param name="serviceType">Type of object requested.</param>
|
||||
<param name="key">Name the object was registered with.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetAllInstances(System.Type)">
|
||||
<summary>
|
||||
Get all instances of the given <paramref name="serviceType"/> currently
|
||||
registered in the container.
|
||||
</summary>
|
||||
<param name="serviceType">Type of object requested.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>A sequence of instances of the requested <paramref name="serviceType"/>.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance``1">
|
||||
<summary>
|
||||
Get an instance of the given <typeparamref name="TService"/>.
|
||||
</summary>
|
||||
<typeparam name="TService">Type of object requested.</typeparam>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance``1(System.String)">
|
||||
<summary>
|
||||
Get an instance of the given named <typeparamref name="TService"/>.
|
||||
</summary>
|
||||
<typeparam name="TService">Type of object requested.</typeparam>
|
||||
<param name="key">Name the object was registered with.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetAllInstances``1">
|
||||
<summary>
|
||||
Get all instances of the given <typeparamref name="TService"/> currently
|
||||
registered in the container.
|
||||
</summary>
|
||||
<typeparam name="TService">Type of object requested.</typeparam>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>A sequence of instances of the requested <typeparamref name="TService"/>.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.DoGetInstance(System.Type,System.String)">
|
||||
<summary>
|
||||
When implemented by inheriting classes, this method will do the actual work of resolving
|
||||
the requested service instance.
|
||||
</summary>
|
||||
<param name="serviceType">Type of instance requested.</param>
|
||||
<param name="key">Name of registered service you want. May be null.</param>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.DoGetAllInstances(System.Type)">
|
||||
<summary>
|
||||
When implemented by inheriting classes, this method will do the actual work of
|
||||
resolving all the requested service instances.
|
||||
</summary>
|
||||
<param name="serviceType">Type of service requested.</param>
|
||||
<returns>Sequence of service instance objects.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.FormatActivationExceptionMessage(System.Exception,System.Type,System.String)">
|
||||
<summary>
|
||||
Format the exception message for use in an <see cref="T:Microsoft.Practices.ServiceLocation.ActivationException"/>
|
||||
that occurs while resolving a single service.
|
||||
</summary>
|
||||
<param name="actualException">The actual exception thrown by the implementation.</param>
|
||||
<param name="serviceType">Type of service requested.</param>
|
||||
<param name="key">Name requested.</param>
|
||||
<returns>The formatted exception message string.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.FormatActivateAllExceptionMessage(System.Exception,System.Type)">
|
||||
<summary>
|
||||
Format the exception message for use in an <see cref="T:Microsoft.Practices.ServiceLocation.ActivationException"/>
|
||||
that occurs while resolving multiple service instances.
|
||||
</summary>
|
||||
<param name="actualException">The actual exception thrown by the implementation.</param>
|
||||
<param name="serviceType">Type of service requested.</param>
|
||||
<returns>The formatted exception message string.</returns>
|
||||
</member>
|
||||
<member name="T:Microsoft.Practices.ServiceLocation.ServiceLocatorProvider">
|
||||
<summary>
|
||||
This delegate type is used to provide a method that will
|
||||
return the current container. Used with the <see cref="T:Microsoft.Practices.ServiceLocation.ServiceLocator"/>
|
||||
static accessor class.
|
||||
</summary>
|
||||
<returns>An <see cref="T:Microsoft.Practices.ServiceLocation.IServiceLocator"/>.</returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
Двоичные данные
packages/CommonServiceLocator.1.0/lib/NET35/Microsoft.Practices.ServiceLocation.dll
поставляемый
Двоичные данные
packages/CommonServiceLocator.1.0/lib/NET35/Microsoft.Practices.ServiceLocation.dll
поставляемый
Двоичный файл не отображается.
Двоичные данные
packages/CommonServiceLocator.1.0/lib/NET35/Microsoft.Practices.ServiceLocation.pdb
поставляемый
Двоичные данные
packages/CommonServiceLocator.1.0/lib/NET35/Microsoft.Practices.ServiceLocation.pdb
поставляемый
Двоичный файл не отображается.
|
@ -1,280 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Microsoft.Practices.ServiceLocation</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Microsoft.Practices.ServiceLocation.ActivationException">
|
||||
<summary>
|
||||
The standard exception thrown when a ServiceLocator has an error in resolving an object.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:System.Exception" /> class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:System.Exception" /> class with a specified error message.
|
||||
</summary>
|
||||
<param name="message">
|
||||
The message that describes the error.
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor(System.String,System.Exception)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:System.Exception" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.
|
||||
</summary>
|
||||
<param name="message">
|
||||
The error message that explains the reason for the exception.
|
||||
</param>
|
||||
<param name="innerException">
|
||||
The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:System.Exception" /> class with serialized data.
|
||||
</summary>
|
||||
<param name="info">
|
||||
The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.
|
||||
</param>
|
||||
<param name="context">
|
||||
The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.
|
||||
</param>
|
||||
<exception cref="T:System.ArgumentNullException">
|
||||
The <paramref name="info" /> parameter is null.
|
||||
</exception>
|
||||
<exception cref="T:System.Runtime.Serialization.SerializationException">
|
||||
The class name is null or <see cref="P:System.Exception.HResult" /> is zero (0).
|
||||
</exception>
|
||||
</member>
|
||||
<member name="T:Microsoft.Practices.ServiceLocation.IServiceLocator">
|
||||
<summary>
|
||||
The generic Service Locator interface. This interface is used
|
||||
to retrieve services (instances identified by type and optional
|
||||
name) from a container.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance(System.Type)">
|
||||
<summary>
|
||||
Get an instance of the given <paramref name="serviceType"/>.
|
||||
</summary>
|
||||
<param name="serviceType">Type of object requested.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance(System.Type,System.String)">
|
||||
<summary>
|
||||
Get an instance of the given named <paramref name="serviceType"/>.
|
||||
</summary>
|
||||
<param name="serviceType">Type of object requested.</param>
|
||||
<param name="key">Name the object was registered with.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetAllInstances(System.Type)">
|
||||
<summary>
|
||||
Get all instances of the given <paramref name="serviceType"/> currently
|
||||
registered in the container.
|
||||
</summary>
|
||||
<param name="serviceType">Type of object requested.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>A sequence of instances of the requested <paramref name="serviceType"/>.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance``1">
|
||||
<summary>
|
||||
Get an instance of the given <typeparamref name="TService"/>.
|
||||
</summary>
|
||||
<typeparam name="TService">Type of object requested.</typeparam>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance``1(System.String)">
|
||||
<summary>
|
||||
Get an instance of the given named <typeparamref name="TService"/>.
|
||||
</summary>
|
||||
<typeparam name="TService">Type of object requested.</typeparam>
|
||||
<param name="key">Name the object was registered with.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetAllInstances``1">
|
||||
<summary>
|
||||
Get all instances of the given <typeparamref name="TService"/> currently
|
||||
registered in the container.
|
||||
</summary>
|
||||
<typeparam name="TService">Type of object requested.</typeparam>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>A sequence of instances of the requested <typeparamref name="TService"/>.</returns>
|
||||
</member>
|
||||
<member name="T:Microsoft.Practices.ServiceLocation.Properties.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.ActivateAllExceptionMessage">
|
||||
<summary>
|
||||
Looks up a localized string similar to Activation error occured while trying to get all instances of type {0}.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.ActivationExceptionMessage">
|
||||
<summary>
|
||||
Looks up a localized string similar to Activation error occured while trying to get instance of type {0}, key "{1}".
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Microsoft.Practices.ServiceLocation.ServiceLocator">
|
||||
<summary>
|
||||
This class provides the ambient container for this application. If your
|
||||
framework defines such an ambient container, use ServiceLocator.Current
|
||||
to get it.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocator.SetLocatorProvider(Microsoft.Practices.ServiceLocation.ServiceLocatorProvider)">
|
||||
<summary>
|
||||
Set the delegate that is used to retrieve the current container.
|
||||
</summary>
|
||||
<param name="newProvider">Delegate that, when called, will return
|
||||
the current ambient container.</param>
|
||||
</member>
|
||||
<member name="P:Microsoft.Practices.ServiceLocation.ServiceLocator.Current">
|
||||
<summary>
|
||||
The current ambient container.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase">
|
||||
<summary>
|
||||
This class is a helper that provides a default implementation
|
||||
for most of the methods of <see cref="T:Microsoft.Practices.ServiceLocation.IServiceLocator"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetService(System.Type)">
|
||||
<summary>
|
||||
Implementation of <see cref="M:System.IServiceProvider.GetService(System.Type)"/>.
|
||||
</summary>
|
||||
<param name="serviceType">The requested service.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error in resolving the service instance.</exception>
|
||||
<returns>The requested object.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(System.Type)">
|
||||
<summary>
|
||||
Get an instance of the given <paramref name="serviceType"/>.
|
||||
</summary>
|
||||
<param name="serviceType">Type of object requested.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(System.Type,System.String)">
|
||||
<summary>
|
||||
Get an instance of the given named <paramref name="serviceType"/>.
|
||||
</summary>
|
||||
<param name="serviceType">Type of object requested.</param>
|
||||
<param name="key">Name the object was registered with.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetAllInstances(System.Type)">
|
||||
<summary>
|
||||
Get all instances of the given <paramref name="serviceType"/> currently
|
||||
registered in the container.
|
||||
</summary>
|
||||
<param name="serviceType">Type of object requested.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>A sequence of instances of the requested <paramref name="serviceType"/>.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance``1">
|
||||
<summary>
|
||||
Get an instance of the given <typeparamref name="TService"/>.
|
||||
</summary>
|
||||
<typeparam name="TService">Type of object requested.</typeparam>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance``1(System.String)">
|
||||
<summary>
|
||||
Get an instance of the given named <typeparamref name="TService"/>.
|
||||
</summary>
|
||||
<typeparam name="TService">Type of object requested.</typeparam>
|
||||
<param name="key">Name the object was registered with.</param>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetAllInstances``1">
|
||||
<summary>
|
||||
Get all instances of the given <typeparamref name="TService"/> currently
|
||||
registered in the container.
|
||||
</summary>
|
||||
<typeparam name="TService">Type of object requested.</typeparam>
|
||||
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
||||
the service instance.</exception>
|
||||
<returns>A sequence of instances of the requested <typeparamref name="TService"/>.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.DoGetInstance(System.Type,System.String)">
|
||||
<summary>
|
||||
When implemented by inheriting classes, this method will do the actual work of resolving
|
||||
the requested service instance.
|
||||
</summary>
|
||||
<param name="serviceType">Type of instance requested.</param>
|
||||
<param name="key">Name of registered service you want. May be null.</param>
|
||||
<returns>The requested service instance.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.DoGetAllInstances(System.Type)">
|
||||
<summary>
|
||||
When implemented by inheriting classes, this method will do the actual work of
|
||||
resolving all the requested service instances.
|
||||
</summary>
|
||||
<param name="serviceType">Type of service requested.</param>
|
||||
<returns>Sequence of service instance objects.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.FormatActivationExceptionMessage(System.Exception,System.Type,System.String)">
|
||||
<summary>
|
||||
Format the exception message for use in an <see cref="T:Microsoft.Practices.ServiceLocation.ActivationException"/>
|
||||
that occurs while resolving a single service.
|
||||
</summary>
|
||||
<param name="actualException">The actual exception thrown by the implementation.</param>
|
||||
<param name="serviceType">Type of service requested.</param>
|
||||
<param name="key">Name requested.</param>
|
||||
<returns>The formatted exception message string.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.FormatActivateAllExceptionMessage(System.Exception,System.Type)">
|
||||
<summary>
|
||||
Format the exception message for use in an <see cref="T:Microsoft.Practices.ServiceLocation.ActivationException"/>
|
||||
that occurs while resolving multiple service instances.
|
||||
</summary>
|
||||
<param name="actualException">The actual exception thrown by the implementation.</param>
|
||||
<param name="serviceType">Type of service requested.</param>
|
||||
<returns>The formatted exception message string.</returns>
|
||||
</member>
|
||||
<member name="T:Microsoft.Practices.ServiceLocation.ServiceLocatorProvider">
|
||||
<summary>
|
||||
This delegate type is used to provide a method that will
|
||||
return the current container. Used with the <see cref="T:Microsoft.Practices.ServiceLocation.ServiceLocator"/>
|
||||
static accessor class.
|
||||
</summary>
|
||||
<returns>An <see cref="T:Microsoft.Practices.ServiceLocation.IServiceLocator"/>.</returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
Двоичные данные
packages/CommonServiceLocator.1.0/lib/SL30/Microsoft.Practices.ServiceLocation.dll
поставляемый
Двоичные данные
packages/CommonServiceLocator.1.0/lib/SL30/Microsoft.Practices.ServiceLocation.dll
поставляемый
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичные данные
packages/Unity.2.1.505.2/lib/NET35/Microsoft.Practices.Unity.Configuration.dll
поставляемый
Двоичные данные
packages/Unity.2.1.505.2/lib/NET35/Microsoft.Practices.Unity.Configuration.dll
поставляемый
Двоичный файл не отображается.
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Двоичный файл не отображается.
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Двоичные данные
packages/Unity.2.1.505.2/lib/SL30/Microsoft.Practices.Unity.Silverlight.dll
поставляемый
Двоичные данные
packages/Unity.2.1.505.2/lib/SL30/Microsoft.Practices.Unity.Silverlight.dll
поставляемый
Двоичный файл не отображается.
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Двоичный файл не отображается.
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче