Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for VB runtime also fixes #5179 and uses Fluent Assertions #11655

Closed
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
9bda02d
Makes DataGridView row header left border have proper luminosity in R…
May 24, 2024
d3dcc5d
Fix editorConfig for VB
paul1956 Jul 11, 2024
970122a
Add Tests
paul1956 Jul 11, 2024
90a3e37
Clean up tests, some tests deleted becuase of dependencies not in thi…
paul1956 Jul 11, 2024
2276478
Fix up some failing test. Utils will be going away and ExceptionUtils…
paul1956 Jul 11, 2024
a8c14fa
Use FluentAssertions; in C# Tests
paul1956 Jul 12, 2024
504b608
Add additional tests and make changes required to fix errors
paul1956 Jul 12, 2024
f8d5833
Sync with Fix Editor Config PR
paul1956 Jul 15, 2024
61589c2
Fix more merge issues
paul1956 Jul 15, 2024
5b28657
Clean up comments
paul1956 Jul 16, 2024
cce6962
Rename Hosting File
paul1956 Jul 16, 2024
79bd7a6
Cleanup ExceptionUtilities
paul1956 Jul 16, 2024
30d74ac
PR Review change
paul1956 Jul 16, 2024
7b0a44d
Remove old comment
paul1956 Jul 16, 2024
dcc4ede
Merge branch 'master' into Add-Tests-for-VB-Runtime-Review-2nd
paul1956 Jul 16, 2024
12e709d
Remove Option statement from VB because its in Project file
paul1956 Jul 16, 2024
719a6db
Rename Class Utils to Utils1 to avoid conflict. Class will be remove …
paul1956 Jul 17, 2024
668fa70
Change VbUtils to ExUtils, and simplify ExceptionUtils
paul1956 Jul 20, 2024
a7e975b
Merge
paul1956 Jul 20, 2024
b9c2f71
Sort privates and functions without code changes
paul1956 Jul 20, 2024
69d75d0
Fix formatting of GetProgressDialog
paul1956 Jul 20, 2024
5c81663
Replce "" with String.Empty
paul1956 Jul 20, 2024
0c1fbf0
Minor Cleanup and move PROCESS_INFORMATION class to separate file
paul1956 Jul 20, 2024
0aaa9dd
Code and comment cleanup
paul1956 Jul 20, 2024
dc73c63
Cleanup NetworkDownload comments
paul1956 Jul 20, 2024
add6c07
Fix formatting in Audio.vb
paul1956 Jul 20, 2024
6a279a5
More Native Type cleanup.
paul1956 Jul 20, 2024
ee80004
Cleanup formatting for NativeTypes
paul1956 Jul 20, 2024
12a9feb
Clean up document comments and long line formatting
paul1956 Jul 20, 2024
7589b9c
[main] Update dependencies from dotnet/arcade (#11738)
dotnet-maestro[bot] Jul 23, 2024
0119a8c
[main] Update dependencies from dotnet/runtime (#11739)
dotnet-maestro[bot] Jul 23, 2024
cfb1cf0
Update to RC1 (#11729)
lonitra Jul 23, 2024
67ea664
Merge branch 'master' into Add-Tests-for-VB-Runtime-Review-2nd
paul1956 Jul 24, 2024
8b0150c
[main] Update dependencies from dotnet/runtime (#11744)
dotnet-maestro[bot] Jul 24, 2024
6911080
Switch to System.Formats.Nrbf (#11745)
adamsitnik Jul 24, 2024
c3cb9b3
Add binary Formatter package to DemoConsole (#11741)
LeafShi1 Jul 24, 2024
84d2f99
Localized file check-in by OneLocBuild Task: Build definition ID 164:…
dotnet-bot Jul 24, 2024
df46889
More code cleanup
paul1956 Jul 25, 2024
1d02156
Sort ClipBoardProxy tests
paul1956 Jul 25, 2024
6e62e66
[main] Update dependencies from dotnet/arcade (#11755)
dotnet-maestro[bot] Jul 25, 2024
95c9302
[main] Update dependencies from dotnet/runtime (#11756)
dotnet-maestro[bot] Jul 25, 2024
28b22a2
Add WinForms Analyzer and CodeFixes Infrastructure for C# and Visual …
KlausLoeffelmann Jul 25, 2024
af3ded9
Fix LocProject.json (#11757)
lonitra Jul 25, 2024
6d9846b
Skip test TreeNodeIKeyboardToolTip_InvokeIsHoveredWithMouse_ReturnsEx…
LeafShi1 Jul 26, 2024
19de565
[main] Update dependencies from dotnet/arcade (#11762)
dotnet-maestro[bot] Jul 26, 2024
bacb9f8
[main] Update dependencies from dotnet/runtime (#11763)
dotnet-maestro[bot] Jul 26, 2024
6e32330
Merge branch 'master' into Add-Tests-for-VB-Runtime-Review-2nd
paul1956 Jul 28, 2024
1d2a2b8
[main] Update dependencies from dotnet/runtime (#11765)
dotnet-maestro[bot] Jul 29, 2024
8e25f5a
[main] Update dependencies from dotnet/runtime (#11771)
dotnet-maestro[bot] Jul 29, 2024
00b8d56
fix issue 11450 Color contrast ratio of focus indicator over 'toolSt…
Epica3055 Jul 30, 2024
7f3a0d4
Localized file check-in by OneLocBuild Task: Build definition ID 164:…
dotnet-bot Jul 30, 2024
6476dfa
[main] Update dependencies from dotnet/runtime (#11777)
dotnet-maestro[bot] Jul 30, 2024
2b1da78
[main] Update dependencies from dotnet/runtime (#11786)
dotnet-maestro[bot] Jul 31, 2024
51100a5
[main] Update dependencies from dotnet/arcade (#11776)
dotnet-maestro[bot] Jul 31, 2024
3c7de21
Defer GDI+ initialization to first PInvoke access (#11781)
JeremyKuhne Jul 31, 2024
0ab0d71
Merge pull request #11345 from ricardobossan/Issue_5961_RightToLeft_D…
ricardobossan Jul 31, 2024
52b89d6
Handle null PropertyDescriptor in PropertyGrid value set event (#11787)
JeremyKuhne Jul 31, 2024
f67b7e5
Put back AddStatement call in CodeDomSerializer (#11788)
JeremyKuhne Jul 31, 2024
bb6335d
Issue 11760 fix tool strip combo box display (#11761)
LeafShi1 Aug 1, 2024
42f465f
[main] Update dependencies from dotnet/runtime (#11798)
dotnet-maestro[bot] Aug 1, 2024
e2ec84c
Update Analyzer docs and number groups. (#11791)
KlausLoeffelmann Aug 1, 2024
a2c18a7
Localized file check-in by OneLocBuild Task: Build definition ID 164:…
dotnet-bot Aug 1, 2024
6194fcc
Do not crash when an invalid VirtualMode==true ListView is destroyed …
SimonZhao888 Aug 1, 2024
3b51f55
[main] Update dependencies from dotnet/arcade (#11808)
dotnet-maestro[bot] Aug 2, 2024
d4bdea7
[main] Update dependencies from dotnet/runtime (#11809)
dotnet-maestro[bot] Aug 2, 2024
1e34600
Change NetworkDownloadTests to use Fluent assertions
paul1956 Aug 3, 2024
e7e12d7
Remove unused Imports
paul1956 Aug 3, 2024
cf252d5
Move Test Utilities to subdirectory
paul1956 Aug 3, 2024
bd3fe63
Fix case in function names
paul1956 Aug 3, 2024
c0d9a21
Add HostServicesTests placeholder
paul1956 Aug 3, 2024
1f41dc5
Update HostServices to use FluentAssertions
paul1956 Aug 3, 2024
bc52467
[main] Update dependencies from dotnet/runtime (#11812)
dotnet-maestro[bot] Aug 3, 2024
ff2acdf
Fix dependency flow for Nrbf package (#11810)
ericstj Aug 3, 2024
0d026ef
Conevert remainder of tests to FluentAssertions
paul1956 Aug 3, 2024
1916690
Merge branch 'master' into Add-Tests-for-VB-Runtime-Review-2nd
paul1956 Aug 3, 2024
a215418
[main] Update dependencies from dotnet/runtime (#11813)
dotnet-maestro[bot] Aug 4, 2024
bae9756
Add more tests and remove unneeded Enable Warming
paul1956 Aug 5, 2024
71f7d13
Remove unkneeded Import
paul1956 Aug 5, 2024
2798a81
Default font scaling corrections and optimizations. Fix #11037. (#11206)
kirsan31 Aug 5, 2024
b84a072
Suppress CodeQL for BinaryFormatter deserialization in several files …
ricardobossan Aug 5, 2024
aef1eac
Localized file check-in by OneLocBuild Task: Build definition ID 164:…
dotnet-bot Aug 5, 2024
c62451f
These are just tests that require no changes to any existing code and…
paul1956 Aug 5, 2024
696f83c
Clean up formating on UserTests convert ClipBoardProzyTest to use Flu…
paul1956 Aug 5, 2024
5521a4a
Improve Clipboard Proxy Tests
paul1956 Aug 5, 2024
847c8a4
Fix spacing in ClipboardProxyTests
paul1956 Aug 5, 2024
9929bd0
Remove code note neede now
paul1956 Aug 6, 2024
e52ba02
Temp change
paul1956 Aug 6, 2024
815c99b
Undo remove Test Utilities
paul1956 Aug 6, 2024
dc144b3
Improve Audio Tests
paul1956 Aug 6, 2024
3d5461c
Improve Audio Tests and use FluentAssertions
paul1956 Aug 6, 2024
ab9eb71
[main] Update dependencies from dotnet/runtime (#11823)
dotnet-maestro[bot] Aug 6, 2024
ed0743f
Remove extra blank line.
paul1956 Aug 7, 2024
4c0d851
[main] Update dependencies from dotnet/runtime (#11834)
dotnet-maestro[bot] Aug 7, 2024
4c8f625
[main] Update dependencies from dotnet/arcade (#11833)
dotnet-maestro[bot] Aug 7, 2024
7006c1c
Ensure source paths leave 40 characters for root (#11835)
JeremyKuhne Aug 8, 2024
64e4b37
[main] Update dependencies from dotnet/runtime (#11839)
dotnet-maestro[bot] Aug 8, 2024
7aeab49
[main] Update dependencies from dotnet/arcade (#11838)
dotnet-maestro[bot] Aug 8, 2024
50d2ea5
Merge branch 'master' into VB-Runtime-TestsOnly-Review-First
paul1956 Aug 8, 2024
d6ffc0a
Merge branch 'VB-Runtime-TestsOnly-Review-First' into Add-Tests-for-V…
paul1956 Aug 8, 2024
4467b68
Shorten long Lines
paul1956 Aug 9, 2024
abf828d
Shorten long lines
paul1956 Aug 9, 2024
97859f7
Minor formatting changes
paul1956 Aug 9, 2024
88c2d42
Minor formatting changes
paul1956 Aug 9, 2024
9feead1
Remove extra blank lines
paul1956 Aug 9, 2024
273c44f
Remove extra blank lines
paul1956 Aug 9, 2024
b433530
Remove blank lines
paul1956 Aug 9, 2024
2296da7
Add tests for CleanupDirectories
paul1956 Aug 9, 2024
bb1247e
[main] Update dependencies from dotnet/arcade (#11850)
dotnet-maestro[bot] Aug 9, 2024
d7c8152
[main] Update dependencies from dotnet/runtime (#11851)
dotnet-maestro[bot] Aug 9, 2024
3983d44
Fix Cursor Display Incorrectly On Drag (#11853)
lonitra Aug 10, 2024
88bef7e
Add tests for CleanupDirectories
paul1956 Aug 10, 2024
ce712a6
Update vosibility of PathTestData
paul1956 Aug 10, 2024
69fb20a
[main] Update dependencies from dotnet/runtime (#11855)
dotnet-maestro[bot] Aug 10, 2024
4b7af90
Add a test for IEnumerable_GetEnumerator
paul1956 Aug 10, 2024
fc47a8f
Cleanupformatting of FileIoProxyTests
paul1956 Aug 11, 2024
36db42c
[main] Update dependencies from dotnet/runtime (#11856)
dotnet-maestro[bot] Aug 11, 2024
1ff332e
V2 of WinForms Async experimental APIs (#11854)
KlausLoeffelmann Aug 11, 2024
b238485
Experimental dark mode support
JeremyKuhne Aug 10, 2024
0d6ae9a
Apply my feedback to Klaus' dark mode feature
JeremyKuhne Aug 11, 2024
59f982c
Merge pull request #11857 from JeremyKuhne/darkmodesep
JeremyKuhne Aug 12, 2024
9676269
Merge branch 'master' into VB-Runtime-TestsOnly-Review-First
paul1956 Aug 12, 2024
95484e4
Merge branch 'master' into VB-Runtime-TestsOnly-Review-First
paul1956 Aug 12, 2024
abbef53
Merge
paul1956 Aug 12, 2024
4d3db45
Fix merge errors
paul1956 Aug 12, 2024
382ad3e
Add a manual test case for clones ListViewItem to WinformsControlsApp…
SimonZhao888 Aug 12, 2024
f12da23
Merge changes from VB-Runtime-TestsOnly-Review-First
paul1956 Aug 12, 2024
b73a5d1
Merge PR Feedback
paul1956 Aug 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ dotnet_diagnostic.CA1070.severity = error
# CA2016: Forward the CancellationToken parameter to methods that take one
dotnet_diagnostic.CA2016.severity = warning

# CA2020: Prevent behavioral change caused by built-in operators of IntPtr/UIntPtr
# CA2020: Prevent behavioral change caused by built-in operators of IntPtr/UIntPtr
dotnet_diagnostic.CA2020.severity = warning

# .NET diagnostic
Expand Down Expand Up @@ -595,6 +595,12 @@ visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public

dotnet_separate_import_directive_groups = false:warning

# IDE0001: Simplify Names
dotnet_diagnostic.IDE0001.severity = silent

# IDE0002: Simplify Member Access
dotnet_diagnostic.IDE0002.severity = silent

# IDE0079: Remove unnecessary suppression
dotnet_diagnostic.IDE0079.severity = none

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Namespace Microsoft.VisualBasic.CompilerServices
Dim sMsg As String

If hr > 0 AndAlso hr <= &HFFFFI Then
sMsg = GetResourceString(CType(hr, vbErrors))
Dim hr1 As vbErrors = CType(hr, vbErrors)
sMsg = Utils1.GetResourceString(hr1)
Else
sMsg = ""
End If
Expand Down Expand Up @@ -79,7 +80,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
Friend Shared Function GetArgumentExceptionWithArgName(ArgumentName As String,
ResourceID As String, ParamArray PlaceHolders() As String) As ArgumentException

Return New ArgumentException(GetResourceString(ResourceID, PlaceHolders), ArgumentName)
Return New ArgumentException(Utils1.GetResourceString(ResourceID, PlaceHolders), ArgumentName)
End Function

''' <summary>
Expand All @@ -89,7 +90,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
''' <returns>A new instance of ArgumentNullException.</returns>
Friend Shared Function GetArgumentNullException(ArgumentName As String) As ArgumentNullException

Return New ArgumentNullException(ArgumentName, GetResourceString(SR.General_ArgumentNullException))
Return New ArgumentNullException(ArgumentName, Utils1.GetResourceString(SR.General_ArgumentNullException))
End Function

''' <summary>
Expand All @@ -102,7 +103,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
Friend Shared Function GetArgumentNullException(ArgumentName As String,
ResourceID As String, ParamArray PlaceHolders() As String) As ArgumentNullException

Return New ArgumentNullException(ArgumentName, GetResourceString(ResourceID, PlaceHolders))
Return New ArgumentNullException(ArgumentName, Utils1.GetResourceString(ResourceID, PlaceHolders))
End Function

''' <summary>
Expand All @@ -114,7 +115,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
Friend Shared Function GetDirectoryNotFoundException(
ResourceID As String, ParamArray PlaceHolders() As String) As IO.DirectoryNotFoundException

Return New IO.DirectoryNotFoundException(GetResourceString(ResourceID, PlaceHolders))
Return New IO.DirectoryNotFoundException(Utils1.GetResourceString(ResourceID, PlaceHolders))
End Function

''' <summary>
Expand All @@ -127,7 +128,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
Friend Shared Function GetFileNotFoundException(FileName As String,
ResourceID As String, ParamArray PlaceHolders() As String) As IO.FileNotFoundException

Return New IO.FileNotFoundException(GetResourceString(ResourceID, PlaceHolders), FileName)
Return New IO.FileNotFoundException(Utils1.GetResourceString(ResourceID, PlaceHolders), FileName)
End Function

''' <summary>
Expand All @@ -139,7 +140,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
Friend Shared Function GetInvalidOperationException(
ResourceID As String, ParamArray PlaceHolders() As String) As InvalidOperationException

Return New InvalidOperationException(GetResourceString(ResourceID, PlaceHolders))
Return New InvalidOperationException(Utils1.GetResourceString(ResourceID, PlaceHolders))
End Function

''' <summary>
Expand All @@ -150,7 +151,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
''' <returns>A new instance of IO.IOException.</returns>
Friend Shared Function GetIOException(ResourceID As String, ParamArray PlaceHolders() As String) As IO.IOException

Return New IO.IOException(GetResourceString(ResourceID, PlaceHolders))
Return New IO.IOException(Utils1.GetResourceString(ResourceID, PlaceHolders))
End Function

''' <summary>
Expand All @@ -164,7 +165,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
Friend Shared Function GetWin32Exception(
ResourceID As String, ParamArray PlaceHolders() As String) As ComponentModel.Win32Exception

Return New ComponentModel.Win32Exception(Runtime.InteropServices.Marshal.GetLastWin32Error(), GetResourceString(ResourceID, PlaceHolders))
Return New ComponentModel.Win32Exception(Runtime.InteropServices.Marshal.GetLastWin32Error(), Utils1.GetResourceString(ResourceID, PlaceHolders))
End Function

End Class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Imports System.Globalization
Namespace Microsoft.VisualBasic.CompilerServices

' Purpose: various helpers for the vb runtime functions
Friend NotInheritable Class Utils
Friend NotInheritable Class Utils1

Friend Shared Function GetResourceString(ResourceId As vbErrors) As String
Dim id As String = "ID" & CStr(ResourceId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ Namespace Microsoft.VisualBasic.Devices

'Throw if the file exists and the user doesn't want to overwrite
If IO.File.Exists(fullFilename) And Not overwrite Then
Throw New IO.IOException(GetResourceString(SR.IO_FileExists_Path, destinationFileName))
Throw New IO.IOException(Utils1.GetResourceString(SR.IO_FileExists_Path, destinationFileName))
End If

' Set credentials if we have any
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.

Imports System.Runtime.CompilerServices

<Assembly: InternalsVisibleTo("Microsoft.VisualBasic.Forms.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")>
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
<SourceTargetFramework>$(TargetFramework)</SourceTargetFramework>
<TargetFramework>$(TargetFramework)-windows7.0</TargetFramework>
<DisableTransitiveFrameworkReferences>true</DisableTransitiveFrameworkReferences>
<RootNamespace>Microsoft.VisualBasic.Forms.Tests</RootNamespace>
<RootNamespace></RootNamespace>
<LangVersion>latest</LangVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<OptionExplicit>On</OptionExplicit>
<OptionInfer>Off</OptionInfer>
<OptionStrict>On</OptionStrict>
<MyType>WindowsFormsWithCustomSubMain</MyType>
<UseApplicationFramework>True</UseApplicationFramework>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\System.Design\src\System.Design.Facade.csproj" />
<ProjectReference Include="..\..\..\System.Drawing\src\System.Drawing.Facade.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.

Imports System.Text
Imports Xunit

Namespace Microsoft.VisualBasic.Forms.Tests

Public Class AssemblyPublicKeyIsAsExpectedTest
Private Const AssemblyPK As String = "002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293"

''' <summary>
''' Test to find out a correct PublicKey in InternalsVisibleTo for assembly under test.
''' </summary>
<WinFormsFact>
Public Sub AssemblyPublicKeyIsAsExpected()
Dim publicKey() As Byte = GetType(ControlTests).Assembly.GetName().GetPublicKey()
Dim sb As New StringBuilder
For Each [byte] As Byte In publicKey
sb.AppendFormat("{0:x2}", [byte])
Next [byte]

' Set breakpoint here to find out what's in sb
Assert.Equal(AssemblyPK, sb.ToString())
End Sub

End Class
End Namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.

Imports System.Collections.Specialized
Imports System.IO
Imports System.Windows.Forms
Imports Xunit

Namespace Microsoft.VisualBasic.Forms.Tests

''' <summary>
''' These are just checking the Proxy functions, the underlying functions are tested elsewhere.
''' </summary>
<Collection("Sequential")>
<CollectionDefinition("Sequential", DisableParallelization:=True)>
Public Class ClipboardProxyTests

<WinFormsFact>
Public Sub ClipboardProxy_ContainsText()
Dim clipboardProxy As New MyServices.ClipboardProxy
Dim text As String = GetUniqueText()
clipboardProxy.SetText(text)
Assert.Equal(Clipboard.ContainsText, clipboardProxy.ContainsText)
Assert.Equal(Clipboard.ContainsText, clipboardProxy.ContainsText(TextDataFormat.Text))
Assert.Equal(Clipboard.ContainsData(DataFormats.Text), clipboardProxy.ContainsData(DataFormats.Text))
Assert.Equal(text, clipboardProxy.GetText())
text = GetUniqueText()
clipboardProxy.SetText(text, TextDataFormat.Text)
Assert.Equal(text, clipboardProxy.GetText(TextDataFormat.Text))
End Sub

<WinFormsFact>
Public Sub ClipboardProxy_GetAudioStream_InvokeMultipleTimes_Success()
Dim clipboardProxy As New MyServices.ClipboardProxy
Dim audioBytes As Byte() = {1, 2, 3}
clipboardProxy.SetAudio(audioBytes)
Dim result As Stream = clipboardProxy.GetAudioStream()
Assert.Equal(result.Length, clipboardProxy.GetAudioStream().Length)
End Sub

<WinFormsFact>
Public Sub ClipboardProxy_SetAudio_InvokeByteArray_GetReturnsExpected()
Dim clipboardProxy As New MyServices.ClipboardProxy
Dim audioBytes As Byte() = {1, 2, 3}
clipboardProxy.SetAudio(audioBytes)
Assert.True(clipboardProxy.ContainsAudio())
Assert.True(clipboardProxy.ContainsData(DataFormats.WaveAudio))
Assert.Equal(audioBytes.Length, Assert.IsType(Of MemoryStream)(Assert.IsType(Of MemoryStream)(CType(clipboardProxy.GetAudioStream(), MemoryStream))).Length)
Assert.Equal(audioBytes.Length, CType(clipboardProxy.GetData(DataFormats.WaveAudio), MemoryStream).Length)
End Sub

<WinFormsFact>
Public Sub ClipboardProxy_SetAudio_InvokeStream_GetReturnsExpected()
Dim clipboardProxy As New MyServices.ClipboardProxy
Dim audioBytes() As Byte = {1, 2, 3}
Using audioStream As New MemoryStream(audioBytes)
clipboardProxy.SetAudio(audioStream)
Assert.Equal(audioBytes.Length, Assert.IsType(Of MemoryStream)(clipboardProxy.GetAudioStream()).ToArray().Length)
Assert.Equal(audioBytes.Length, Assert.IsType(Of MemoryStream)(clipboardProxy.GetData(DataFormats.WaveAudio)).ToArray().Length)
Assert.True(clipboardProxy.ContainsAudio())
Assert.True(clipboardProxy.ContainsData(DataFormats.WaveAudio))
End Using
End Sub

<WinFormsFact>
Public Sub ClipboardProxy_SetFileDropList_Invoke_GetReturnsExpected()
Dim clipboardProxy As New MyServices.ClipboardProxy
Dim filePaths As New StringCollection From
{"filePath", "filePath2"}
clipboardProxy.SetFileDropList(filePaths)
Assert.True(clipboardProxy.ContainsFileDropList())
Assert.Equal(filePaths, clipboardProxy.GetFileDropList())
End Sub

End Class
End Namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.

Imports Microsoft.VisualBasic.Devices
Imports Microsoft.VisualBasic.Devices.ComputerInfo
Imports Xunit

Namespace Microsoft.VisualBasic.Forms.Tests

Public Class ComputerInfoDebugViewTests

<WinFormsFact>
Public Sub Memory()
Dim info As New ComputerInfoDebugView(New ComputerInfo)
If PlatformDetection.IsWindows Then
Assert.NotEqual(0UI, info.AvailablePhysicalMemory)
Assert.NotEqual(0UI, info.AvailableVirtualMemory)
Assert.NotEqual(0UI, info.TotalPhysicalMemory)
Assert.NotEqual(0UI, info.TotalVirtualMemory)
End If
End Sub

<WinFormsFact>
Public Sub Properties()
Dim info As New ComputerInfoDebugView(New ComputerInfo)
Assert.Equal(Globalization.CultureInfo.InstalledUICulture, info.InstalledUICulture)
Assert.Equal(Environment.OSVersion.Platform.ToString(), info.OSPlatform)
Assert.Equal(Environment.OSVersion.Version.ToString(), info.OSVersion)
End Sub

End Class
End Namespace
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ Imports Xunit
Namespace Microsoft.VisualBasic.Forms.Tests
Partial Public Class ControlTests

Public Shared Function FaultingFunc(a As Integer) As Integer
Return a \ 0
End Function

Public Shared Sub FaultingMethod()
Throw New DivideByZeroException()
End Sub

<WinFormsFact>
Public Sub Control_Invoke_Action_calls_correct_method()
Using _control As New Control
_control.CreateControl()

Dim invoker As Action = AddressOf FaultingMethod
Dim exception = Assert.Throws(Of DivideByZeroException)(
Dim exception As Exception = Assert.Throws(Of DivideByZeroException)(
Sub() _control.Invoke(invoker))

' Expecting something Like the following.
Expand Down Expand Up @@ -41,7 +49,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests
_control.CreateControl()

Dim invoker As New MethodInvoker(AddressOf FaultingMethod)
Dim exception = Assert.Throws(Of DivideByZeroException)(
Dim exception As Exception = Assert.Throws(Of DivideByZeroException)(
Sub() _control.Invoke(invoker))

' Expecting something Like the following.
Expand Down Expand Up @@ -69,9 +77,9 @@ Namespace Microsoft.VisualBasic.Forms.Tests
_control.CreateControl()

Dim invoker As Func(Of Integer, Integer) = AddressOf FaultingFunc
Dim exception = Assert.Throws(Of DivideByZeroException)(
Dim exception As Exception = Assert.Throws(Of DivideByZeroException)(
Sub()
Dim result = _control.Invoke(Function() invoker(19))
Dim result As Integer = _control.Invoke(Function() invoker(19))
End Sub)

' Expecting something Like the following.
Expand All @@ -91,15 +99,5 @@ Namespace Microsoft.VisualBasic.Forms.Tests
End Using
End Sub

Public Shared Sub FaultingMethod()
Throw New DivideByZeroException()
End Sub

Public Shared Function FaultingFunc(a As Integer) As Integer
Return a \ 0
End Function

End Class

End Namespace

Loading