public void NetFrameworkVersionProvider_NoReference()
        {
            var compilation     = GetRawCompilation();
            var versionProvider = new NetFrameworkVersionProvider();

            versionProvider.GetDotNetFrameworkVersion(compilation).Should().Be(NetFrameworkVersion.Unknown);
        }
        public void NetFrameworkVersionProvider_CurrentAssemblyMscorlib()
        {
            var compilation     = GetRawCompilation(FrameworkMetadataReference.Mscorlib.Concat(FrameworkMetadataReference.System));
            var versionProvider = new NetFrameworkVersionProvider();

            versionProvider.GetDotNetFrameworkVersion(compilation).Should().Be(NetFrameworkVersion.After452);
        }
        public void NetFrameworkVersionProvider_WithNullCompilation_ReturnsUnknown()
        {
            // Arrange
            var versionProvider = new NetFrameworkVersionProvider();

            // Act & Assert
            versionProvider.GetDotNetFrameworkVersion(null).Should().Be(NetFrameworkVersion.Unknown);
        }
示例#4
0
        public void NetFrameworkVersionProvider_Net40_NoIOClass()
        {
            var mscorlib35      = ImmutableArray.Create((MetadataReference)MetadataReference.CreateFromFile(CreateMockPath("4.0_no_IO/mscorlib.dll")));
            var compilation     = GetRawCompilation(mscorlib35);
            var versionProvider = new NetFrameworkVersionProvider();

            versionProvider.GetDotNetFrameworkVersion(compilation).Should().Be(NetFrameworkVersion.Between4And451);
        }
示例#5
0
        public void NetFrameworkVersionProvider_Net35()
        {
            var mscorlib35      = ImmutableArray.Create((MetadataReference)MetadataReference.CreateFromFile(CreateMockPath("3.5/mscorlib.dll")));
            var compilation     = GetRawCompilation(mscorlib35);
            var versionProvider = new NetFrameworkVersionProvider();

            versionProvider.GetDotNetFrameworkVersion(compilation).Should().Be(NetFrameworkVersion.Probably35);
        }
        public void NetFrameworkVersionProvider_CurrentAssemblyMscorlib_Netstandard()
        {
            var compilation = GetRawCompilation(FrameworkMetadataReference.Mscorlib
                                                .Concat(FrameworkMetadataReference.System)
                                                .Concat(FrameworkMetadataReference.Netstandard));
            var versionProvider = new NetFrameworkVersionProvider();

            // the local .net framework mscorlib is actually used
            versionProvider.GetDotNetFrameworkVersion(compilation).Should().Be(NetFrameworkVersion.After452);
        }
        public void NetFrameworkVersionProvider_CurrentAssemblyMscorlib()
        {
            var compilation     = GetRawCompilation(GetAdditionalReferences());
            var versionProvider = new NetFrameworkVersionProvider();

#if NETFRAMEWORK
            versionProvider.GetDotNetFrameworkVersion(compilation).Should().Be(NetFrameworkVersion.After452);
#else
            versionProvider.GetDotNetFrameworkVersion(compilation).Should().Be(NetFrameworkVersion.Unknown);
#endif
        }
        public void NetFrameworkVersionProvider_CurrentAssemblyMscorlib_Netstandard()
        {
            var compilation     = GetRawCompilation(GetAdditionalReferences());
            var versionProvider = new NetFrameworkVersionProvider();

#if NETFRAMEWORK
            // the local .net framework mscorlib is actually used
            versionProvider.GetDotNetFrameworkVersion(compilation).Should().Be(NetFrameworkVersion.After452);
#else
            versionProvider.GetDotNetFrameworkVersion(compilation).Should().Be(NetFrameworkVersion.Unknown);
#endif
        }