Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface ITestTransactionTimer : IDisposable { }
- public class TestTransactionTimer : ITestTransactionTimer
- {
- public TestContext TestContext { get; private set; }
- public string TransactionName { get; private set; }
- public TestTransactionTimer(TestContext testContext, string transactionName)
- {
- this.TestContext = testContext;
- this.TransactionName = transactionName;
- this.TestContext.BeginTimer(this.TransactionName);
- }
- public void Dispose()
- {
- this.TestContext.EndTimer(this.TransactionName);
- }
- }
- public class NoOpTestTransactionTimer : ITestTransactionTimer
- {
- public void Dispose() { }
- }
- protected ITestTransactionTimer LogTransaction(string transactionName)
- {
- if ((null == this.TestContext) || !this.TestContext.Properties.Contains("$LoadTestUserContext"))
- {
- return new NoOpTestTransactionTimer();
- }
- return new TestTransactionTimer(this.TestContext, transactionName);
- }
- private TestContext testContextInstance;
- public TestContext TestContext
- {
- get { return testContextInstance; }
- set { testContextInstance = value; }
- }
- //starting User Session
- [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "C:\Path\Data.csv", "Data#csv", DataAccessMethod.Sequential), DeploymentItem("C:\Path\Data.csv"), TestMethod]
- public void smokeTest()
- {
- sUserName = "domain\"+TestContext.DataRow["user"].ToString();
- sPassword = TestContext.DataRow["password"].ToString();
- prospectClientId = TestContext.DataRow["prospectClientId"].ToString();
- accountNumber = TestContext.DataRow["accountNumber"].ToString();
- correlationId = "startUserSession - " + obj.ToString();
- // Start User Session
- using (this.LogTransaction("t1_startUserSession"))
- {
- ChannelFactory<IAppShellService> cfsus = null;
- try
- {
- using (ChannelBuilder.mPContext(ref appShellServiceClient, "IAppShellService", sUserName, sPassword, 0, null, correlationId, false, effectiveDate, ref cfsus))
- {
- var userSessionResult = appShellServiceClient.StartUserSession();
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex);
- }
- finally
- {
- cfsus.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement