-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Load windows sdk from registry * Discover net fx sdk
- Loading branch information
Showing
8 changed files
with
1,954 additions
and
181 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// <copyright file="ISystem.cs" company="Soup"> | ||
// Copyright (c) Soup. All rights reserved. | ||
// </copyright> | ||
|
||
using System.Runtime.Versioning; | ||
|
||
namespace Opal.System; | ||
|
||
/// <summary> | ||
/// The system access interface | ||
/// Interface mainly used to allow for unit testing client code. | ||
/// </summary> | ||
public interface ISystem | ||
{ | ||
/// <summary> | ||
/// Gets the registry value | ||
/// </summary> | ||
[SupportedOSPlatform("windows")] | ||
object? GetRegistryValue(string keyName, string? valueName, object? defaultValue); | ||
} |
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,56 @@ | ||
// <copyright file="MockSystem.cs" company="Soup"> | ||
// Copyright (c) Soup. All rights reserved. | ||
// </copyright> | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Opal.System; | ||
|
||
/// <summary> | ||
/// The mock system | ||
/// TODO: Move into test project. | ||
/// </summary> | ||
public class MockSystem : ISystem | ||
{ | ||
private readonly List<string> requests; | ||
private readonly Dictionary<(string, string?), object?> registryValues; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref='MockProcessManager'/> class. | ||
/// </summary> | ||
public MockSystem() | ||
{ | ||
this.requests = []; | ||
this.registryValues = []; | ||
} | ||
|
||
/// <summary> | ||
/// Register a value | ||
/// </summary> | ||
public void RegisterRegistryValue(string keyName, string? valueName, object? value) | ||
{ | ||
this.registryValues.Add((keyName, valueName), value); | ||
} | ||
|
||
/// <summary> | ||
/// Get the load requests. | ||
/// </summary> | ||
public IReadOnlyList<string> Requests => this.requests; | ||
|
||
/// <summary> | ||
/// Gets the registry value | ||
/// </summary> | ||
public object? GetRegistryValue(string keyName, string? valueName, object? defaultValue) | ||
{ | ||
var message = $"GetRegistryValue: {keyName} {valueName}"; | ||
this.requests.Add(message); | ||
if (this.registryValues.TryGetValue((keyName, valueName), out var value)) | ||
{ | ||
return value; | ||
} | ||
else | ||
{ | ||
return null; | ||
} | ||
} | ||
} |
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,30 @@ | ||
// <copyright file="RuntimeSystem.cs" company="Soup"> | ||
// Copyright (c) Soup. All rights reserved. | ||
// </copyright> | ||
|
||
using Microsoft.Win32; | ||
using System.Runtime.Versioning; | ||
|
||
namespace Opal.System; | ||
|
||
/// <summary> | ||
/// A windows platform specific process executable using system | ||
/// </summary> | ||
public class RuntimeSystem : ISystem | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref='RuntimeProcessManager'/> class. | ||
/// </summary> | ||
public RuntimeSystem() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Gets the registry value | ||
/// </summary> | ||
[SupportedOSPlatform("windows")] | ||
public object? GetRegistryValue(string keyName, string? valueName, object? defaultValue) | ||
{ | ||
return Registry.GetValue(keyName, valueName, null); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
1,914 changes: 1,781 additions & 133 deletions
1,914
code/generate-sharp/swhere.core.unittests/utilities/SwhereManagerUnitTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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