-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
141 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* SonarLint for Visual Studio | ||
* Copyright (C) 2016-2023 SonarSource SA | ||
* mailto:info AT sonarsource DOT com | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
using System.Threading.Tasks; | ||
using SonarLint.VisualStudio.SLCore.Core; | ||
using SonarLint.VisualStudio.SLCore.Listener; | ||
using SonarLint.VisualStudio.TestInfrastructure; | ||
|
||
namespace SonarLint.VisualStudio.SLCore.UnitTests.Listener | ||
{ | ||
[TestClass] | ||
public class ProgressListenerTests | ||
{ | ||
[TestMethod] | ||
public void MefCtor_CheckIsExported() | ||
{ | ||
MefTestHelpers.CheckTypeCanBeImported<ProgressListener, ISLCoreListener>(); | ||
} | ||
|
||
[TestMethod] | ||
public void Mef_CheckIsSingleton() | ||
{ | ||
MefTestHelpers.CheckIsSingletonMefComponent<ProgressListener>(); | ||
} | ||
|
||
[TestMethod] | ||
[DataRow(null)] | ||
[DataRow(5)] | ||
[DataRow("something")] | ||
public void StartProgress_ReturnsCompletedTaskAlways(object parameter) | ||
{ | ||
var testSubject = new ProgressListener(); | ||
|
||
var result = testSubject.StartProgress(parameter); | ||
|
||
result.Should().Be(Task.CompletedTask); | ||
} | ||
|
||
[TestMethod] | ||
[DataRow(null)] | ||
[DataRow(5)] | ||
[DataRow("something")] | ||
public void ReportProgress_ReturnsCompletedTaskAlways(object parameter) | ||
{ | ||
var testSubject = new ProgressListener(); | ||
|
||
var result = testSubject.ReportProgress(parameter); | ||
|
||
result.Should().Be(Task.CompletedTask); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* SonarLint for Visual Studio | ||
* Copyright (C) 2016-2023 SonarSource SA | ||
* mailto:info AT sonarsource DOT com | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
using System.ComponentModel.Composition; | ||
using System.Threading.Tasks; | ||
using SonarLint.VisualStudio.SLCore.Core; | ||
|
||
namespace SonarLint.VisualStudio.SLCore.Listener | ||
{ | ||
[Export(typeof(ISLCoreListener))] | ||
[PartCreationPolicy(CreationPolicy.Shared)] | ||
public class ProgressListener : ISLCoreListener | ||
{ | ||
/// <summary> | ||
/// Stub method for compability with SLCore. We do not support progress | ||
/// </summary> | ||
/// <param name="parameters">Parameter's here for compability we discard it</param> | ||
public Task StartProgress(object parameters) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
/// <summary> | ||
/// Stub method for compability with SLCore. We do not support progress | ||
/// </summary> | ||
/// <param name="parameters">Parameter's here for compability we discard it</param> | ||
public Task ReportProgress(object parameters) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
} | ||
} |