Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
- name: Build solution
run: dotnet build "${{ github.workspace }}/src/SDK.sln" --no-restore -c Release
- name: Run tests
run: dotnet test "${{ github.workspace }}/src/SDK.sln" -c Release --filter "TestCategory~Unit|TestCategory~Integration|TestCategory~Functional" --no-build --verbosity normal
run: dotnet test "${{ github.workspace }}/src/SDK.sln" -c Release --no-build --verbosity normal
- name: Build samples
run: ls "${{ github.workspace }}/samples/**/*.sln" | % { dotnet build $_.FullName -c Release }
2 changes: 1 addition & 1 deletion .github/workflows/main_tests_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
- name: Build solution
run: dotnet build "${{ github.workspace }}/src/SDK.sln" --no-restore -c Release
- name: Run tests
run: dotnet test "${{ github.workspace }}/src/SDK.sln" -c Release --filter "TestCategory~Unit|TestCategory~Integration|TestCategory~Functional" --no-build --verbosity normal
run: dotnet test "${{ github.workspace }}/src/SDK.sln" -c Release --no-build --verbosity normal
6 changes: 3 additions & 3 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Update="MSTest.TestAdapter" Version="2.2.7" />
<PackageReference Update="MSTest.TestFramework" Version="2.2.7" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="18.5.1" />
<PackageReference Update="MSTest.TestAdapter" Version="4.2.2" />
<PackageReference Update="MSTest.TestFramework" Version="4.2.2" />
<PackageReference Update="System.Text.Json" Version="10.0.8" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static void Initialize(TestContext context)

// If this Assert is hit, the SDK was likely updated to break
// the processing source definitions used to test this class
Assert.Fail("ProcessingSource {0} failed to compile", plugin);
Assert.Fail($"ProcessingSource {plugin} failed to compile");
}
else
{
Expand All @@ -130,47 +130,47 @@ public static void Initialize(TestContext context)
public void NullDirectoryThrows()
{
(var loader, _) = Setup(true);
Assert.ThrowsException<ArgumentNullException>(() => loader.TryLoadPlugin(null, out _));
Assert.ThrowsExactly<ArgumentNullException>(() => loader.TryLoadPlugin(null, out _));
}

[TestMethod]
[UnitTest]
public async Task NullDirectoryThrowsAsync()
{
(var loader, _) = Setup(true);
await Assert.ThrowsExceptionAsync<ArgumentNullException>(() => loader.TryLoadPluginAsync(null));
await Assert.ThrowsExactlyAsync<ArgumentNullException>(() => loader.TryLoadPluginAsync(null));
}

[TestMethod]
[UnitTest]
public void NullDirectoriesThrows()
{
(var loader, _) = Setup(true);
Assert.ThrowsException<ArgumentNullException>(() => loader.TryLoadPlugins(null, out _));
Assert.ThrowsExactly<ArgumentNullException>(() => loader.TryLoadPlugins(null, out _));
}

[TestMethod]
[UnitTest]
public async Task NullDirectoriesThrowsAsync()
{
(var loader, _) = Setup(true);
await Assert.ThrowsExceptionAsync<ArgumentNullException>(() => loader.TryLoadPluginsAsync(null));
await Assert.ThrowsExactlyAsync<ArgumentNullException>(() => loader.TryLoadPluginsAsync(null));
}

[TestMethod]
[UnitTest]
public void NullDirectoryInDirectoriesThrows()
{
(var loader, _) = Setup(true);
Assert.ThrowsException<ArgumentNullException>(() => loader.TryLoadPlugins(new List<string>() { "foo", null }, out _));
Assert.ThrowsExactly<ArgumentNullException>(() => loader.TryLoadPlugins(new List<string>() { "foo", null }, out _));
}

[TestMethod]
[UnitTest]
public async Task NullDirectoryInDirectoriesThrowsAsync()
{
(var loader, _) = Setup(true);
await Assert.ThrowsExceptionAsync<ArgumentNullException>(() => loader.TryLoadPluginsAsync(new List<string>() { "foo", null }));
await Assert.ThrowsExactlyAsync<ArgumentNullException>(() => loader.TryLoadPluginsAsync(new List<string>() { "foo", null }));
}

[TestMethod]
Expand Down Expand Up @@ -635,9 +635,7 @@ public void ConcurrentLoadTest()
// Assert blocking observed first plugin
Assert.AreEqual(expected0.Length,
blockingConsumer.ObservedDataSources.Count,
"Blocking consumer observed {0} data sources but should have observed {1}",
blockingConsumer.ObservedDataSources.Count,
expected0.Length);
$"Blocking consumer observed {blockingConsumer.ObservedDataSources.Count} data sources but should have observed {expected0.Length}");
AssertObservedCDSs(expected0, blockingConsumer);

// Allow InvalidB to be processed
Expand All @@ -660,16 +658,16 @@ public async Task WhenDisposed_EverythingThrows()
{
sut.Dispose();

Assert.ThrowsException<ObjectDisposedException>(() => sut.LoadedProcessingSources);
Assert.ThrowsExactly<ObjectDisposedException>(() => sut.LoadedProcessingSources);

Assert.ThrowsException<ObjectDisposedException>(() => sut.Subscribe(new MockPluginsConsumer()));
await Assert.ThrowsExceptionAsync<ObjectDisposedException>(() => sut.SubscribeAsync(new MockPluginsConsumer()));
Assert.ThrowsException<ObjectDisposedException>(() => sut.TryLoadPlugin(Any.FilePath(), out _));
await Assert.ThrowsExceptionAsync<ObjectDisposedException>(() => sut.TryLoadPluginAsync(Any.FilePath()));
Assert.ThrowsException<ObjectDisposedException>(() => sut.TryLoadPlugins(new[] { Any.FilePath(), }, out _));
await Assert.ThrowsExceptionAsync<ObjectDisposedException>(() => sut.TryLoadPluginsAsync(new[] { Any.FilePath(), }));
Assert.ThrowsException<ObjectDisposedException>(() => sut.Unsubscribe(new MockPluginsConsumer()));
await Assert.ThrowsExceptionAsync<ObjectDisposedException>(() => sut.UnsubscribeAsync(new MockPluginsConsumer()));
Assert.ThrowsExactly<ObjectDisposedException>(() => sut.Subscribe(new MockPluginsConsumer()));
await Assert.ThrowsExactlyAsync<ObjectDisposedException>(() => sut.SubscribeAsync(new MockPluginsConsumer()));
Assert.ThrowsExactly<ObjectDisposedException>(() => sut.TryLoadPlugin(Any.FilePath(), out _));
await Assert.ThrowsExactlyAsync<ObjectDisposedException>(() => sut.TryLoadPluginAsync(Any.FilePath()));
Assert.ThrowsExactly<ObjectDisposedException>(() => sut.TryLoadPlugins(new[] { Any.FilePath(), }, out _));
await Assert.ThrowsExactlyAsync<ObjectDisposedException>(() => sut.TryLoadPluginsAsync(new[] { Any.FilePath(), }));
Assert.ThrowsExactly<ObjectDisposedException>(() => sut.Unsubscribe(new MockPluginsConsumer()));
await Assert.ThrowsExactlyAsync<ObjectDisposedException>(() => sut.UnsubscribeAsync(new MockPluginsConsumer()));
}
}

Expand Down Expand Up @@ -741,17 +739,12 @@ private static void AssertNumberProcessingSourcesLoaded(int expected, PluginsLoa
{
Assert.AreEqual(expected,
loader.LoadedProcessingSources.Count(),
"The plugins loader reports having loaded {0} instead of {1} processing sources",
loader.LoadedProcessingSources.Count(),
expected);
$"The plugins loader reports having loaded {loader.LoadedProcessingSources.Count()} instead of {expected} processing sources");
foreach (var consumer in consumers)
{
Assert.AreEqual(expected,
consumer.ObservedDataSources.Count,
"Consumer {0} observed {1} instead of {2} processing sources",
consumer,
consumer.ObservedDataSources.Count,
expected);
$"Consumer {consumer} observed {consumer.ObservedDataSources.Count} instead of {expected} processing sources");
}
}

Expand Down Expand Up @@ -794,22 +787,13 @@ private static void AssertCDSs(Type[] types, IEnumerable<ProcessingSourceReferen

Assert.AreEqual(expected.Guid,
actual.Guid,
"The loaded ProcessingSource at index {0} had the GUID {1} instead of {2}",
i,
actual.Guid,
expected.Guid);
$"The loaded ProcessingSource at index {i} had the GUID {actual.Guid} instead of {expected.Guid}");
Assert.AreEqual(expected.Name,
actual.Name,
"ProcessingSource {0} was loaded with the name {1} instead of {2}",
actual.Guid,
actual.Name,
expected.Name);
$"ProcessingSource {actual.Guid} was loaded with the name {actual.Name} instead of {expected.Name}");
Assert.AreEqual(expected.Description,
actual.Description,
"ProcessingSource {0} was loaded with the description {1} instead of {2}",
actual.Guid,
actual.Description,
expected.Description);
$"ProcessingSource {actual.Guid} was loaded with the description {actual.Description} instead of {expected.Description}");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void WithToggle_NullIdentifierThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithToggle(null, Projection.Constant(1f));
});
Expand All @@ -34,7 +34,7 @@ public void WithToggle_NullProjectionThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithToggle<int>(new ColumnVariantDescriptor(Guid.NewGuid(), new ColumnVariantProperties { Label = "Foo" }), null);
});
Expand All @@ -45,7 +45,7 @@ public void WithHierarchicalToggle_NullIdentifierThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithHierarchicalToggle(
null,
Expand All @@ -59,7 +59,7 @@ public void WithHierarchicalToggle_NullProjectionThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithHierarchicalToggle(
new ColumnVariantDescriptor(Guid.NewGuid(), new ColumnVariantProperties { Label = "Foo" }),
Expand All @@ -73,7 +73,7 @@ public void WithHierarchicalToggle_NullCollectionInfoThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithHierarchicalToggle(
new ColumnVariantDescriptor(Guid.NewGuid(), new ColumnVariantProperties { Label = "Foo" }),
Expand All @@ -87,7 +87,7 @@ public void WithToggledModes_NullTextThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() => { builder.WithToggledModes(null, builder => builder); });
Assert.ThrowsExactly<ArgumentNullException>(() => { builder.WithToggledModes(null, builder => builder); });
}

[TestMethod]
Expand All @@ -103,7 +103,7 @@ public void WithModes_NullPropertiesThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() => { builder.WithModes(null, builder => builder); });
Assert.ThrowsExactly<ArgumentNullException>(() => { builder.WithModes(null, builder => builder); });
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void WithMode_NullIdentifierThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithMode(null, Projection.Constant(1f));
});
Expand All @@ -38,7 +38,7 @@ public void WithMode_NullProjectionThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithMode<int>(modeDescriptor, null);
});
Expand All @@ -57,7 +57,7 @@ public void WithHierarchicalMode_NullIdentifierThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithHierarchicalMode(
null,
Expand All @@ -71,7 +71,7 @@ public void WithHierarchicalMode_NullProjectionThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithHierarchicalMode<float>(
modeDescriptor,
Expand All @@ -85,7 +85,7 @@ public void WithHierarchicalMode_NullCollectionInfoThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithHierarchicalMode<float>(
modeDescriptor,
Expand All @@ -111,7 +111,7 @@ public void WithDefaultMode_UnregisteredGuidThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentException>(() =>
Assert.ThrowsExactly<ArgumentException>(() =>
{
builder.WithDefaultMode(Guid.NewGuid());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void WithToggle_NullIdentifierThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithToggle(null, Projection.Constant(1f));
});
Expand All @@ -34,7 +34,7 @@ public void WithToggle_NullProjectionThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithToggle<int>(new ColumnVariantDescriptor(Guid.NewGuid(), new ColumnVariantProperties { Label = "Foo" }), null);
});
Expand All @@ -45,7 +45,7 @@ public void WithHierarchicalToggle_NullIdentifierThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithHierarchicalToggle(
null,
Expand All @@ -59,7 +59,7 @@ public void WithHierarchicalToggle_NullProjectionThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithHierarchicalToggle(
new ColumnVariantDescriptor(Guid.NewGuid(), new ColumnVariantProperties { Label = "Foo" }),
Expand All @@ -73,7 +73,7 @@ public void WithHierarchicalToggle_NullCollectionInfoThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() =>
Assert.ThrowsExactly<ArgumentNullException>(() =>
{
builder.WithHierarchicalToggle(
new ColumnVariantDescriptor(Guid.NewGuid(), new ColumnVariantProperties { Label = "Foo" }),
Expand All @@ -87,7 +87,7 @@ public void WithToggledModes_NullTextThrows()
{
var builder = CreateSut();

Assert.ThrowsException<ArgumentNullException>(() => { builder.WithToggledModes(null, modesBuilder => modesBuilder); });
Assert.ThrowsExactly<ArgumentNullException>(() => { builder.WithToggledModes(null, modesBuilder => modesBuilder); });
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void TryQueryAddFuncAsFunc()
[UnitTest]
public void QueryAsWrongTypeThrows()
{
Assert.ThrowsException<InvalidCastException>(
Assert.ThrowsExactly<InvalidCastException>(
() => testReflector.QueryOutput<bool>(
new DataOutputPath(TestCookedDataReflector.DefaultCookerPath, nameof(TestCookedDataReflector.AddFunc))));
}
Expand All @@ -133,7 +133,7 @@ public void TryQueryAsWrongTypeFails()
[UnitTest]
public void QueryNonExistentPathThrows()
{
Assert.ThrowsException<InvalidOperationException>(
Assert.ThrowsExactly<InvalidOperationException>(
() => testReflector.QueryOutput<bool>(
new DataOutputPath(TestCookedDataReflector.DefaultCookerPath, "DoesNotExist")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public class DataSourceResolverTests
[UnitTest]
public void Assign_NullDataSourcesThrows()
{
Assert.ThrowsException<ArgumentNullException>(
Assert.ThrowsExactly<ArgumentNullException>(
() => DataSourceResolver.Assign(null, Array.Empty<ProcessingSourceReference>()));
}

[TestMethod]
[UnitTest]
public void Assign_NullProcessingSourcesThrows()
{
Assert.ThrowsException<ArgumentNullException>(
Assert.ThrowsExactly<ArgumentNullException>(
() => DataSourceResolver.Assign(Array.Empty<IDataSource>(), null));
}

Expand Down Expand Up @@ -161,7 +161,7 @@ public void AssignTests(AssignTestCase testCase)
var ecds = kvp.Key;
var eds = kvp.Value.ToList();

Assert.IsTrue(actual.ContainsKey(ecds), "'{0}' is not found in the assignment.", ecds);
Assert.IsTrue(actual.ContainsKey(ecds), $"'{ecds}' is not found in the assignment.");
var ads = actual[ecds].ToList();

CollectionAssert.AreEquivalent(eds, ads);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void Setup()
[UnitTest]
public void ProcessAssemblies_NullDirectoryPath()
{
Assert.ThrowsException<ArgumentNullException>(() => this.Discovery.ProcessAssemblies((string)null, out _));
Assert.ThrowsExactly<ArgumentNullException>(() => this.Discovery.ProcessAssemblies((string)null, out _));
}

[TestMethod]
Expand Down
Loading
Loading