forked from devlooped/moq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ILMerge so that Castle libraries are merged into MoQ assembly (no need for external references) Signed assembly. Updated help file. git-svn-id: http://moq.googlecode.com/svn/trunk@39 b33fba48-7441-0410-8d5c-f397f7ceaa6c
- Loading branch information
kzu.net
committed
Jan 3, 2008
1 parent
1229526
commit ecff466
Showing
22 changed files
with
4,192 additions
and
172 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,30 @@ | |
</assemblies> | ||
<namespaceSummaries> | ||
<namespaceSummaryItem name="" isDocumented="False" /> | ||
<namespaceSummaryItem name="Moq" isDocumented="True">Root namespace of Moq (pronounced "Mock-you"), the only mocking library for .NET developed from scratch to take full advantage of .NET 3.5 (i.e. Linq expression trees) and C# 3.0 features (i.e. lambda expressions) that make it the most productive, simple and refactoring-friendly mocking library available. | ||
<namespaceSummaryItem name="Castle.Core" isDocumented="False" /> | ||
<namespaceSummaryItem name="Castle.Core.Configuration" isDocumented="False" /> | ||
<namespaceSummaryItem name="Castle.Core.Interceptor" isDocumented="False" /> | ||
<namespaceSummaryItem name="Castle.Core.Internal" isDocumented="False" /> | ||
<namespaceSummaryItem name="Castle.Core.Logging" isDocumented="False" /> | ||
<namespaceSummaryItem name="Castle.Core.Logging.Factories" isDocumented="False" /> | ||
<namespaceSummaryItem name="Castle.Core.Resource" isDocumented="False" /> | ||
<namespaceSummaryItem name="Castle.DynamicProxy" isDocumented="False" /> | ||
<namespaceSummaryItem name="Castle.DynamicProxy.Generators" isDocumented="False" /> | ||
<namespaceSummaryItem name="Castle.DynamicProxy.Generators.Emitters" isDocumented="False" /> | ||
<namespaceSummaryItem name="Castle.DynamicProxy.Generators.Emitters.CodeBuilders" isDocumented="False" /> | ||
<namespaceSummaryItem name="Castle.DynamicProxy.Generators.Emitters.SimpleAST" isDocumented="False" /> | ||
<namespaceSummaryItem name="Castle.DynamicProxy.Serialization" isDocumented="False" /> | ||
<namespaceSummaryItem name="Moq" isDocumented="True">Root namespace of MoQ (pronounced "Mock-you"), the only mocking library for .NET developed from scratch to take full advantage of .NET 3.5 (i.e. Linq expression trees) and C# 3.0 features (i.e. lambda expressions) that make it the most productive, simple and refactoring-friendly mocking library available. | ||
<p> | ||
See the <a href="http://code.google.com/p/moq/wiki/QuickStart">online quickstarts</a> for more examples than those available in this code documentation. | ||
</p> | ||
The Mock&lt;TInterface&gt; class is the core of the library, so it's a good place to start.</namespaceSummaryItem> | ||
The Mock&lt;TTarget&gt; class is the core of the library, so it's a good place to start.</namespaceSummaryItem> | ||
<namespaceSummaryItem name="Moq.Properties" isDocumented="False" /> | ||
</namespaceSummaries> | ||
<componentConfigurations> | ||
<component id="Code Block Component" enabled="True" configuration="<component id="Code Block Component" type="SandcastleBuilder.Components.CodeBlockComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll"><!-- Base path for relative filenames in source attributes
 (optional) --><basePath value="{@ProjectFolder}" /><!-- Connect to language filter (optional). If omitted,
 language filtering is enabled by default. --><languageFilter value="true" /><!-- Code colorizer options (required).
 Attributes:
 Language syntax configuration file (required)
 XSLT style file (required)
 "Copy" image file URL (required)
 Default language (optional)
 Enable line numbering (optional)
 Enable outlining (optional)
 Tab size override (optional, 0 = Use syntax file setting)
 Use language name as default title (optional) --><colorizer syntaxFile="{@SHFBFolder}Colorizer\highlight.xml" styleFile="{@SHFBFolder}Colorizer\highlight.xsl" copyImageUrl="../icons/CopyCode.gif" language="cs" numberLines="false" outlining="false" tabSize="0" defaultTitle="true" /></component>" /> | ||
<component id="Post-transform Component" enabled="True" configuration="<component id="Post-transform Component" type="SandcastleBuilder.Components.PostTransformComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll"><!-- Code colorizer files (required).
 Attributes:
 Stylesheet file (required)
 Script file (required)
 "Copy" image file (required) --><colorizer stylesheet="{@SHFBFolder}Colorizer\highlight.css" scriptFile="{@SHFBFolder}Colorizer\highlight.js" copyImage="{@SHFBFolder}Colorizer\CopyCode.gif" /><!-- Base output path for the files (required). This should match
 the parent folder of the output path of the HTML files (see
 SaveComponent). --><outputPath value="Output\" /><!-- Logo image file (optional). Filename is required. The height,
 width, altText, placement, and alignment attributes are
 optional. --><logoFile filename="" height="0" width="0" altText="" placement="left" alignment="left" /></component>" /> | ||
</componentConfigurations> | ||
<ProjectSummary>Moq (pronounced "Mock-you") is the only mocking library for .NET developed from scratch to take full advantage of .NET 3.5 (i.e. Linq expression trees) and C# 3.0 features (i.e. lambda expressions) that make it the most productive, simple and refactoring-friendly mocking library available.</ProjectSummary> | ||
<MissingTags>Summary, Parameter, AutoDocumentCtors, Namespace</MissingTags> | ||
<VisibleItems>InheritedMembers, InheritedFrameworkMembers, Protected, SealedProtected</VisibleItems> | ||
|
@@ -20,22 +37,22 @@ The Mock&lt;TInterface&gt; class is the core of the library, so it's a g | |
<SandcastlePath path="" /> | ||
<WorkingPath path="" /> | ||
<CleanIntermediates>True</CleanIntermediates> | ||
<KeepLogFile>True</KeepLogFile> | ||
<KeepLogFile>False</KeepLogFile> | ||
<HelpFileFormat>Help1xAndWebsite</HelpFileFormat> | ||
<PurgeDuplicateTopics>True</PurgeDuplicateTopics> | ||
<CppCommentsFixup>False</CppCommentsFixup> | ||
<FrameworkVersion>3.5</FrameworkVersion> | ||
<BinaryTOC>True</BinaryTOC> | ||
<IncludeFavorites>False</IncludeFavorites> | ||
<Preliminary>False</Preliminary> | ||
<Preliminary>True</Preliminary> | ||
<RootNamespaceContainer>False</RootNamespaceContainer> | ||
<RootNamespaceTitle /> | ||
<HelpTitle>Moq</HelpTitle> | ||
<HtmlHelpName>Moq</HtmlHelpName> | ||
<HelpTitle>MoQ</HelpTitle> | ||
<HtmlHelpName>MoQ</HtmlHelpName> | ||
<Language>en-US</Language> | ||
<CopyrightHref /> | ||
<CopyrightText /> | ||
<FeedbackEMailAddress /> | ||
<FeedbackEMailAddress>[email protected]</FeedbackEMailAddress> | ||
<HeaderText /> | ||
<FooterText /> | ||
<ProjectLinkType>Local</ProjectLinkType> | ||
|
@@ -44,7 +61,7 @@ The Mock&lt;TInterface&gt; class is the core of the library, so it's a g | |
<PresentationStyle>vs2005</PresentationStyle> | ||
<NamingMethod>HashedMemberName</NamingMethod> | ||
<SyntaxFilters>CSharp</SyntaxFilters> | ||
<ShowFeedbackControl>False</ShowFeedbackControl> | ||
<ShowFeedbackControl>True</ShowFeedbackControl> | ||
<ContentPlacement>AboveNamespaces</ContentPlacement> | ||
<ContentSiteMap path="" /> | ||
<TopicFileTransform path="" /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
using System.Runtime.Remoting.Messaging; | ||
using Castle.Core.Interceptor; | ||
|
||
namespace Moq | ||
{ | ||
internal interface IProxyCall | ||
{ | ||
bool Matches(IMethodCallMessage call); | ||
IMethodReturnMessage Execute(IMethodCallMessage call); | ||
bool Matches(IInvocation call); | ||
void Execute(IInvocation call); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using Castle.Core.Interceptor; | ||
|
||
namespace Moq | ||
{ | ||
class Interceptor : MarshalByRefObject, IInterceptor | ||
{ | ||
List<IProxyCall> calls = new List<IProxyCall>(); | ||
List<MethodInfo> objectMethods = new List<MethodInfo>(new MethodInfo[] { | ||
Reflector<object>.GetMethod(x => x.GetType()), | ||
Reflector<object>.GetMethod(x => x.Equals(null)), | ||
Reflector<object>.GetMethod(x => x.GetHashCode()), | ||
Reflector<object>.GetMethod(x => x.ToString())}); | ||
|
||
public void AddCall(IProxyCall call) | ||
{ | ||
calls.Add(call); | ||
} | ||
|
||
public void Intercept(IInvocation invocation) | ||
{ | ||
var call = calls.Find(x => x.Matches(invocation)); | ||
if (call != null) | ||
{ | ||
call.Execute(invocation); | ||
} | ||
else if (invocation.Method.DeclaringType == typeof(object)) | ||
{ | ||
invocation.Proceed(); | ||
} | ||
else if (invocation.TargetType.IsClass && | ||
!invocation.Method.IsAbstract) | ||
{ | ||
// For mocked classes, if the target method was not abstract, | ||
// invoke directly. | ||
invocation.Proceed(); | ||
} | ||
else if (invocation.Method != null && invocation.Method.ReturnType != null && | ||
invocation.Method.ReturnType != typeof(void)) | ||
{ | ||
// Return default value. | ||
if (invocation.Method.ReturnType.IsValueType) | ||
invocation.ReturnValue = 0; | ||
else | ||
invocation.ReturnValue = null; | ||
//List<string> values = new List<string>(invocation.Arguments.Length); | ||
//// Build arguments | ||
//invocation.Arguments.ForEach( | ||
// x => values.Add(x == null ? "null" : (x is string ? "\"" + (string)x + "\"" : x.ToString()))); | ||
|
||
//throw new InvalidOperationException(String.Format( | ||
// Properties.Resources.UndeterminedReturnValue, | ||
// invocation.Method.DeclaringType.Name, | ||
// invocation.Method.Name, | ||
// String.Join(", ", values.ToArray()))); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.