コード例 #1
0
        public Mock(MockBehavior behavior, params object[] args)
        {
            if (args == null)
            {
                args = new object[] { null };
            }

            this.additionalInterfaces    = new List <Type>();
            this.behavior                = behavior;
            this.configuredDefaultValues = new Dictionary <Type, object>();
            this.constructorArguments    = args;
            this.defaultValueProvider    = DefaultValueProvider.Empty;
            this.eventHandlers           = new EventHandlerCollection();
            this.innerMocks              = new ConcurrentDictionary <MethodInfo, MockWithWrappedMockObject>();
            this.invocations             = new InvocationCollection();
            this.name     = CreateUniqueDefaultMockName();
            this.setups   = new SetupCollection();
            this.switches = Switches.Default;

            this.CheckParameters();
        }
コード例 #2
0
ファイル: Extensions.cs プロジェクト: mujdatdinc/moq4
 public static Mock FindLastInnerMock(this SetupCollection setups, Func <Setup, bool> predicate)
 {
     return(setups.FindLast(setup => !setup.IsConditional && predicate(setup))?.InnerMocks.SingleOrDefault());
 }
コード例 #3
0
ファイル: Extensions.cs プロジェクト: mujdatdinc/moq4
 public static IEnumerable <Mock> FindAllInnerMocks(this SetupCollection setups)
 {
     return(setups.FindAll(setup => !setup.IsConditional)
            .SelectMany(setup => setup.InnerMocks)
            .Where(innerMock => innerMock != null));
 }