public void BeforeScenario() { var transportMock = TransportMock.CreateWithoutStructureMapClear(typeof(SampleProfileSerialized).Assembly, new List <Assembly> { typeof(ExceptionThrownLocalMessage).Assembly }, new[] { typeof(WhenAddANewProfileSpecs).Assembly }); transportMock.AddProfile("Profile_1"); var mockBufferSize = MockRepository.GenerateStub <IBufferSize>(); mockBufferSize.Stub(x => x.Value).Return(2); ObjectFactory.Configure(x => x.For <IBufferSize>().HybridHttpOrThreadLocalScoped().Use(mockBufferSize)); ObjectFactory.GetInstance <TransportMock>().On <AddAttachmentPartToMessageCommand>() .Reply(x => { if (!x.IsLastPart) { return(new AttachmentPartAddedMessage { FileName = x.FileName }); } return(new AttachmentCreatedMessage { Dto = new AttachmentDTO { OriginalFileName = x.FileName, OwnerID = x.OwnerId, Description = x.Description } }); }); Directory.Delete(ObjectFactory.GetInstance <PluginDataFolder>().Path); }
protected override void OnSetup() { base.OnSetup(); _transport = TransportMock.CreateWithoutStructureMapClear(typeof(SearcherProfile).Assembly, new[] { typeof(SearcherProfile).Assembly }, new Assembly[] { }); _generals = new[] { new GeneralDTO { ID = 2, Name = "Second general", EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID, ParentProjectID = 1 }, new GeneralDTO { ID = 3, Name = "Third general", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ParentProjectID = 1 }, }; _comments = new[] { new CommentDTO { GeneralID = 2, CommentID = 1, Description = "FirstDescription" }, }; _transport.On <GeneralQuery>().Reply(x => ReplyOnEntityQuery <GeneralQuery, GeneralDTO, GeneralQueryResult>(x, _generals)); _transport.On <AssignableQuery>().Reply(x => ReplyOnAssignableQuery(x, new AssignableDTO[] {})); _transport.On <TestCaseQuery>().Reply(x => new TestCaseQueryResult { Dtos = new TestCaseDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 }); _transport.On <ImpedimentQuery>().Reply(x => new ImpedimentQueryResult { Dtos = new ImpedimentDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 }); _transport.On <CommentQuery>().Reply(x => ReplyOnEntityQuery <CommentQuery, CommentDTO, CommentQueryResult>(x, _comments)); }
public void Init() { ObjectFactory.Initialize(x => x.AddRegistry <VcsMockEnvironmentRegistry>()); ObjectFactory.Configure(x => x.For <TransportMock>().Use(TransportMock.CreateWithoutStructureMapClear(typeof(SubversionPluginProfile).Assembly, new List <Assembly> { typeof(Command).Assembly }))); }
public void BeforeScenario() { ObjectFactory.Configure( x => x.For <TransportMock>().HybridHttpOrThreadLocalScoped().Use( TransportMock.CreateWithoutStructureMapClear(typeof(PluginTickSpecs).Assembly))); }
public PopEmailIntegrationContext() { var transportMock = TransportMock.CreateWithoutStructureMapClear(typeof(ProjectEmailProfile).Assembly, new List <Assembly> { typeof(ExceptionThrownLocalMessage).Assembly }, new Assembly[] {}); ObjectFactory.Configure(x => x.For <TransportMock>().Use(transportMock)); ObjectFactory.Configure(x => x.For <PopEmailIntegrationContext>().Use(this)); Transport.On <RetrieveAllUsersQuery>().Reply(x => new UserQueryResult { QueryResultCount = 0 }); Transport.On <RetrieveAllProjectsQuery>().Reply(x => new ProjectQueryResult { QueryResultCount = 0 }); Transport.On <RetrieveAllRequestersQuery>().Reply(x => new RequesterQueryResult { QueryResultCount = 0 }); Transport.On <RetrieveAllMessageUidsQuery>().Reply(x => new MessageUidQueryResult { QueryResultCount = 0 }); Transport.On <RetrieveGlobalSettingQuery>().Reply(x => new GlobalSettingQueryResult { Dtos = new [] { new GlobalSettingDTO { SMTPSender = Guid.NewGuid().ToString() } }, QueryResultCount = 1 }); Profile = Transport.AddProfile("Profile_1", GetProfileSettings()); }
public void Setup() { ObjectFactory.Configure( x => x.For <TransportMock>().HybridHttpOrThreadLocalScoped().Use( TransportMock.CreateWithoutStructureMapClear(typeof(BugzillaProfile).Assembly))); }
public BugzillaLegacyProfileConversionUnitTestRegistry() { var stub = MockRepository.GenerateStub <IDatabaseConfiguration>(); stub.Expect(s => s.ConnectionString).Return("Data Source=(local);Initial Catalog=TargetProcessTest;user id=sa;password=sa"); For <IDatabaseConfiguration>().Use(stub); For <TransportMock>().Use(TransportMock.CreateWithoutStructureMapClear(typeof(BugzillaProfile).Assembly, new List <Assembly> { typeof(ExceptionThrownLocalMessage).Assembly, typeof(BugzillaProfile).Assembly }, new Assembly[] {})); For <IAssembliesHost>().Singleton().Use(new PredefinedAssembliesHost(new[] { typeof(BugzillaProfile).Assembly })); var mock = MockRepository.GenerateMock <PluginInitializer>(); mock.Stub(x => x.SendInfoMessages()); For <PluginInitializer>().Use(mock); IncludeRegistry <PluginRegistry>(); }
public void BeforeScenario() { _settings = new TestRunImportPluginProfile(); ObjectFactory.Configure( x => x.For <TransportMock>().Use(TransportMock.CreateWithoutStructureMapClear(typeof(TestRunImportPluginProfile).Assembly))); ObjectFactory.Configure(x => x.AddRegistry <TestRunImportEnvironmentRegistry>()); }
public void Init() { ObjectFactory.Configure(x => { x.For <TransportMock>().Use( TransportMock.CreateWithoutStructureMapClear(typeof(BugzillaProfile).Assembly, typeof(BugzillaProfile).Assembly)); x.For <IAssembliesHost>().Singleton().Use(new PredefinedAssembliesHost(new[] { typeof(BugzillaProfile).Assembly })); x.AddRegistry <PluginRegistry>(); }); }
public void BeforeScenario() { ObjectFactory.Configure( x => x.For <TransportMock>().Use(TransportMock.CreateWithoutStructureMapClear(typeof(TestRunImportPluginProfile).Assembly))); ObjectFactory.Configure(x => x.AddRegistry <TestRunImportEnvironmentRegistry>()); Settings = new TestRunImportPluginProfile { FrameworkType = FrameworkType }; _testCaseTestPlanDtos = new List <TestCaseTestPlanDTO>(); }
public WorkItemsUnitTestsRegistry() { For <TransportMock>().Use( TransportMock.CreateWithoutStructureMapClear( typeof(TfsPluginProfile).Assembly, new List <Assembly> { typeof(ExceptionThrownLocalMessage).Assembly, typeof(TfsPluginProfile).Assembly }, new Assembly[] { })); }
public void Initialize() { ObjectFactory.Configure( x => x.For <TransportMock>().Use(TransportMock.CreateWithoutStructureMapClear(typeof(BugzillaProfile).Assembly, new List <Assembly> { typeof(ExceptionThrownLocalMessage).Assembly, typeof(BugzillaProfile).Assembly }, new Assembly[] {}))); ObjectFactory.Configure(x => { x.For <IBugzillaService>().HybridHttpOrThreadLocalScoped().Use <BugzillaServiceMock>(); x.Forward <IBugzillaService, BugzillaServiceMock>(); x.For <IBugConverter <BugzillaBug> >().HybridHttpOrThreadLocalScoped().Use <ConverterComposite> (); var bugChunkSize = MockRepository.GenerateStub <IBugChunkSize>(); bugChunkSize.Stub(y => y.Value).Return(1); x.For <IBugChunkSize>().HybridHttpOrThreadLocalScoped().Use(bugChunkSize); x.For <IBugzillaInfoStorageRepository>().HybridHttpOrThreadLocalScoped().Use <BugzillaInfoStorageRepository>(); x.For <IBugzillaActionFactory>().HybridHttpOrThreadLocalScoped().Use <BugzillaActionFactory>(); }); AddReplyForCreateCommand <BugDTO, BugCreatedMessage>(TpBugs); AddReplyForUpdateCommand <BugDTO, BugField, BugUpdatedMessage>(TpBugs, BugField.EntityStateID); AddReplyForCreateCommand <CommentDTO, CommentCreatedMessage>(TpComments); AddReplyForUpdateCommand <CommentDTO, CommentField, CommentUpdatedMessage>(TpComments); AddReplyForCreateCommand <AttachmentDTO, AttachmentCreatedMessage>(TpAttachments); AddReplyForCreateCommand <TeamDTO, TeamCreatedMessage>(TpTeams); TransportMock.OnDeleteEntityCommand <TeamDTO>().Reply( x => { var dto = ObjectFactory.GetInstance <IStorageRepository>().Get <TeamDTO>().SingleOrDefault(teamDto => teamDto.ID == x.ID); var teamDeletedMessage = new TeamDeletedMessage { Dto = dto ?? new TeamDTO { ID = x.ID } }; return(teamDeletedMessage); }); AddReplyForQuery <RetrieveAllUsersQuery, UserDTO, UserQueryResult>(Users); AddReplyForQuery <EntityStateQuery, EntityStateDTO, EntityStateQueryResult>(EntityStates); AddReplyForQuery <PriorityQuery, PriorityDTO, PriorityQueryResult>(Priorities); AddReplyForQuery <RetrieveAllSeveritiesQuery, SeverityDTO, SeverityQueryResult>(Severities); AddReplyForQuery <RetrieveAllRolesQuery, RoleDTO, RoleQueryResult>(Roles); AddReplyForQuery <RetrieveAllProjectsQuery, ProjectDTO, ProjectQueryResult>(Projects); }
public void DoNotCallInitializationSagaTwice() { var transportMock = TransportMock.CreateWithoutStructureMapClear(typeof(BugInitializationSaga).Assembly, Assembly.GetExecutingAssembly()); var profile = transportMock.AddProfile("Profile"); profile.MarkAsInitialized(); profile.Save(); new BugInitializationSaga().Handle(new ProfileAddedMessage()); BugInitializationSaga.CallCount.Should(Be.EqualTo(0)); }
public void Setup() { ObjectFactory.Initialize(x => x.AddRegistry <VcsMockEnvironmentRegistry>()); ObjectFactory.Configure( x => x.For <TransportMock>().Use(TransportMock.CreateWithoutStructureMapClear(typeof(GitPluginProfile).Assembly, new List <Assembly> { typeof(Command).Assembly }))); Context.CreateTpUser(_tpName, _tpLogin, _tpEmail, _tpId); InitializeProfile(); }
public void Init() { ObjectFactory.Initialize(x => x.AddRegistry <TestRunImportEnvironmentRegistry>()); ObjectFactory.Configure(x => x.For <TransportMock>().Use(TransportMock.CreateWithoutStructureMapClear(typeof(TestRunImportPluginProfileInitializationSagaData).Assembly))); _profileSettings = new TestRunImportPluginProfile { PassiveMode = false, Project = 1, ResultsFilePath = "C:\\SimpleTestCaseTestResult.xml", TestPlan = 1, FrameworkType = FrameworkTypes.NUnit }; }
public void NewProfileShouldBeCreatedAsInitializedIfNewProfileInitializationSagaNotDefined() { var transportMock = TransportMock.CreateWithoutStructureMapClear(GetType().Assembly, Assembly.GetExecutingAssembly()); StubPluginMetadataWithNoInitializationSagas(); var profile = transportMock.AddProfile("Profile"); profile.MarkAsInitialized(); profile.Save(); profile.Initialized.Should(Be.True); }
public ActivityLoggingContext() { Loggers = new List <ILog>(); Activities = new List <ActivityDto>(); TransportMock = TransportMock.CreateWithoutStructureMapClear(typeof(SampleProfileSerialized).Assembly, new List <Assembly> { typeof(ExceptionThrownLocalMessage).Assembly }, new[] { typeof(WhenAddANewProfileSpecs).Assembly }); InitializeLogging(); ObjectFactory.Configure(InitializeActivityLogging); var now = DateTime.Now; CurrentDate.Setup(() => now); }
public TfsLegacyProfileConversionUnitTestRegistry() { For <TransportMock>().Use( TransportMock.CreateWithoutStructureMapClear( typeof(TfsPluginProfile).Assembly, new List <Assembly> { typeof(ExceptionThrownLocalMessage).Assembly, typeof(TfsPluginProfile).Assembly }, new Assembly[] { })); var mock = MockRepository.GenerateMock <PluginInitializer>(); mock.Stub(x => x.SendInfoMessages()); For <PluginInitializer>().Use(mock); }
public void UpdatedProfileShouldBeMarkedAsNotInitializedIfUpdatedProfileInitializationSagaDefined() { var transportMock = TransportMock.CreateWithoutStructureMapClear(typeof(BugUpdateInitializationSaga).Assembly, Assembly.GetExecutingAssembly()); var profile = transportMock.AddProfile("Profile"); profile.MarkAsInitialized(); profile.Save(); BugUpdateInitializationSaga._freezeSaga = true; UpdateProfile(transportMock, profile); var account = ObjectFactory.GetInstance <IAccountCollection>().GetOrCreate(AccountName.Empty); account.Profiles["Profile"].Initialized.Should(Be.EqualTo(false)); }
public void UpdatedProfileShouldBeMarkedAsInitializedIfUpdatedProfileInitializationSagaNotDefined() { var transportMock = TransportMock.CreateWithoutStructureMapClear(GetType().Assembly, Assembly.GetExecutingAssembly()); StubPluginMetadataWithNoInitializationSagas(); var profile = transportMock.AddProfile("Profile"); profile.MarkAsInitialized(); profile.Save(); UpdateProfile(transportMock, profile); var account = ObjectFactory.GetInstance <IAccountCollection>().GetOrCreate(AccountName.Empty); account.Profiles["Profile"].Initialized.Should(Be.EqualTo(true)); }
protected override void OnSetup() { base.OnSetup(); _transport = TransportMock.CreateWithoutStructureMapClear(typeof(SearcherProfile).Assembly, new[] { typeof(SearcherProfile).Assembly }, new Assembly[] { }); _generals = new[] { new GeneralDTO { ID = 2, Name = "Second general", EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID, ParentProjectID = 1 }, new GeneralDTO { ID = 3, Name = "Third general", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ParentProjectID = 1 }, new GeneralDTO { ID = 4, Name = "Fourth general", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ParentProjectID = 2 }, }; _assignables = new[] { new AssignableDTO { ID = 2, EntityStateID = 11, SquadID = 10, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID }, new AssignableDTO { ID = 3, EntityStateID = 12, SquadID = 11, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID }, new AssignableDTO { ID = 4, EntityStateID = 12, SquadID = 11, ProjectID = 2, EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID } }; _transport.On <GeneralQuery>().Reply(x => ReplyOnEntityQuery <GeneralQuery, GeneralDTO, GeneralQueryResult>(x, _generals)); _transport.On <AssignableQuery>().Reply(x => ReplyOnAssignableQuery(x, _assignables)); _transport.On <CommentQuery>().Reply(x => new CommentQueryResult { Dtos = new CommentDTO[] {}, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 }); _transport.On <TestStepQuery>().Reply(x => new TestStepQueryResult { Dtos = new TestStepDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 }); }
public void ShouldBeAbleToSerializeProfile() { TransportMock.CreateWithoutStructureMapClear(typeof(SampleProfileSerialized).Assembly); var pluginProfile = new PluginProfileDto { Name = "TestProfile", Settings = new SampleProfileSerialized { StringValue = "components" } }; var serializedProfile = pluginProfile.Serialize(); var deserializedProfile = serializedProfile.DeserializeProfile(); deserializedProfile.Name.Should(Be.EqualTo("TestProfile")); deserializedProfile.Settings.Should(Be.Not.Null, "Settings weren't deserialized"); var settings = (SampleProfileSerialized)deserializedProfile.Settings; settings.StringValue.Should(Be.EqualTo("components")); }
public void BeforeScenario() { _transportMock = TransportMock.CreateWithoutStructureMapClear(typeof(WhenAddANewProfileSpecs).Assembly, typeof(WhenAddANewProfileSpecs).Assembly); var commands = ObjectFactory.GetInstance <IPluginCommandRepository>(); ObjectFactory.EjectAllInstancesOf <IPluginCommandRepository>(); ObjectFactory.Configure(x => { x.For <IPluginCommandRepository>().Singleton().Use <PluginCommandMockRepository>(); x.Forward <IPluginCommandRepository, PluginCommandMockRepository>(); }); var pluginCommandMockRepository = ObjectFactory.GetInstance <PluginCommandMockRepository>(); foreach (var command in commands) { pluginCommandMockRepository.Add(command); } }
public virtual void SetUp() { ObjectFactory.Configure( x => { x.For <TransportMock>().Use(TransportMock.CreateWithoutStructureMapClear(typeof(MashupManagerProfile).Assembly, new List <Assembly> { typeof(ExceptionThrownLocalMessage). Assembly, typeof(MashupManagerProfile).Assembly }, new Assembly[] { })); x.For <IActivityLogger>().HybridHttpOrThreadLocalScoped().Use <ActivityLoggerMock>(); x.Forward <IActivityLogger, ActivityLoggerMock>(); var mashupFolderMock = MockRepository.GenerateStub <IMashupLocalFolder>(); mashupFolderMock.Expect(y => y.Path).Return(MashupStorageDirectory); x.For <IMashupLocalFolder>().Use(mashupFolderMock); }); }
public void Init() { ObjectFactory.Initialize(x => x.AddRegistry <GitRegistry>()); ObjectFactory.Configure( x => x.For <TransportMock>().Use(TransportMock.CreateWithoutStructureMapClear(typeof(GitPluginProfile).Assembly, new List <Assembly> { typeof(Command).Assembly }))); _testRepository = new GitTestRepository(); _gitRepoUri = _testRepository.Uri.ToString(); _profile = ObjectFactory.GetInstance <TransportMock>().AddProfile("Profile", new GitPluginProfile { Uri = _gitRepoUri, Login = _testRepository.Login, Password = _testRepository.Password, StartRevision = "1/1/1980" }); SetStartRevision("1/1/1980"); }
public void Init() { _transport = TransportMock.CreateWithoutStructureMapClear(typeof(CreateTasksForNewUserStoryHandler).Assembly); const int projectId = 123; const int userStoryId = 123; _profileInstance = _transport.AddProfile("Profile1", new TaskCreatorProfile { Project = projectId, TasksList = "Task", CommandName = "{CT}" }); _userStoryCreatedMessage = new UserStoryCreatedMessage { Dto = new UserStoryDTO { ProjectID = projectId, UserStoryID = userStoryId, Name = "{CT}User Story Name" } }; }
protected override void OnSetup() { base.OnSetup(); _transport = TransportMock.CreateWithoutStructureMapClear(typeof(SearcherProfile).Assembly, new[] { typeof(SearcherProfile).Assembly }, new Assembly[] { }); _generals = new[] { new GeneralDTO { ID = 1, Name = "First general assignable", EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID, ParentProjectID = 1 }, new GeneralDTO { ID = 2, Name = "Second general assignable", EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID, ParentProjectID = 1 }, new GeneralDTO { ID = 3, Name = "Third general assignable", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ParentProjectID = 1 }, new GeneralDTO { ID = 4, Name = "Fourth general", EntityTypeID = QueryEntityTypeProvider.TESTCASE_TYPE_ID, ParentProjectID = 1 } }; _comments = new[] { new CommentDTO { GeneralID = 1, CommentID = 1, Description = "FirstDescription" }, new CommentDTO { GeneralID = 2, CommentID = 2, Description = "SecondDescription" } }; _assignables = new[] { new AssignableDTO { ID = 2, EntityStateID = 11, SquadID = 10, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID }, new AssignableDTO { ID = 3, EntityStateID = 12, SquadID = 11, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID } }; _testSteps = new[] { new TestStepDTO { ID = 1, TestCaseID = 4, Description = "First Test Step Description" }, new TestStepDTO { ID = 2, TestCaseID = 4, Result = "Second Test Step Result" } }; _transport.On <GeneralQuery>().Reply(x => ReplyOnEntityQuery <GeneralQuery, GeneralDTO, GeneralQueryResult>(x, _generals)); _transport.On <CommentQuery>().Reply(x => ReplyOnEntityQuery <CommentQuery, CommentDTO, CommentQueryResult>(x, _comments)); _transport.On <ImpedimentQuery>().Reply(x => new ImpedimentQueryResult { Dtos = new ImpedimentDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 }); _transport.On <ReleaseProjectQuery>().Reply(x => new ReleaseProjectQueryResult { Dtos = new ReleaseProjectDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 }); _transport.On <AssignableQuery>().Reply(x => ReplyOnAssignableQuery(x, _assignables)); _transport.On <TestStepQuery>().Reply(x => ReplyOnEntityQuery <TestStepQuery, TestStepDTO, TestStepQueryResult>(x, _testSteps)); }
public void CreateBugInitializationSaga() { _transport = TransportMock.CreateWithoutStructureMapClear(typeof(BugInitializationSaga).Assembly, Assembly.GetExecutingAssembly()); }
public void BeforeScenario() { _transportMock = TransportMock.CreateWithoutStructureMapClear(typeof(WhenAddANewProfileSpecs).Assembly, typeof(WhenAddANewProfileSpecs).Assembly); }
public void Setup() { TransportMock.CreateWithoutStructureMapClear(typeof(ProjectEmailProfile).Assembly); }