@@ -126,9 +126,9 @@ public override Stream Create(string path, int bufferSize) =>
126126 Create ( path , bufferSize , FileOptions . None ) ;
127127
128128 public override Stream Create ( string path , int bufferSize , FileOptions options ) =>
129- CreateInternal ( path , options ) ;
129+ CreateInternal ( path , FileAccess . Write , options ) ;
130130
131- private Stream CreateInternal ( string path , FileOptions options )
131+ private Stream CreateInternal ( string path , FileAccess access , FileOptions options )
132132 {
133133 if ( path == null )
134134 {
@@ -140,7 +140,7 @@ private Stream CreateInternal(string path, FileOptions options)
140140
141141 var mockFileData = new MockFileData ( new byte [ 0 ] ) ;
142142 mockFileDataAccessor . AddFile ( path , mockFileData ) ;
143- return OpenWriteInternal ( path , options ) ;
143+ return OpenInternal ( path , FileMode . Open , access , options ) ;
144144 }
145145
146146 public override StreamWriter CreateText ( string path )
@@ -442,13 +442,13 @@ private Stream OpenInternal(
442442
443443 if ( ! exists || mode == FileMode . CreateNew )
444444 {
445- return Create ( path ) ;
445+ return CreateInternal ( path , access , options ) ;
446446 }
447447
448448 if ( mode == FileMode . Create || mode == FileMode . Truncate )
449449 {
450450 Delete ( path ) ;
451- return Create ( path ) ;
451+ return CreateInternal ( path , access , options ) ;
452452 }
453453
454454 var mockFileData = mockFileDataAccessor . GetFile ( path ) ;
0 commit comments