Welcome to mirror list, hosted at ThFree Co, Russian Federation.

RuntimeEnvironmentTest.cs « InteropServices « Runtime « System « tests « System.Runtime.InteropServices « src - github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b758813c4baeb99c85d10c3acb23ba2164a100d0 (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
35
36
37
38
39
40
41
42
43
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Reflection;
using System.Runtime;
using System.Runtime.InteropServices;
using System.IO;
using Xunit;

namespace System.Runtime.InteropServices
{
    public static class RuntimeEnvironmentTest
    {
        [Fact]
        public static void RuntimeEnvironmentRuntimeDirectory()
        {
            Assert.True(Directory.Exists(RuntimeEnvironment.GetRuntimeDirectory()));
        }

        [Fact]
        [ActiveIssue(20600, TargetFrameworkMonikers.UapAot)]
        public static void RuntimeEnvironmentSysVersion()
        {            
            Assert.True(!String.IsNullOrEmpty(RuntimeEnvironment.GetSystemVersion()));
        }

        [Fact]
        [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
        public static void RuntimeEnvironmentNegTest()
        {
            Type clsType = typeof(RuntimeEnvironmentTest);
            Assembly assem = clsType.Assembly;
            Assert.True(!RuntimeEnvironment.FromGlobalAccessCache(assem));

            Assert.Throws<PlatformNotSupportedException>(() => RuntimeEnvironment.SystemConfigurationFile);

            Guid guid;
            Assert.Throws<PlatformNotSupportedException>(() => RuntimeEnvironment.GetRuntimeInterfaceAsObject(guid, guid));
            Assert.Throws<PlatformNotSupportedException>(() => RuntimeEnvironment.GetRuntimeInterfaceAsIntPtr(guid, guid));
        }
    }
}