namespace XFESystem.NativeRuntime.Application
{
// Compile only the actual network boundary without building the application
// or loading a native HAL on Windows. Any use of its platform is a test failure.
internal static class NativePlatform
{
internal static long Milliseconds() => throw new InvalidOperationException("A host negative-control test must not call the native platform.");
internal static void Write(string text) => throw new InvalidOperationException("A host negative-control test must not call the native platform.");
internal static void PostDiagnostic(string text) => throw new InvalidOperationException("A host negative-control test must not call the native platform.");
}
}
namespace XFESystem.Network.Tests
{
public sealed class NativeNetworkBoundaryTests
{
[Fact]
public void MissingStrongEntropyRejectsBeforeAnyPciDmaOrNativeCall()
{
Assert.Throws<ArgumentNullException>(() => NativeRuntime.Application.Network.NativeNetwork.ConfigureEntropy(null!));
var error = Assert.Throws<InvalidOperationException>(() => NativeRuntime.Application.Network.NativeNetwork.OpenTcp("www.bing.com", 443));
Assert.Contains("strong random", error.Message);
}
}
}
namespace XFESystem.NativeRuntime.Application
{
// Compile only the actual network boundary without building the application
// or loading a native HAL on Windows. Any use of its platform is a test failure.
internal static class NativePlatform
{
internal static long Milliseconds() => throw new InvalidOperationException("A host negative-control test must not call the native platform.");
internal static void Write(string text) => throw new InvalidOperationException("A host negative-control test must not call the native platform.");
internal static void PostDiagnostic(string text) => throw new InvalidOperationException("A host negative-control test must not call the native platform.");
}
}
namespace XFESystem.Network.Tests
{
public sealed class NativeNetworkBoundaryTests
{
[Fact]
public void MissingStrongEntropyRejectsBeforeAnyPciDmaOrNativeCall()
{
Assert.Throws<ArgumentNullException>(() => NativeRuntime.Application.Network.NativeNetwork.ConfigureEntropy(null!));
var error = Assert.Throws<InvalidOperationException>(() => NativeRuntime.Application.Network.NativeNetwork.OpenTcp("www.bing.com", 443));
Assert.Contains("strong random", error.Message);
}
}
}