forked from microsoft/winget-cli
-
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.
- Loading branch information
Showing
3 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
src/Microsoft.Management.Configuration.UnitTests/Helpers/ConfigurationEnvironmentData.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,67 @@ | ||
// ----------------------------------------------------------------------------- | ||
// <copyright file="ConfigurationEnvironmentData.cs" company="Microsoft Corporation"> | ||
// Copyright (c) Microsoft Corporation. Licensed under the MIT License. | ||
// </copyright> | ||
// ----------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Management.Configuration.UnitTests.Helpers | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
/// <summary> | ||
/// Contains the data defining a configuration environment. | ||
/// </summary> | ||
internal class ConfigurationEnvironmentData | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ConfigurationEnvironmentData"/> class. | ||
/// </summary> | ||
internal ConfigurationEnvironmentData() { } | ||
|
||
/// <summary> | ||
/// Gets or sets the security context. | ||
/// </summary> | ||
internal SecurityContext Context { get; set; } = SecurityContext.Current; | ||
|
||
/// <summary> | ||
/// Gets or sets the processor identifier. | ||
/// </summary> | ||
internal string ProcessorIdentifier { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Gets or sets the processor properties. | ||
/// </summary> | ||
internal Dictionary<string, string> ProcessorProperties { get; set; } = new (); | ||
|
||
/// <summary> | ||
/// Applies this environment to the given unit. | ||
/// </summary> | ||
/// <param name="unit">The unit to apply to.</param> | ||
/// <returns>The given unit.</returns> | ||
internal ConfigurationUnit ApplyToUnit(ConfigurationUnit unit) | ||
{ | ||
var environment = unit.Environment; | ||
|
||
environment.Context = this.Context; | ||
environment.ProcessorIdentifier = this.ProcessorIdentifier; | ||
environment.ProcessorProperties.Clear(); | ||
foreach (var property in environment.ProcessorProperties) | ||
{ | ||
environment.ProcessorProperties.Add(property.Key, property.Value); | ||
} | ||
|
||
return unit; | ||
} | ||
|
||
/// <summary> | ||
/// Tests whether the given properties match this object's properties. | ||
/// </summary> | ||
/// <param name="properties">The properties to test.</param> | ||
/// <returns>True if the properties match; false if not.</returns> | ||
internal bool PropertiesEqual(IReadOnlyDictionary<string, string> properties) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/Microsoft.Management.Configuration.UnitTests/Helpers/ConfigurationExtensions.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
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