public void FailsIfNotConnectedWhenAttachesItem()
        {
            var connectionMock = new Mock <IIssueManagementConnection>();

            connectionMock.Setup(con => con.IsConnected).Returns(false);
            connectionMock.Setup(con => con.AttachComment(It.IsAny <long>(), It.IsAny <string>(), It.IsAny <string>())).Returns(true);
            var plugin = new TestTrackConnector("user", "password", true, connectionMock.Object);

            Assert.That(plugin.AttachCommentToTestTrackItem(11202, "Some Comment"), Is.False);
        }
        public void FailsIfNotConnected()
        {
            var connectionMock = new Mock <IIssueManagementConnection>();

            connectionMock.Setup(con => con.IsConnected).Returns(false);
            connectionMock.Setup(con => con.CreateDefect(It.IsAny <CDefect>())).Returns(12321);
            var plugin = new TestTrackConnector("user", "password", true, connectionMock.Object);

            Assert.That(plugin.CreateDefect("Git Training - Test VSSonarQube Extension", "Some Comment"), Is.EqualTo(-1));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SQGitPlugin" /> class.
 /// </summary>
 /// <param name="notificationManager">The notification manager.</param>
 public TestTrackPlugin(INotificationManager notificationManager, ISonarConfiguration configuration)
 {
     this.userConf                = configuration;
     this.notificationManager     = notificationManager;
     this.descrition              = new PluginDescription();
     this.descrition.Enabled      = true;
     this.descrition.Description  = "TestTrack Plugin";
     this.descrition.Name         = "TestTrack Plugin";
     this.descrition.Version      = Assembly.GetExecutingAssembly().GetName().Version.ToString();
     this.descrition.AssemblyPath = Assembly.GetExecutingAssembly().Location;
     this.testTrackIntegration    = new TestTrackConnector(configuration.Username, configuration.Password, true, new TtConnection());
 }
 /// <summary>
 /// Associates the project.
 /// </summary>
 /// <param name="project">The project.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="connector">The connector.</param>
 public void AssociateProject(Resource project, ISonarConfiguration configuration, IIssueManagementConnection connector, string vsVersion)
 {
     this.associatedProject    = project;
     this.userConf             = configuration;
     this.testTrackIntegration = new TestTrackConnector(configuration.Username, configuration.Password, true, connector);
 }
 /// <summary>
 /// Called when [connect to sonar].
 /// </summary>
 /// <param name="config">The configuration.</param>
 public void OnConnectToSonar(ISonarConfiguration config)
 {
     this.userConf             = config;
     this.testTrackIntegration = new TestTrackConnector(config.Username, config.Password, true, new TtConnection());
 }
 /// <summary>
 /// Associates the project.
 /// </summary>
 /// <param name="project">The project.</param>
 /// <param name="configuration">The configuration.</param>
 public void AssociateProject(Resource project, ISonarConfiguration configuration, Dictionary <string, Profile> profiles, string vsVersion)
 {
     this.associatedProject    = project;
     this.userConf             = configuration;
     this.testTrackIntegration = new TestTrackConnector(configuration.Username, configuration.Password, true, new TtConnection());
 }