Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
7215960
commit 89e2eb2
Showing
8 changed files
with
116 additions
and
5 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
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,31 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System.Management.Automation; | ||
using Xunit; | ||
|
||
namespace PSRule | ||
{ | ||
public sealed class SourceTests | ||
{ | ||
[Fact] | ||
public void TargetSourceInfo() | ||
{ | ||
var source = new PSObject(); | ||
source.Properties.Add(new PSNoteProperty("file", "file.json")); | ||
source.Properties.Add(new PSNoteProperty("line", 100)); | ||
source.Properties.Add(new PSNoteProperty("position", 1000)); | ||
var info = new PSObject(); | ||
info.Properties.Add(new PSNoteProperty("source", new PSObject[] { source })); | ||
var o = new PSObject(); | ||
o.Properties.Add(new PSNoteProperty("_PSRule", info)); | ||
o.ConvertTargetInfoProperty(); | ||
|
||
var actual = o.GetSourceInfo(); | ||
Assert.NotNull(actual); | ||
Assert.Equal("file.json", actual[0].File); | ||
Assert.Equal(100, actual[0].Line); | ||
Assert.Equal(1000, actual[0].Position); | ||
} | ||
} | ||
} |