DokanNet.MockDokanFileInfo Class Reference

Mockable Dokan file information on the current operation. More...

Inheritance diagram for DokanNet.MockDokanFileInfo:
DokanNet.IDokanFileInfo

Public Member Functions

WindowsIdentity GetRequestor ()
 This method needs to be called in IDokanOperations.CreateFile to determine what account and what privileges are available to the filesystem client. More...
 
bool TryResetTimeout (int milliseconds)
 Extends the time out of the current IO operation in driver. More...
 
override string ToString ()
 Returns a string that represents the current object. More...
 

Public Attributes

WindowsIdentity WhatGetRequestorShouldReturn = WindowsIdentity.GetCurrent()
 Set this to null if you want to test against token unavailability. More...
 

Properties

string MountPoint [get, set]
 This must be set to a potentially valid path. Examples might be "M:\" or @"C:\JunctionPoint". More...
 
object Context [get, set]
 Gets or sets context that can be used to carry information between operation. The Context can carry an arbitrary type, like System.IO.FileStream, struct, int, or internal reference that will help the implementation understand the request context of the event. More...
 
int ProcessId [get, set]
 Process id for the thread that originally requested a given I/O operation. More...
 
bool IsDirectory [get, set]
 Gets or sets a value indicating whether a filename references a directory. Must be set in IDokanOperations.CreateFile if the file is to appear to be a folder. More...
 
bool DeleteOnClose [get, set]
 Gets or sets a value indicating whether the file has to be deleted during the IDokanOperations.Cleanup event. More...
 
bool PagingIo [get, set]
 Read or write is paging IO. More...
 
bool SynchronousIo [get, set]
 Read or write is synchronous IO. More...
 
bool NoCache [get, set]
 Read or write directly from data source without cache. More...
 
bool WriteToEndOfFile [get, set]
 If true, write to the current end of file instead of using the Offset parameter. More...
 
bool WhatTryResetTimeoutShouldReturn [get, set]
 Set this to false if you want to test against TryResetTimeout failure More...
 
- Properties inherited from DokanNet.IDokanFileInfo
object Context [get, set]
 Gets or sets context that can be used to carry information between operation. The Context can carry whatever type like System.IO.FileStream, struct, int, or internal reference that will help the implementation understand the request context of the event. More...
 
bool DeleteOnClose [get, set]
 Gets or sets a value indicating whether the file has to be delete during the IDokanOperations.Cleanup event. More...
 
bool IsDirectory [get, set]
 Gets or sets a value indicating whether it requesting a directory file. Must be set in IDokanOperations.CreateFile if the file appear to be a folder. More...
 
bool NoCache [get]
 Read or write directly from data source without cache. More...
 
bool PagingIo [get]
 Read or write is paging IO. More...
 
int ProcessId [get]
 Process id for the thread that originally requested a given I/O operation. More...
 
bool SynchronousIo [get]
 Read or write is synchronous IO. More...
 
bool WriteToEndOfFile [get]
 If true, write to the current end of file instead of using the Offset parameter. More...
 

Detailed Description

Mockable Dokan file information on the current operation.

Because DokanFileInfo cannot be instantiated in C#, it's very difficult to write test harnesses for unit testing. This class implements the same public interface so it's possible to mock it, such that the implementor of IDokanOperations can essentially act like the dokany kernel driver and call into that implementation to verify correct behavior. It also has support methods available to cause it (and the Dokan.Net library) to behave in certain ways useful for testing all potential returns, both success and failure.

Member Function Documentation

WindowsIdentity DokanNet.MockDokanFileInfo.GetRequestor ( )

This method needs to be called in IDokanOperations.CreateFile to determine what account and what privileges are available to the filesystem client.

Returns
An WindowsIdentity with the access token, -or- null if the operation was not successful.

This Mock implementation returns WhatGetRequestorShouldReturn.

Implements DokanNet.IDokanFileInfo.

override string DokanNet.MockDokanFileInfo.ToString ( )
inline

Returns a string that represents the current object.

Returns
A string that represents the current object.
bool DokanNet.MockDokanFileInfo.TryResetTimeout ( int  milliseconds)

Extends the time out of the current IO operation in driver.

Parameters
millisecondsNumber of milliseconds to extend with.
Returns
true if the operation was successful.

This Mock implementation returns WhatTryResetTimeoutShouldReturn.

Implements DokanNet.IDokanFileInfo.

Member Data Documentation

WindowsIdentity DokanNet.MockDokanFileInfo.WhatGetRequestorShouldReturn = WindowsIdentity.GetCurrent()

Set this to null if you want to test against token unavailability.

Initialized to the current process token, which is the only token a standard user account can get.

Property Documentation

object DokanNet.MockDokanFileInfo.Context
getset

Gets or sets context that can be used to carry information between operation. The Context can carry an arbitrary type, like System.IO.FileStream, struct, int, or internal reference that will help the implementation understand the request context of the event.

bool DokanNet.MockDokanFileInfo.DeleteOnClose
getset

Gets or sets a value indicating whether the file has to be deleted during the IDokanOperations.Cleanup event.

bool DokanNet.MockDokanFileInfo.IsDirectory
getset

Gets or sets a value indicating whether a filename references a directory. Must be set in IDokanOperations.CreateFile if the file is to appear to be a folder.

string DokanNet.MockDokanFileInfo.MountPoint
getset

This must be set to a potentially valid path. Examples might be "M:\" or @"C:\JunctionPoint".

The trailing backslash is not optional for drive letters, and must be omitted for paths.

bool DokanNet.MockDokanFileInfo.NoCache
getset

Read or write directly from data source without cache.

bool DokanNet.MockDokanFileInfo.PagingIo
getset

Read or write is paging IO.

int DokanNet.MockDokanFileInfo.ProcessId
getset

Process id for the thread that originally requested a given I/O operation.

bool DokanNet.MockDokanFileInfo.SynchronousIo
getset

Read or write is synchronous IO.

bool DokanNet.MockDokanFileInfo.WhatTryResetTimeoutShouldReturn
getset

Set this to false if you want to test against TryResetTimeout failure

bool DokanNet.MockDokanFileInfo.WriteToEndOfFile
getset

If true, write to the current end of file instead of using the Offset parameter.


The documentation for this class was generated from the following file:
  • MockDokanFileInfo.cs