private IBulkAction BuildBulkAction(
     PropertiesUpdateBulkActionContext context,
     IMock <IItemService> itemServiceMock,
     IMock <IBulkPropertyUpdateManager> manager)
 {
     return(new PropertiesUpdateBulkAction(context, itemServiceMock.Object, manager.Object));
 }
Beispiel #2
0
 public static IServiceCollection WithProcessor(
     [NotNull] this IServiceCollection services,
     [NotNull] IMock <IMigrationProcessor> processor)
 {
     return(services
            .AddScoped <IProcessorAccessor>(_ => new PassThroughProcessorAccessor(processor.Object)));
 }
Beispiel #3
0
 private static ActionContext CreateActionContext(IMock <HttpContext> httpContextMock, ModelStateDictionary modelState)
 {
     return(new(httpContextMock.Object,
                Mock.Of <RouteData>(),
                Mock.Of <ActionDescriptor>(),
                modelState));
 }
 public void SetUp()
 {
     dateTimeMock = new DynamicMock(typeof(DateTimeProvider));
     dateTimeMock.SetupResult("Today", new DateTime(2005, 7, 20, 0, 0, 0, 0));
     labeller = new IterationLabeller((DateTimeProvider)dateTimeMock.MockInstance);
     labeller.ReleaseStartDate = releaseStartDate;
 }
Beispiel #5
0
        private static DbHelper CreateDbHelperWithMockedDependencies(IMock <DbSet <Movie> > mockSet)
        {
            var mockContext = new Mock <MovieDbContext>();

            mockContext.Setup(c => c.Movies).Returns(mockSet.Object);
            return(new DbHelper(Mock.Of <ILogger <DbHelper> >(), mockContext.Object, Mock.Of <IDateProvider>()));
        }
Beispiel #6
0
        public Mock()
        {
            var mockType = this.FindMockedType();

            this.mockImplementation = (IMock)Activator.CreateInstance(mockType);
            this.Object             = (T)this.mockImplementation;
        }
        public void Setup()
        {
            this.mocks = new MockRepository();

            mockery = new Mockery();
            targetMock = mockery.NewDynamicMock(typeof(IIntegrationRunnerTarget));
            resultManagerMock = mockery.NewDynamicMock(typeof(IIntegrationResultManager));
            quietPeriodMock = mockery.NewDynamicMock(typeof(IQuietPeriod));

            runner = new IntegrationRunner((IIntegrationResultManager)resultManagerMock.MockInstance,
                                           (IIntegrationRunnerTarget)targetMock.MockInstance,
                                           (IQuietPeriod)quietPeriodMock.MockInstance);


            request = ModificationExistRequest();
            endTime = new DateTime(2005, 2, 1);
            modifications = new Modification[] { new Modification() };

            resultMock = mockery.NewDynamicMock(typeof(IIntegrationResult));
            resultMock.SetupResult("WorkingDirectory", TempFileUtil.GetTempPath("workingDir"));
            resultMock.SetupResult("ArtifactDirectory", TempFileUtil.GetTempPath("artifactDir"));
            resultMock.SetupResult("BuildProgressInformation", new ThoughtWorks.CruiseControl.Core.Util.BuildProgressInformation("",string.Empty));
            resultMock.SetupResult("IntegrationProperties", new Dictionary<string, string>());
            result = (IIntegrationResult)resultMock.MockInstance;

            lastResultMock = mockery.NewDynamicMock(typeof(IIntegrationResult));
            lastResult = (IIntegrationResult)lastResultMock.MockInstance;
        }
Beispiel #8
0
        public void Setup()
        {
            this.mocks = new MockRepository();

            mockery           = new Mockery();
            targetMock        = mockery.NewDynamicMock(typeof(IIntegrationRunnerTarget));
            resultManagerMock = mockery.NewDynamicMock(typeof(IIntegrationResultManager));
            quietPeriodMock   = mockery.NewDynamicMock(typeof(IQuietPeriod));

            runner = new IntegrationRunner((IIntegrationResultManager)resultManagerMock.MockInstance,
                                           (IIntegrationRunnerTarget)targetMock.MockInstance,
                                           (IQuietPeriod)quietPeriodMock.MockInstance);


            request       = ModificationExistRequest();
            endTime       = new DateTime(2005, 2, 1);
            modifications = new Modification[] { new Modification() };

            resultMock = mockery.NewDynamicMock(typeof(IIntegrationResult));
            resultMock.SetupResult("WorkingDirectory", TempFileUtil.GetTempPath("workingDir"));
            resultMock.SetupResult("ArtifactDirectory", TempFileUtil.GetTempPath("artifactDir"));
            resultMock.SetupResult("BuildProgressInformation", new ThoughtWorks.CruiseControl.Core.Util.BuildProgressInformation("", string.Empty));
            resultMock.SetupResult("IntegrationProperties", new Dictionary <string, string>());
            result = (IIntegrationResult)resultMock.MockInstance;

            lastResultMock = mockery.NewDynamicMock(typeof(IIntegrationResult));
            lastResult     = (IIntegrationResult)lastResultMock.MockInstance;
        }
 protected void SetUp()
 {
     _executor       = new DynamicMock(typeof(ProcessExecutor));
     _historyParser  = new DynamicMock(typeof(IHistoryParser));
     _vss            = new Vss(new VssLocale(CultureInfo.InvariantCulture), (IHistoryParser)_historyParser.MockInstance, (ProcessExecutor)_executor.MockInstance, null);
     _vss.Executable = "ss.exe";
 }
Beispiel #10
0
		public void RaiseEvents(IMock target)
		{
			foreach (var raiseEvent in this.raiseEvents)
			{
				target.Raise(raiseEvent.Name, raiseEvent.Args);
			}
		}
Beispiel #11
0
        private static AuthorController CreateAuthorController(
            IMock <IAuthorRepository> mockAuthorRepository,
            IMapper mapper,
            IMock <ILogger <AuthorController> > mockLogger
            )
        {
            const string locationUrl   = "http://fakelocation/";
            var          mockUrlHelper = new Mock <IUrlHelper>();

            mockUrlHelper
            .Setup(x => x.RouteUrl(It.IsAny <UrlRouteContext>()))
            .Returns(locationUrl);

            var authorController = new AuthorController(
                mockAuthorRepository.Object,
                mapper,
                mockLogger.Object)
            {
                ControllerContext = new ControllerContext
                {
                    HttpContext = new DefaultHttpContext()
                },
                Url = mockUrlHelper.Object
            };


            return(authorController);
        }
Beispiel #12
0
 public StatusRepositoryTest()
 {
     QueryWithDefaultValues = BaseListQuery.DefaultValues("nb");
     Mock             = new Mock.Mock();
     StatusRepository = new Repositories.StatusRepository(Mock.Database.Context);
     _status          = Mock.MockStatus();
 }
        /// <summary>Common method for adding declaration with some default values</summary>
        private void AddDeclarationItem(IMock<ParserRuleContext> context,
            Selection selection,
            QualifiedMemberName? qualifiedName = null,
            DeclarationType declarationType = DeclarationType.Project,
            string identifierName = "identifierName")
        {
            Declaration declarationItem = null;
            var qualName = qualifiedName ?? new QualifiedMemberName(_module, "fakeModule");

            declarationItem = new Declaration(
                qualifiedName: qualName,
                parentScope: "module.proc",
                asTypeName: "asTypeName",
                isSelfAssigned: false,
                isWithEvents: false,
                accessibility: Accessibility.Public,
                declarationType: declarationType,
                context: context.Object,
                selection: selection
                );

            _declarations.Add(declarationItem);
            if (_listDeclarations == null) _listDeclarations = new List<Declaration>();
            _listDeclarations.Add(declarationItem);
        }
        private static IEnumerable <MessageHandlerOrderingContainerTestModel> GetTestingOrderingModels(
            HandleMessageReceivingEventTestDataModel testDataModel,
            IMock <IMessageHandler> messageHandlerMock,
            IMock <IAsyncMessageHandler> asyncMessageHandlerMock)
        {
            var collection = new List <MessageHandlerOrderingContainerTestModel>
            {
                new()
                {
                    MessageHandler = messageHandlerMock.Object,
                    ShouldTrigger  = testDataModel.MessageHandlerShouldTrigger,
                    OrderValue     = testDataModel.MessageHandlerOrder
                },
                new()
                {
                    MessageHandler = asyncMessageHandlerMock.Object,
                    ShouldTrigger  = testDataModel.AsyncMessageHandlerShouldTrigger,
                    OrderValue     = testDataModel.AsyncMessageHandlerOrder
                }
            };

            var callOrder         = 1;
            var orderedCollection = collection.OrderByDescending(x => x.OrderValue)
                                    .ThenByDescending(x => x.MessageHandler.GetHashCode())
                                    .ToList();

            foreach (var item in orderedCollection.Where(item => item.ShouldTrigger))
            {
                item.CallOrder = callOrder++;
            }
            return(orderedCollection);
        }
    }
Beispiel #15
0
        private static void RegisterMockObject(IWindsorContainer container, IMock <IValueStorage> valueStorageMock)
        {
            var storage = new ValueStorageWrapper();

            storage.SetMock(valueStorageMock.Object);
            container.Register(Component.For <IValueStorage>().Instance(storage));
        }
        private IBulkPropertyUpdateManager BuildManager(IMock <IDataSourceFactory> dataSourceFactory)
        {
            var itemService = new Mock <IItemService>();
            var manager     = new BulkPropertyUpdateManager(dataSourceFactory.Object, itemService.Object);

            return(manager);
        }
        public void SetUp()
        {
            _connectionMock = new DynamicMock(typeof(IDbConnection));
            _commandMock = new DynamicMock(typeof(IDbCommand));

            _executionState = new AutoCommitExecutionState((IDbConnection) _connectionMock.MockInstance);
        }
Beispiel #18
0
		public void DialogTest()
		{
			FlexDePlugin target = new FlexDePlugin();
			helpProvider = new DynamicMock(typeof (IHelpTopicProvider));
			using (UtilityDlg expected = new UtilityDlg((IHelpTopicProvider)helpProvider.MockInstance))
				target.Dialog = expected;
		}
		public void SetUp()
		{
			dateTimeMock = new DynamicMock(typeof (DateTimeProvider));
			dateTimeMock.SetupResult("Today", new DateTime(2005, 7, 20, 0, 0, 0, 0));
			labeller = new IterationLabeller((DateTimeProvider) dateTimeMock.MockInstance);
			labeller.ReleaseStartDate = releaseStartDate;
		}
Beispiel #20
0
 public MockSetup(TTarget target, IMock <TTarget> mock, Func <TTarget, TResult> function)
 {
     this.Target   = target;
     this.mock     = mock;
     this.function = function;
     target.Setup(function);
 }
Beispiel #21
0
        public void SetUp()
        {
            mockStateManager = new DynamicMock(typeof(IStateManager));

            project = CreateProject();
            manager = new IntegrationResultManager(project);
        }
Beispiel #22
0
 public MockSetup(TTarget target, IMock <TTarget> mock, Action <TTarget> action)
 {
     this.target = target;
     this.mock   = mock;
     this.action = action;
     target.Setup(action);
 }
Beispiel #23
0
        public static StringWriter SwitchWriterToStringWriter(this IMock <ViewContext> mockViewContext)
        {
            StringWriter writer = new StringWriter();

            mockViewContext.Expect(c => c.Writer).Returns(writer);
            return(writer);
        }
        /// <summary>Common method for adding declaration with some default values</summary>
        private void AddDeclarationItem(IMock <ParserRuleContext> context,
                                        Selection selection,
                                        QualifiedMemberName?qualifiedName = null,
                                        DeclarationType declarationType   = DeclarationType.Project,
                                        string identifierName             = "identifierName")
        {
            Declaration declarationItem = null;
            var         qualName        = qualifiedName ?? new QualifiedMemberName(_module, "fakeModule");

            declarationItem = new Declaration(
                qualifiedName: qualName,
                parentScope: "module.proc",
                asTypeName: "asTypeName",
                isSelfAssigned: false,
                isWithEvents: false,
                accessibility: Accessibility.Public,
                declarationType: declarationType,
                context: context.Object,
                selection: selection
                );

            _declarations.Add(declarationItem);
            if (_listDeclarations == null)
            {
                _listDeclarations = new List <Declaration>();
            }
            _listDeclarations.Add(declarationItem);
        }
Beispiel #25
0
        public static StringBuilder SwitchResponseMockOutputToStringBuilder(this IMock <HttpResponseBase> responseMock)
        {
            var sb = new StringBuilder();

            responseMock.Expect(response => response.Write(It.IsAny <string>())).Callback <string>(output => sb.Append(output));
            return(sb);
        }
Beispiel #26
0
        public static IConnectionFactory MockConnectionFactory(IMock <IMapper> mapperMock)
        {
            var connectionFactoryMock = new Mock <IConnectionFactory>();

            connectionFactoryMock.Setup(m => m.GetMapper(It.IsAny <ISession>())).Returns(mapperMock.Object);
            return(connectionFactoryMock.Object);
        }
Beispiel #27
0
        public void SetUp()
        {
            _connectionMock = new DynamicMock(typeof(IDbConnection));
            _commandMock    = new DynamicMock(typeof(IDbCommand));

            _executionState = new AutoCommitExecutionState((IDbConnection)_connectionMock.MockInstance);
        }
		protected void SetUp()
		{
			_executor = new DynamicMock(typeof(ProcessExecutor));
			_historyParser = new DynamicMock(typeof(IHistoryParser));
			_vss = new Vss(new VssLocale(CultureInfo.InvariantCulture), (IHistoryParser) _historyParser.MockInstance, (ProcessExecutor) _executor.MockInstance, null);
			_vss.Executable = "ss.exe";
		}
		public void SetUp()
		{
			mockStateManager = new DynamicMock(typeof(IStateManager));

			project = CreateProject();
			manager = new IntegrationResultManager(project);
		}
 public FilePathResolverTests()
 {
     FilePathResolverMock = new Mock <FilePathResolver>
     {
         CallBase = true
     };
 }
Beispiel #31
0
 static void RemoveDelegate(EventInfo info, Delegate handler, IMock mock)
 {
     if (mock.State.TryGetValue <Delegate>(info.Name, out var state))
     {
         // Try without locking first
         var newState = Delegate.Remove(state, handler);
         if (newState != state)
         {
             if (!mock.State.TryUpdate(info.Name, newState, state))
             {
                 lock (mock.State)
                 {
                     // Retry with locking
                     if (mock.State.TryGetValue(info.Name, out state))
                     {
                         newState = Delegate.Remove(state, handler);
                         if (newState != state)
                         {
                             // This should never fail, since we're inside the lock
                             Debug.Assert(
                                 mock.State.TryUpdate(newState, state));
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #32
0
        /// <summary>
        /// Gets a clone of the original mock for verification purposes.
        /// </summary>
        /// <param name="mock">The mock to be cloned.</param>
        /// <param name="notCalled">Whether to add a behavior that verifies the invocations performed on
        /// the clone were never performed on the original mock.
        /// </param>
        static T GetVerifier <T>(IMock <T> mock, bool notCalled = false) where T : class
        {
            // If the mock is already being verified, we don't need to clone again.
            if (mock.State.TryGetValue <bool>(typeof(Verify), out var verifying) && verifying)
            {
                return(mock.Object);
            }

            // Otherwise, we create a verification copy that does not record invocations
            // and has default behavior.
            var clone = mock.Clone();

            var recording = clone.Behaviors.OfType <MockRecordingBehavior>().FirstOrDefault();

            if (recording != null)
            {
                clone.Behaviors.Remove(recording);
            }

            if (notCalled)
            {
                clone.Behaviors.Insert(
                    clone.Behaviors.IndexOf(clone.Behaviors.OfType <MockContextBehavior>().First()) + 1,
                    new NotCalledBehavior());
            }

            // Sets up the right behaviors for a loose mock
            new Moq <T>(clone).Behavior = MockBehavior.Loose;

            clone.State.Set(typeof(Verify), true);

            return(clone.Object);
        }
Beispiel #33
0
        private static SearchRequestHandler CreateRequestHandler(IMock <LdapNative> native)
        {
            var searchRequestHandler = new SearchRequestHandler();

            searchRequestHandler.SetNative(native.Object);
            return(searchRequestHandler);
        }
Beispiel #34
0
		public void DialogTest()
		{
			FlexDePlugin target = new FlexDePlugin();
			helpProvider = new DynamicMock(typeof (SIL.FieldWorks.Common.COMInterfaces.IHelpTopicProvider));
			UtilityDlg expected = new UtilityDlg((SIL.FieldWorks.Common.COMInterfaces.IHelpTopicProvider)helpProvider.MockInstance);
			target.Dialog = expected;
		}
Beispiel #35
0
        public Dependency1(IMock mock1, IMock mock2)
        {
            first = mock1.ToString();
            second = mock2.ToString();

            Debug.WriteLine(first);
            Debug.WriteLine(second);
        }
Beispiel #36
0
        public void SetUp()
        {
            Trace.Listeners.Clear();

            mockArgs = new DynamicMock(typeof(IArgumentParser));
            mockArgs.SetupResult("ConfigFile", "ccnet.config");
            container = new ConsoleContainer((IArgumentParser)mockArgs.MockInstance);
        }
        public void SetUp()
        {
            Trace.Listeners.Clear();

            mockArgs = new DynamicMock(typeof(IArgumentParser));
            mockArgs.SetupResult("ConfigFile", "ccnet.config");
            container = new ConsoleContainer((IArgumentParser) mockArgs.MockInstance);
        }
		protected void Setup()
		{
			executor = new DynamicMock(typeof (ProcessExecutor));
			parser = new DynamicMock(typeof (IHistoryParser));
			registry = new DynamicMock(typeof (IRegistry));

			alienbrain = new Alienbrain((IHistoryParser) parser.MockInstance, (ProcessExecutor) executor.MockInstance, (IRegistry) registry.MockInstance);
		}
		public void Setup()
		{
			Source = "IntervalTrigger";
			mockDateTime = new DynamicMock(typeof (DateTimeProvider));
			initialDateTimeNow = new DateTime(2002, 1, 2, 3, 0, 0, 0);
			mockDateTime.SetupResult("Now", this.initialDateTimeNow);
			trigger = new IntervalTrigger((DateTimeProvider) mockDateTime.MockInstance);
		}
 public static ProxyMethodCall From(IMock mock, MethodInfo method, object[] arguments)
 {
     // TODO: ImmutableList -> ImmutableArray
     return(new ProxyMethodCall(
                mock,
                ProxyMethod.From(mock, method),
                arguments.ToImmutableList()));
 }
Beispiel #41
0
 private InventoryItemDetailView GetTarget(
     IMock <IReadModelRepository <InventoryItemDetailsDto, Guid> > repositoryMock,
     IMock <InventoryHub> hubMock)
 {
     return(new InventoryItemDetailView(
                repositoryMock.Object,
                hubMock.Object));
 }
Beispiel #42
0
 public void Setup()
 {
     Source             = "IntervalTrigger";
     mockDateTime       = new DynamicMock(typeof(DateTimeProvider));
     initialDateTimeNow = new DateTime(2002, 1, 2, 3, 0, 0, 0);
     mockDateTime.SetupResult("Now", this.initialDateTimeNow);
     trigger = new IntervalTrigger((DateTimeProvider)mockDateTime.MockInstance);
 }
        protected void Setup()
        {
            executor = new DynamicMock(typeof(ProcessExecutor));
            parser   = new DynamicMock(typeof(IHistoryParser));
            registry = new DynamicMock(typeof(IRegistry));

            alienbrain = new Alienbrain((IHistoryParser)parser.MockInstance, (ProcessExecutor)executor.MockInstance, (IRegistry)registry.MockInstance);
        }
Beispiel #44
0
        public object CreateProxy(IMock mock, Type type)
        {
            if (type.IsInterface)
            {
                return generator.CreateInterfaceProxyWithoutTarget(type, new ForwardingInterceptor(mock));
            }

            return generator.CreateClassProxy(type, new ForwardingInterceptor(mock));
        }
 protected void SetUp()
 {
     mockFarmService = new DynamicMock(typeof (IFarmService));
     mockRequest = new DynamicMock(typeof (ICruiseRequest));
     serverSpecifier = new DefaultServerSpecifier("local");
     mockRequest.SetupResult("ServerSpecifier", serverSpecifier);
     mockRequest.SetupResult("ProjectName", "test");
     report = new ProjectXmlReport((IFarmService)mockFarmService.MockInstance, null);
 }
Beispiel #46
0
 protected void CreateGit() 
 {
     mockHistoryParser = new DynamicMock(typeof (IHistoryParser));
     mockFileSystem = new DynamicMock(typeof (IFileSystem));
     CreateProcessExecutorMock("git");
     from = new DateTime(2001, 1, 21, 20, 0, 0);
     to = from.AddDays(1);
     setupGit(new StubFileSystem());
 }
Beispiel #47
0
		public object CreateProxy(IMock mock, Type type)
		{
			if (type.IsInterface)
			{
				return generator.CreateInterfaceProxyWithoutTarget(type, new[] { typeof(IMocked) }, ProxyGenerationOptions.Default, new ForwardingInterceptor(mock));
			}

			return generator.CreateClassProxy(type, new[] { typeof(IMocked) }, ProxyGenerationOptions.Default, new ForwardingInterceptor(mock));
		}
		protected void CreateGit()
		{
			mockHistoryParser = new DynamicMock(typeof(IHistoryParser));
			mockFileSystem = new DynamicMock(typeof(IFileSystem));
			mockFileDirectoryDeleter = new DynamicMock(typeof(IFileDirectoryDeleter));
			CreateProcessExecutorMock("git");

			SetupGit((IFileSystem)mockFileSystem.MockInstance, (IFileDirectoryDeleter)mockFileDirectoryDeleter.MockInstance);
		}
 private static StandardCommandMetrics CreateMetrics(string key, IMock<IStats> mockStats, IClock clock = null,
     long? windowMillis = null, long? snapshotTtlMillis = null)
 {
     return new StandardCommandMetrics(
         GroupKey.Named(key),
         new TransientConfigurableValue<long>(windowMillis ?? 30000),
         new TransientConfigurableValue<long>(snapshotTtlMillis ?? 10000),
         (clock ?? new ManualTestClock()),
         mockStats.Object);
 }
		protected void SetUp()
		{
			mockHistoryParser = new DynamicMock(typeof (IHistoryParser));
			CreateProcessExecutorMock(BitKeeper.DefaultExecutable);
			ProcessExecutor executor = (ProcessExecutor) mockProcessExecutor.MockInstance;
			IHistoryParser parser = (IHistoryParser) mockHistoryParser.MockInstance;
			bitkeeper = new BitKeeper(parser, executor);
			from = new DateTime(2001, 1, 21, 20, 0, 0);
			to = from.AddDays(1);
		}
		protected void SetUp()
		{
			mockCruiseManager = new DynamicMock(typeof (ICruiseManager));
			mockCruiseManager.ExpectAndReturn("GetProjectStatus", new ProjectStatus[1] {NewProjectStatus("foo", "1")});

			mockRemotingService = new DynamicMock(typeof (IRemotingService));
			mockRemotingService.ExpectAndReturn("Connect", mockCruiseManager.MockInstance, typeof (ICruiseManager), RemoteCruiseServer.DefaultManagerUri);

			labeller = new RemoteProjectLabeller((IRemotingService) mockRemotingService.MockInstance);
		}
Beispiel #52
0
		protected void CreateCvs()
		{
			mockHistoryParser = new DynamicMock(typeof (IHistoryParser));
			mockFileSystem = new DynamicMock(typeof (IFileSystem));
            executionEnv = new ExecutionEnvironment();
			CreateProcessExecutorMock(Cvs.DefaultCvsExecutable);
            cvs = new Cvs((IHistoryParser)mockHistoryParser.MockInstance, (ProcessExecutor)mockProcessExecutor.MockInstance, (IFileSystem)mockFileSystem.MockInstance, executionEnv);
			from = new DateTime(2001, 1, 21, 20, 0, 0);
			to = from.AddDays(1);
		}
Beispiel #53
0
        public static Mock<SignInManager<ApplicationUser>> CreateSignInManagerMock(IMock<UserManager<ApplicationUser>> userManagerMock = null)
        {
            var contextAccessor = new Mock<IHttpContextAccessor>();
            contextAccessor.Setup(mock => mock.HttpContext).Returns(Mock.Of<HttpContext>);

            return new Mock<SignInManager<ApplicationUser>>(
                userManagerMock == null ? 
                    CreateUserManagerMock().Object : 
                    userManagerMock.Object,
                contextAccessor.Object, Mock.Of<IUserClaimsPrincipalFactory<ApplicationUser>>(), null, null);
        }
		public void Setup()
		{
			Source = "UrlTrigger";
			initialDateTimeNow = new DateTime(2002, 1, 2, 3, 0, 0, 0);
			mockDateTime = new DynamicMock(typeof (DateTimeProvider));
			mockDateTime.SetupResult("Now", this.initialDateTimeNow);
			mockHttpWrapper = new DynamicMock(typeof (HttpWrapper));

			trigger = new UrlTrigger((DateTimeProvider) mockDateTime.MockInstance, (HttpWrapper) mockHttpWrapper.MockInstance);
			trigger.Url = DefaultUrl;
		}
		protected void Init()
		{
		    tempOutputFile = new TempDirectory().CreateTextFile("results.xml", "foo");
		    executorMock = new DynamicMock(typeof (ProcessExecutor));

			task = new NUnitTask(executorMock.MockInstance as ProcessExecutor);
			task.Assemblies = TEST_ASSEMBLIES;
			task.NUnitPath = NUnitConsolePath;
	        task.OutputFile = tempOutputFile.ToString();
			result = Integration("testProject", WORKING_DIRECTORY, ARTIFACT_DIRECTORY);
		}
		protected void SetUp()
		{
			fbExecutable = Path.Combine(DefaultWorkingDirectory, "FBCmd.exe");

			_mockRegistry = new DynamicMock(typeof (IRegistry));
			CreateProcessExecutorMock(fbExecutable);
			_result = IntegrationResult();
			_result.Label = "1.0";
			_result.ArtifactDirectory = Path.GetTempPath();
			_task = new FinalBuilderTask((IRegistry) _mockRegistry.MockInstance, (ProcessExecutor) mockProcessExecutor.MockInstance);
		}
		protected void CreateMocksAndInitialiseObjectUnderTest()
		{
			mockTrigger = new DynamicMock(typeof (ITrigger));
			mockDateTime = new DynamicMock(typeof (DateTimeProvider));

			trigger = new FilterTrigger((DateTimeProvider) mockDateTime.MockInstance);
			trigger.InnerTrigger = (ITrigger) mockTrigger.MockInstance;
			trigger.StartTime = "10:00";
			trigger.EndTime = "11:00";
			trigger.WeekDays = new DayOfWeek[] {DayOfWeek.Wednesday};
			trigger.BuildCondition = BuildCondition.NoBuild;
		}
		protected void SetUp()
		{
			from = DateTime.Parse("2001-01-21 20:00:00Z");
			to = DateTime.Parse("2001-01-21 20:30:50Z");
			CreateProcessExecutorMock(Svn.DefaultExecutable);
			mockHistoryParser = new DynamicMock(typeof(IHistoryParser));
			mockFileSystem = new DynamicMock(typeof (IFileSystem));
			svn = new Svn((ProcessExecutor) mockProcessExecutor.MockInstance, (IHistoryParser) mockHistoryParser.MockInstance, (IFileSystem) mockFileSystem.MockInstance);
			svn.TrunkUrl = "svn://myserver/mypath";
			svn.TagBaseUrl = "svn://someserver/tags/foo";
			svn.WorkingDirectory = DefaultWorkingDirectory;
		}
		protected void SetUpFixtureData()
		{
			lastBuild = IntegrationResultMother.CreateSuccessful(CreateDateTime(12, 01, 00));
			thisBuild = IntegrationResultMother.CreateSuccessful(CreateDateTime(12, 02, 00));

			mods = new Modification[] { CreateModificationAtTime(12, 01, 30) };

			mockSourceControl = new DynamicMock(typeof (ISourceControl));
			mockSourceControl.Strict = true;
			mockDateTimeProvider = new DynamicMock(typeof (DateTimeProvider));
			mockDateTimeProvider.Strict = true;
			quietPeriod = new QuietPeriod((DateTimeProvider) mockDateTimeProvider.MockInstance);
		}
Beispiel #60
0
		protected void CreateGit()
		{
			mockHistoryParser = new DynamicMock(typeof(IHistoryParser));
			mockFileSystem = new DynamicMock(typeof(IFileSystem));
			mockFileDirectoryDeleter = new DynamicMock(typeof(IFileDirectoryDeleter));
			CreateProcessExecutorMock("git");

			from = new DateTime(2001, 1, 21, 20, 0, 0, DateTimeKind.Local);
			to = from.AddDays(1);

			GIT_REMOTE_COMMITS = string.Format(GIT_REMOTE_COMMITS, from.ToUniversalTime().ToString("R"),
											   to.ToUniversalTime().ToString("R"));

			SetupGit((IFileSystem)mockFileSystem.MockInstance, (IFileDirectoryDeleter)mockFileDirectoryDeleter.MockInstance);
		}