Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 803180f

Browse files
committed
Rewrite the MemoryMappedFiles tests
The old System.IO.MemoryMappedFiles tests had decent coverage, but were lacking in a variety of ways: - They were written in a legacy style that didn't take advantage of xunit capabilities, that made them difficult to augment, and that made them difficult to understand - They were spread out across several projects in a seemingly haphazard manner. - They left behind lots of temporary files - They caused random test failures due to conflicting map names and file names. - Their code coverage could have been a bit better, and they were missing coverage of some corner cases This commit completely rewrites the tests, covering all of the old scenarios tested and more while removing 2/3rds of the code, increasing code coverage, avoiding race conditions on map and file names, cleaning up temporary files used, switching to using xunit features, and hopefully making the tests more understandable and augmentable in the future.
1 parent c2558f1 commit 803180f

38 files changed

+2890
-9816
lines changed

src/System.IO.MemoryMappedFiles/System.IO.MemoryMappedFiles.sln

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@ VisualStudioVersion = 12.0.30723.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.IO.MemoryMappedFiles", "src\System.IO.MemoryMappedFiles.csproj", "{16EE5522-F387-4C9E-9EF2-B5134B043F37}"
77
EndProject
8-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{10E9121A-7350-4AB7-BB05-A543BE1EB19B}"
9-
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.IO.MemoryMappedFiles.Tests", "tests\MemoryMappedFile\System.IO.MemoryMappedFiles.Tests.csproj", "{9D6F6254-B5A3-40FF-8925-68AA8D1CE933}"
11-
EndProject
12-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.IO.MemoryMappedViewAccessor.Tests", "tests\MemoryMappedViewAccessor\System.IO.MemoryMappedViewAccessor.Tests.csproj", "{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}"
13-
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.IO.MemoryMappedViewStream.Tests", "tests\MemoryMappedViewStream\System.IO.MemoryMappedViewStream.Tests.csproj", "{688496E1-A7B3-41AE-9E32-C6F1A1127F91}"
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.IO.MemoryMappedFiles.Tests", "tests\System.IO.MemoryMappedFiles.Tests.csproj", "{9D6F6254-B5A3-40FF-8925-68AA8D1CE933}"
159
EndProject
1610
Global
1711
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -47,30 +41,6 @@ Global
4741
{9D6F6254-B5A3-40FF-8925-68AA8D1CE933}.Windows_Debug|Any CPU.Build.0 = Debug|Any CPU
4842
{9D6F6254-B5A3-40FF-8925-68AA8D1CE933}.Windows_Release|Any CPU.ActiveCfg = Release|Any CPU
4943
{9D6F6254-B5A3-40FF-8925-68AA8D1CE933}.Windows_Release|Any CPU.Build.0 = Release|Any CPU
50-
{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}.Linux_Debug|Any CPU.ActiveCfg = Debug|Any CPU
51-
{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}.Linux_Debug|Any CPU.Build.0 = Debug|Any CPU
52-
{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}.Linux_Release|Any CPU.ActiveCfg = Release|Any CPU
53-
{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}.Linux_Release|Any CPU.Build.0 = Release|Any CPU
54-
{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}.OSX_Debug|Any CPU.ActiveCfg = Debug|Any CPU
55-
{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}.OSX_Debug|Any CPU.Build.0 = Debug|Any CPU
56-
{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}.OSX_Release|Any CPU.ActiveCfg = Release|Any CPU
57-
{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}.OSX_Release|Any CPU.Build.0 = Release|Any CPU
58-
{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}.Windows_Debug|Any CPU.ActiveCfg = Debug|Any CPU
59-
{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}.Windows_Debug|Any CPU.Build.0 = Debug|Any CPU
60-
{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}.Windows_Release|Any CPU.ActiveCfg = Release|Any CPU
61-
{F26FBD53-C04A-4FFC-90C9-AA804285A7AD}.Windows_Release|Any CPU.Build.0 = Release|Any CPU
62-
{688496E1-A7B3-41AE-9E32-C6F1A1127F91}.Linux_Debug|Any CPU.ActiveCfg = Debug|Any CPU
63-
{688496E1-A7B3-41AE-9E32-C6F1A1127F91}.Linux_Debug|Any CPU.Build.0 = Debug|Any CPU
64-
{688496E1-A7B3-41AE-9E32-C6F1A1127F91}.Linux_Release|Any CPU.ActiveCfg = Release|Any CPU
65-
{688496E1-A7B3-41AE-9E32-C6F1A1127F91}.Linux_Release|Any CPU.Build.0 = Release|Any CPU
66-
{688496E1-A7B3-41AE-9E32-C6F1A1127F91}.OSX_Debug|Any CPU.ActiveCfg = Debug|Any CPU
67-
{688496E1-A7B3-41AE-9E32-C6F1A1127F91}.OSX_Debug|Any CPU.Build.0 = Debug|Any CPU
68-
{688496E1-A7B3-41AE-9E32-C6F1A1127F91}.OSX_Release|Any CPU.ActiveCfg = Release|Any CPU
69-
{688496E1-A7B3-41AE-9E32-C6F1A1127F91}.OSX_Release|Any CPU.Build.0 = Release|Any CPU
70-
{688496E1-A7B3-41AE-9E32-C6F1A1127F91}.Windows_Debug|Any CPU.ActiveCfg = Debug|Any CPU
71-
{688496E1-A7B3-41AE-9E32-C6F1A1127F91}.Windows_Debug|Any CPU.Build.0 = Debug|Any CPU
72-
{688496E1-A7B3-41AE-9E32-C6F1A1127F91}.Windows_Release|Any CPU.ActiveCfg = Release|Any CPU
73-
{688496E1-A7B3-41AE-9E32-C6F1A1127F91}.Windows_Release|Any CPU.Build.0 = Release|Any CPU
7444
EndGlobalSection
7545
GlobalSection(SolutionProperties) = preSolution
7646
HideSolutionNode = FALSE

src/System.IO.MemoryMappedFiles/tests/Common/SystemInfoHelpers.cs

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/System.IO.MemoryMappedFiles/tests/Common/TestBase.cs

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)