-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also added Azure only testing logic & test area for using updater (to actually make)
- Loading branch information
Showing
21 changed files
with
229 additions
and
52 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
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,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Deltas\TinyUpdate.Delta.BSDiff\TinyUpdate.Delta.BSDiff.csproj" /> | ||
<ProjectReference Include="..\Deltas\TinyUpdate.Delta.MSDelta\TinyUpdate.Delta.MSDelta.csproj" /> | ||
<ProjectReference Include="..\Packages\TinyUpdate.TUUP\TinyUpdate.TUUP.csproj" /> | ||
<ProjectReference Include="..\Updaters\TinyUpdate.Desktop\TinyUpdate.Desktop.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,7 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
|
||
//TODO: When local client is made, add it to this for testing | ||
|
||
using TinyUpdate.Core; | ||
|
||
Console.WriteLine("Hello, World! In Test Runner?: " + Testing.InTestRunner); |
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,33 @@ | ||
using System.Reflection; | ||
|
||
namespace TinyUpdate.Core; | ||
|
||
public static class Testing | ||
{ | ||
public static bool InTestRunner | ||
{ | ||
get | ||
{ | ||
var nunitAssemblyName = Assembly.GetExecutingAssembly().GetReferencedAssemblies() | ||
.FirstOrDefault(x => x.Name == "nunit.framework"); | ||
if (nunitAssemblyName == null) | ||
{ | ||
return false; | ||
} | ||
|
||
var contextType = Assembly.Load(nunitAssemblyName).GetType("NUnit.Framework.Internal.TestExecutionContext"); | ||
var currentContextProperty = contextType?.GetProperty("CurrentContext", BindingFlags.Public | BindingFlags.Static); | ||
var currentContext = currentContextProperty?.GetValue(null); | ||
|
||
var startTicksProperty = currentContext?.GetType().GetProperty("StartTicks", BindingFlags.Public | BindingFlags.Instance); | ||
var startTicksObj = startTicksProperty?.GetValue(currentContext); | ||
|
||
if (startTicksObj is long startTicks) | ||
{ | ||
return startTicks > 0; | ||
} | ||
|
||
return false; | ||
} | ||
} | ||
} |
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,13 @@ | ||
using TinyUpdate.Core.Tests.Attributes; | ||
|
||
namespace TinyUpdate.Clients.Tests; | ||
|
||
[AzureTest] | ||
public class AzureClientTests | ||
{ | ||
[Test] | ||
public void Test() | ||
{ | ||
Assert.Pass(); | ||
} | ||
} |
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 @@ | ||
global using NUnit.Framework; |
23 changes: 23 additions & 0 deletions
23
tests/TinyUpdate.Clients.Tests/TinyUpdate.Clients.Tests.csproj
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,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Clients\TinyUpdate.Azure\TinyUpdate.Azure.csproj" /> | ||
<ProjectReference Include="..\TinyUpdate.Core.Tests\TinyUpdate.Core.Tests.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
17 changes: 17 additions & 0 deletions
17
tests/TinyUpdate.Core.Tests/Attributes/AzureTestAttribute.cs
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,17 @@ | ||
using NUnit.Framework.Interfaces; | ||
using NUnit.Framework.Internal; | ||
|
||
namespace TinyUpdate.Core.Tests.Attributes; | ||
|
||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] | ||
public class AzureTestAttribute : Attribute, IApplyToTest | ||
{ | ||
public void ApplyToTest(Test test) | ||
{ | ||
if (Environment.GetEnvironmentVariable("AZURE_DEVOPS_EXT_PAT") == null) | ||
{ | ||
test.RunState = RunState.Skipped; | ||
test.Properties.Set(PropertyNames.SkipReason, "Unable to run Azure Test without AZURE_DEVOPS_EXT_PAT set"); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.