From c5cd73dc684645fcb0dd5a891084924aec03957c Mon Sep 17 00:00:00 2001 From: Nirmal Guru Date: Sun, 28 Nov 2021 09:45:24 +0530 Subject: [PATCH] Add support for Task and SDK testing Add Skeletal sources based on `Microsoft.NET.TestFramework` design. --- Tests/MSBuild.TestFramework/Core/IProject.cs | 8 +++++++ Tests/MSBuild.TestFramework/Core/ISdkTest.cs | 16 ++++++++++++++ Tests/MSBuild.TestFramework/Core/ISolution.cs | 8 +++++++ Tests/MSBuild.TestFramework/Core/ITaskTest.cs | 21 +++++++++++++++++++ Tests/MSBuild.TestFramework/Project.cs | 7 ++++++- Tests/MSBuild.TestFramework/SdkTest.cs | 7 ++++++- Tests/MSBuild.TestFramework/Solution.cs | 7 ++++++- Tests/MSBuild.TestFramework/TaskTest.cs | 10 ++++++++- 8 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 Tests/MSBuild.TestFramework/Core/IProject.cs create mode 100644 Tests/MSBuild.TestFramework/Core/ISdkTest.cs create mode 100644 Tests/MSBuild.TestFramework/Core/ISolution.cs create mode 100644 Tests/MSBuild.TestFramework/Core/ITaskTest.cs diff --git a/Tests/MSBuild.TestFramework/Core/IProject.cs b/Tests/MSBuild.TestFramework/Core/IProject.cs new file mode 100644 index 0000000..438b59f --- /dev/null +++ b/Tests/MSBuild.TestFramework/Core/IProject.cs @@ -0,0 +1,8 @@ +using System; + +namespace MSBuild.TestFramework.Core; + +internal interface IProject +{ + void PreProcess(); +} \ No newline at end of file diff --git a/Tests/MSBuild.TestFramework/Core/ISdkTest.cs b/Tests/MSBuild.TestFramework/Core/ISdkTest.cs new file mode 100644 index 0000000..2fb6bbd --- /dev/null +++ b/Tests/MSBuild.TestFramework/Core/ISdkTest.cs @@ -0,0 +1,16 @@ +using System; + +namespace MSBuild.TestFramework.Core; + +internal interface ISdkTest +{ + /// + /// Gets the name of the SDK. + /// + string SdkName { get; } + + /// + /// Gets the version of the SDK. + /// + string SdkVersion { get; } +} \ No newline at end of file diff --git a/Tests/MSBuild.TestFramework/Core/ISolution.cs b/Tests/MSBuild.TestFramework/Core/ISolution.cs new file mode 100644 index 0000000..975c148 --- /dev/null +++ b/Tests/MSBuild.TestFramework/Core/ISolution.cs @@ -0,0 +1,8 @@ +using System; + +namespace MSBuild.TestFramework.Core; + +internal interface ISolution +{ + void PreProcess(); +} \ No newline at end of file diff --git a/Tests/MSBuild.TestFramework/Core/ITaskTest.cs b/Tests/MSBuild.TestFramework/Core/ITaskTest.cs new file mode 100644 index 0000000..ace8430 --- /dev/null +++ b/Tests/MSBuild.TestFramework/Core/ITaskTest.cs @@ -0,0 +1,21 @@ +using System; + +namespace MSBuild.TestFramework.Core; + +internal interface ITaskTest +{ + /// + /// Gets the name of the task. + /// + string TaskName { get; } + + /// + /// Gets the namespace containing the task. + /// + string TaskNamespace { get; } + + /// + /// Gets the name of the assembly containing the task. + /// + string TaskAssemblyName { get; } +} \ No newline at end of file diff --git a/Tests/MSBuild.TestFramework/Project.cs b/Tests/MSBuild.TestFramework/Project.cs index b8cf694..8ab7f5b 100644 --- a/Tests/MSBuild.TestFramework/Project.cs +++ b/Tests/MSBuild.TestFramework/Project.cs @@ -1,10 +1,15 @@ using System; +using MSBuild.TestFramework.Core; namespace MSBuild.TestFramework; -public sealed class Project +public sealed class Project : IProject { public Project() { } + + public void PreProcess() + { + } } \ No newline at end of file diff --git a/Tests/MSBuild.TestFramework/SdkTest.cs b/Tests/MSBuild.TestFramework/SdkTest.cs index 0e8f8d0..62e64e8 100644 --- a/Tests/MSBuild.TestFramework/SdkTest.cs +++ b/Tests/MSBuild.TestFramework/SdkTest.cs @@ -1,10 +1,15 @@ using System; +using MSBuild.TestFramework.Core; namespace MSBuild.TestFramework; -public abstract class SdkTest +public abstract class SdkTest : ISdkTest { public SdkTest() { } + + public string SdkName { init; get; }; + + public string SdkVersion { init; get; } } \ No newline at end of file diff --git a/Tests/MSBuild.TestFramework/Solution.cs b/Tests/MSBuild.TestFramework/Solution.cs index 4bc4fbb..e620d5c 100644 --- a/Tests/MSBuild.TestFramework/Solution.cs +++ b/Tests/MSBuild.TestFramework/Solution.cs @@ -1,10 +1,15 @@ using System; +using MSBuild.TestFramework.Core; namespace MSBuild.TestFramework; -public sealed class Solution +public sealed class Solution : ISolution { public Solution() { } + + public void PreProcess() + { + } } \ No newline at end of file diff --git a/Tests/MSBuild.TestFramework/TaskTest.cs b/Tests/MSBuild.TestFramework/TaskTest.cs index 147fb75..bd6b66a 100644 --- a/Tests/MSBuild.TestFramework/TaskTest.cs +++ b/Tests/MSBuild.TestFramework/TaskTest.cs @@ -1,10 +1,18 @@ using System; +using MSBuild.TestFramework.Core; namespace MSBuild.TestFramework; -public abstract class TaskTest +public abstract class TaskTest : ITaskTest { public TaskTest() { } + + public string TaskName { init; get; }; + + public string TaskNamespace { init; get; } + + public string TaskAssemblyName { init; get; } + } \ No newline at end of file