blob: 87588316e46174845c0daa2a6c5718954d4cb9b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
using System.IO;
using System.Reflection;
using System.Text.Json;
namespace AggregateConfig.Tests.Integration
{
[TestClass]
public class EmbeddedResourceTests
{
[TestMethod]
[DataRow("IntegrationTests.out.json.test.json")]
[DataRow("IntegrationTests.out.arm.test.parameters.json")]
public void ReadEmbeddedResource_DeserializesJsonSuccessfully(string resourceName)
{
// Arrange
string jsonContent;
// Act
using (var stream = Assembly.GetAssembly(typeof(EmbeddedResourceTests)).GetManifestResourceStream(resourceName))
{
Assert.IsNotNull(stream, $"Embedded resource '{resourceName}' not found. Available: {string.Join(", ", Assembly.GetAssembly(typeof(EmbeddedResourceTests)).GetManifestResourceNames())}");
using var reader = new StreamReader(stream);
jsonContent = reader.ReadToEnd();
}
// Deserialize the JSON into an object
var outputData = JsonSerializer.Deserialize<object>(jsonContent);
// Assert
Assert.IsNotNull(outputData, "Deserialization of JSON failed.");
}
}
}
|