XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESystem

【Rust】XFE系统,基于Rust和汇编

公开
关注 0 Fork 0 Star 0
UTF-8
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.");
    }
}

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);
        }
    }
}