public IOAdSession Create(ClearQuestServiceConfiguration config) { if (session == null) { session = new SessionClass(); try { session.UserLogon(config.Username, config.Password, config.Database, Constants.SessionTypePrivate, config.ConnectionName); } catch (COMException ex) { throw new ClearQuestLoginException("Connection to the ClearQuest system failed: " + ex.Message); } } return session; }
public void SetUp() { sessionMock = mockRepository.StrictMock<IOAdSession>(); queryMock = mockRepository.DynamicMock<IOAdQueryDef>(); resultSetMock = mockRepository.StrictMock<IOAdResultSet>(); defectMock = mockRepository.StrictMock<IOAdEntity>(); filterNodeMock = mockRepository.StrictMock<IOAdQueryFilterNode>(); sessionBuilderMock = mockRepository.StrictMock<IClearQuestSessionBuilder>(); SetupResult.For(sessionBuilderMock.Create(null)).IgnoreArguments().Return(sessionMock); clearQuestQuery = new ClearQuestQuery(CreateConfig(), sessionBuilderMock); }