/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Compilers/VisualBasic/Test/Emit/Attributes/EmitTestStrongNameProvider.vb
43 строки
2 KB
Tomáš Matoušek
Refactoring of extension methods in source packages (#78620) - take 2 (#78894)
26 июн 2025, 18:42
Не верифицирован
26 июн 2025, 18:42
05fc006
Код
Авторство
О чём код?
' 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. Imports System.IO Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.VisualBasic Imports Microsoft.CodeAnalysis.VisualBasic.UnitTests Imports Roslyn.Test.Utilities Partial Public Class InternalsVisibleToAndStrongNameTests Inherits BasicTestBase <ConditionalFact(GetType(WindowsOnly), Reason:=ConditionalSkipReason.TestExecutionNeedsWindowsTypes)> Public Sub BadInputStream() SigningTestHelpers.InstallKey() Dim thrownException = New IOException("This is a test IOException") Dim testFileSystem = New TestStrongNameFileSystem(Temp.CreateDirectory().Path) With { .CreateFileStreamFunc = Function(filePath As String, fileMode As FileMode, fileAccess As FileAccess, fileShare As FileShare) As FileStream Throw thrownException End Function } Dim testProvider = New TestDesktopStrongNameProvider(fileSystem:=testFileSystem) Dim options = TestOptions.DebugDll.WithStrongNameProvider(testProvider).WithCryptoKeyContainer("RoslynTestContainer") Dim comp = CreateCompilationWithMscorlib40( <compilation> <file name="a.vb"><![CDATA[ Public Class C Public Sub M() End Sub End Class ]]> </file> </compilation>, options:=options) comp.Emit(New MemoryStream()).Diagnostics.Verify( Diagnostic(ERRID.ERR_PeWritingFailure).WithArguments(thrownException.ToString()).WithLocation(1, 1)) End Sub End Class