Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Refactor MSI code tests to use only Xunit #5845

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packaging/msi/SplunkCustomActions/test/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
global using Xunit;
global using FluentAssertions;
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void GetEnvironmentValue()
using (var multiStringEnvironment = new MultiStringEnvironment(RegistryHive.CurrentUser, TestSubKey, TestValueName))
{
var actualEnvironment = multiStringEnvironment.GetEnvironmentValue();
actualEnvironment.Should().BeEquivalentTo(initialEnvironment);
Assert.Equal(initialEnvironment, actualEnvironment);
}
}
finally
Expand Down Expand Up @@ -73,7 +73,8 @@ public void AddingOptionalConfigurations()
"key3=value3"
};

Registry.GetValue(TestKey, TestValueName, Array.Empty<string>()).Should().BeEquivalentTo(expectedEnvironment);
var actualEnvironment = Registry.GetValue(TestKey, TestValueName, Array.Empty<string>());
Assert.Equal(expectedEnvironment, actualEnvironment);
}
finally
{
Expand All @@ -84,11 +85,10 @@ public void AddingOptionalConfigurations()
[Fact]
public void DefaultConstructorShouldFail()
{
Action action = () => new MultiStringEnvironment();
action
.Should()
.Throw<InvalidOperationException>()
.WithMessage("Failed to open the registry sub key: SYSTEM\\CurrentControlSet\\Services\\splunk-otel-collector");
var invalidOperationException = Assert.Throws<InvalidOperationException>(() => new MultiStringEnvironment());
Assert.Equal(
@"Failed to open the registry sub key: SYSTEM\CurrentControlSet\Services\splunk-otel-collector",
invalidOperationException.Message);
}

private void DeleteTestSubKey()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="8.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down
Loading