本文整理汇总了C#中FileType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# FileType.ToString方法的具体用法?C# FileType.ToString怎么用?C# FileType.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileType
的用法示例。
在下文中一共展示了FileType.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FsInfo_Query_FileFsSizeInformation_SectorsPerAllocationUnit
private void FsInfo_Query_FileFsSizeInformation_SectorsPerAllocationUnit(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create file
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
status = this.fsaAdapter.CreateFile(fileType);
//Step 2: Query FileFsSizeInformation
long byteCount;
byte[] outputBuffer = new byte[0];
FileFsSizeInformation fsSizeInfo = new FileFsSizeInformation();
uint outputBufferSize = (uint)TypeMarshal.ToBytes<FileFsSizeInformation>(fsSizeInfo).Length;
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Query FileFsSizeInformation");
status = this.fsaAdapter.QueryFileSystemInformation(FileSystemInfoClass.File_FsSizeInformation, outputBufferSize, out byteCount, out outputBuffer);
//Step 3: Verify test result
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify OutputBuffer.SectorsPerAllocationUnit");
fsSizeInfo = TypeMarshal.ToStruct<FileFsSizeInformation>(outputBuffer);
uint expectedSectorsPerAllocationUnit = this.fsaAdapter.ClusterSizeInKB * 1024 / fsSizeInfo.BytesPerSector;
uint actualSectorsPerAllocationUnit = fsSizeInfo.SectorsPerAllocationUnit;
BaseTestSite.Log.Add(LogEntryKind.Debug, "ClusterSize is " + this.fsaAdapter.ClusterSizeInKB + " KB.");
BaseTestSite.Log.Add(LogEntryKind.Debug, "BytesPerSector is " + fsSizeInfo.BytesPerSector + " bytes.");
this.fsaAdapter.AssertAreEqual(this.Manager, expectedSectorsPerAllocationUnit, actualSectorsPerAllocationUnit, "OutputBuffer.SectorsPerAllocationUnit set to Open.File.Volume.ClusterSize / Open.File.Volume.LogicalBytesPerSector.");
}
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:28,代码来源:FsInfo_Query_FileFsSizeInformation.cs
示例2: FsCtl_Get_Compression_IsCompressionSupported
private void FsCtl_Get_Compression_IsCompressionSupported(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create file
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
status = this.fsaAdapter.CreateFile(fileType);
//Step 2: FSCTL request with FSCTL_GET_COMPRESSION
FSCTL_GET_COMPRESSION_Reply compressionReply = new FSCTL_GET_COMPRESSION_Reply();
uint outputBufferSize = (uint)TypeMarshal.ToBytes<FSCTL_GET_COMPRESSION_Reply>(compressionReply).Length;
long bytesReturned;
byte[] outputBuffer = new byte[0];
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. FSCTL request with FSCTL_GET_COMPRESSION");
status = this.fsaAdapter.FsCtlGetCompression(outputBufferSize, out bytesReturned, out outputBuffer);
//Step 3: Verify test result
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify returned NTSTATUS code.");
// 2.1.5.9.7 FSCTL_GET_COMPRESSION
// <64> Section 2.1.5.9.7: This is only implemented by the NTFS and ReFS file systems.
if (this.fsaAdapter.FileSystem == FileSystem.NTFS || this.fsaAdapter.FileSystem == FileSystem.REFS)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status, "FSCTL_GET_COMPRESSION is supported, status set to STATUS_SUCCESS.");
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_DEVICE_REQUEST, status,
"If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.");
}
}
示例3: FsCtl_Set_Sparse_IsSparseFileSupported
private void FsCtl_Set_Sparse_IsSparseFileSupported(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create file
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
status = this.fsaAdapter.CreateFile(fileType);
//Step 2: Write data to file
if (fileType == FileType.DataFile)
{
long bytesToWrite = 1024;
long bytesWritten = 0;
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Write the file with " + bytesToWrite + " bytes.");
status = this.fsaAdapter.WriteFile(0, bytesToWrite, out bytesWritten);
}
else
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Do not write data to directory file.");
}
//Step 3: FSCTL request with FSCTL_SET_SPARSE
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. FSCTL request with FSCTL_SET_SPARSE");
status = this.fsaAdapter.FsCtlSetSparse(true);
//Step 4: Verify test result
BaseTestSite.Log.Add(LogEntryKind.TestStep, "4. Verify returned NTSTATUS code.");
if (this.fsaAdapter.FileSystem == FileSystem.FAT32)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_DEVICE_REQUEST, status,
"If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVIeCE_REQUEST.");
return;
}
if (fileType == FileType.DirectoryFile)
{
if (this.fsaAdapter.FileSystem == FileSystem.CSVFS)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.STATUS_NOT_IMPLEMENTED, status,
"If the Open is a directory on a Cluster Shared Volume File System (CSVFS), the operation MUST be failed with STATUS_NOT_IMPLEMENTED.");
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_PARAMETER, status,
"If the file is not a Data file, the operation MUST be failed with STATUS_INVALID_PARAMETER.");
}
return;
}
if (this.fsaAdapter.IsSparseFileSupported == false)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_DEVICE_REQUEST, status,
"If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.");
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status, "FSCTL_SET_SPARSE is supported, status set to STATUS_SUCCESS.");
}
}
示例4: StoreFile
public void StoreFile(FileType type, long id, string md5, byte[] data)
{
string sql = string.Format("REPLACE INTO Files(id, md5, data, type) VALUES({0}, '{1}', @Data ,'{2}')",
id, md5, type.ToString());
SQLiteCommand cmd = new SQLiteCommand(sql, conn);
cmd.Parameters.AddWithValue("@Data", data);
cmd.ExecuteNonQuery();
}
示例5: FileInfo_Query_FileCompressionInfo_IsCompressionSupported
private void FileInfo_Query_FileCompressionInfo_IsCompressionSupported(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create File
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
status = this.fsaAdapter.CreateFile(fileType);
//Step 2: Set compression
FSCTL_SET_COMPRESSION_Request setCompressionRequest = new FSCTL_SET_COMPRESSION_Request();
setCompressionRequest.CompressionState = FSCTL_SET_COMPRESSION_Request_CompressionState_Values.COMPRESSION_FORMAT_LZNT1;
uint inputBufferSize = (uint)TypeMarshal.ToBytes<FSCTL_SET_COMPRESSION_Request>(setCompressionRequest).Length;
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. FSCTL request with FSCTL_SET_COMPRESSION");
status = this.fsaAdapter.FsCtlSetCompression(setCompressionRequest, inputBufferSize);
//Step 3: Query FILE_COMPRESSION_INFORMATION
FileCompressionInformation fileCompressionInfo = new FileCompressionInformation() { Reserved = new byte[3] };
long byteCount;
byte[] outputBuffer = new byte[0];
uint outputBufferSize = (uint)TypeMarshal.ToBytes<FileCompressionInformation>(fileCompressionInfo).Length;
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. QueryFileInformation with FileInfoClass.FILE_COMPRESSION_INFORMATION");
status = this.fsaAdapter.QueryFileInformation(FileInfoClass.FILE_COMPRESSION_INFORMATION, outputBufferSize, out byteCount, out outputBuffer);
//Step 4: Verify test result
if (this.fsaAdapter.FileSystem == FileSystem.FAT32)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_PARAMETER, status,
"If a file system does not support a specific File Information Class, STATUS_INVALID_PARAMETER MUST be returned.");
return;
}
fileCompressionInfo = TypeMarshal.ToStruct<FileCompressionInformation>(outputBuffer);
bool isCompressionFormatLZNT1 = (fileCompressionInfo.CompressionFormat & CompressionFormat_Values.COMPRESSION_FORMAT_LZNT1) == CompressionFormat_Values.COMPRESSION_FORMAT_LZNT1;
BaseTestSite.Log.Add(LogEntryKind.TestStep, "4. Verify outputBuffer.CompressionFormat");
if (this.fsaAdapter.IsCompressionSupported == true)
{
if (fileType == FileType.DirectoryFile && this.fsaAdapter.FileSystem == FileSystem.CSVFS)
{
this.fsaAdapter.AssertAreEqual(this.Manager, false, isCompressionFormatLZNT1, "CSVFS does not support setting compressed attribute on the folders, the compressionFormat should be NONE.");
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, true, isCompressionFormatLZNT1, "Compression is supported, the object store MUST set OutputBuffer.CompressionState to COMPRESSION_FORMAT_LZNT1.");
}
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, false, isCompressionFormatLZNT1, "Compression is NOT supported, the object store MUST NOT set OutputBuffer.CompressionState to COMPRESSION_FORMAT_LZNT1.");
}
}
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:55,代码来源:FileInfo_Query_FileCompressionInformation.cs
示例6: FileInfo_Set_FileShortNameInfo_IsShortNameSupported
private void FileInfo_Set_FileShortNameInfo_IsShortNameSupported(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create file
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString() + " with Open.HasRestoreAccess set to TRUE.");
string fileName = this.fsaAdapter.ComposeRandomFileName(8);
CreateOptions createFileType = (fileType == FileType.DataFile ? CreateOptions.NON_DIRECTORY_FILE : CreateOptions.DIRECTORY_FILE);
CreateOptions restoreAccess = CreateOptions.OPEN_FOR_BACKUP_INTENT;
status = this.fsaAdapter.CreateFile(
fileName,
FileAttribute.NORMAL,
createFileType | restoreAccess, //Open.HasRestoreAccess set to TRUE
FileAccess.GENERIC_ALL,
ShareAccess.FILE_SHARE_READ | ShareAccess.FILE_SHARE_WRITE | ShareAccess.FILE_SHARE_DELETE,
CreateDisposition.OPEN_IF);
//Step 2: Set FILE_SHORTNAME_INFORMATION
FileShortNameInformation shortNameInfo = new FileShortNameInformation();
string shortName = this.fsaAdapter.ComposeRandomFileName(8);
shortNameInfo.FileName = Encoding.Unicode.GetBytes(shortName);
shortNameInfo.FileNameLength = (uint)shortNameInfo.FileName.Length;
byte[] inputBuffer = TypeMarshal.ToBytes<FileShortNameInformation>(shortNameInfo);
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. SetFileInformation with FileInfoClass.FILE_SHORTNAME_INFORMATION.");
status = this.fsaAdapter.SetFileInformation(FileInfoClass.FILE_SHORTNAME_INFORMATION, inputBuffer);
//Step 3: Verify test result
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify returned NTSTATUS code.");
if (this.fsaAdapter.IsShortNameSupported == false)
{
BaseTestSite.Log.Add(LogEntryKind.Debug, "FileShortNameInformation is not supported.");
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_PARAMETER, status,
"If a file system does not support a specific File Information Class, STATUS_INVALID_PARAMETER MUST be returned.");
}
else
{
if (status == MessageStatus.SHORT_NAMES_NOT_ENABLED_ON_VOLUME)
{
BaseTestSite.Log.Add(LogEntryKind.Debug, "If Open.File.Volume.GenerateShortNames is FALSE, the operation MUST be failed with STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME.");
BaseTestSite.Log.Add(LogEntryKind.Debug, "To enable short name in specific volume, such as volume with driver letter N:, use command: fsutil 8dot3name set N: 0.");
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status,
"FileShortNameInformation is supported, status set to STATUS_SUCCESS.");
}
}
}
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:53,代码来源:FileInfo_Set_FileShortNameInformation.cs
示例7: FileInfo_Query_FileAttributeTagInfo_IsIntegritySupported
private void FileInfo_Query_FileAttributeTagInfo_IsIntegritySupported(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create File
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString() + " with FileAttribute.INTEGRITY_STREAM");
status = this.fsaAdapter.CreateFile(
FileAttribute.NORMAL | FileAttribute.INTEGRITY_STREAM, // Set Integrity field
fileType == FileType.DataFile ? CreateOptions.NON_DIRECTORY_FILE : CreateOptions.DIRECTORY_FILE,
fileType == FileType.DataFile ? StreamTypeNameToOPen.DATA : StreamTypeNameToOPen.INDEX_ALLOCATION, //Stream Type
FileAccess.GENERIC_READ | FileAccess.GENERIC_WRITE | FileAccess.FILE_WRITE_DATA | FileAccess.FILE_WRITE_ATTRIBUTES,
ShareAccess.FILE_SHARE_READ | ShareAccess.FILE_SHARE_WRITE,
CreateDisposition.OPEN_IF,
StreamFoundType.StreamIsFound,
SymbolicLinkType.IsNotSymbolicLink,
fileType,
FileNameStatus.PathNameValid);
this.fsaAdapter.AssertIfNotSuccess(status, "Create file operation failed");
//Step 2: Query FILE_ATTRIBUTETAG_INFORMATION
long byteCount;
byte[] outputBuffer;
FileAttributeTagInformation fileAttributeTagInfo = new FileAttributeTagInformation();
uint outputBufferSize = (uint)TypeMarshal.ToBytes<FileAttributeTagInformation>(fileAttributeTagInfo).Length;
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. QueryFileInformation with FileInfoClass.FILE_ATTRIBUTETAG_INFORMATION");
status = this.fsaAdapter.QueryFileInformation(FileInfoClass.FILE_ATTRIBUTETAG_INFORMATION, outputBufferSize, out byteCount, out outputBuffer);
//Step 3: Verify test result
if (this.fsaAdapter.FileSystem == FileSystem.FAT32)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_PARAMETER, status,
"If a file system does not support a specific File Information Class, STATUS_INVALID_PARAMETER MUST be returned.");
return;
}
fileAttributeTagInfo = TypeMarshal.ToStruct<FileAttributeTagInformation>(outputBuffer);
bool isIntegrityStreamSet = (fileAttributeTagInfo.FileAttributes & (uint)FileAttribute.INTEGRITY_STREAM) == (uint)FileAttribute.INTEGRITY_STREAM;
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify outputBuffer.FileAttributes.FILE_ATTRIBUTE_INTEGRITY_STREAM");
if (this.fsaAdapter.IsIntegritySupported == true)
{
this.fsaAdapter.AssertAreEqual(this.Manager, true, isIntegrityStreamSet,
"If integrity is supported, the object store MUST set FILE_ATTRIBUTE_INTEGRITY_STREAM in OutputBuffer.FileAttributes.");
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, false, isIntegrityStreamSet, "Integrity is not supported, FILE_ATTRIBUTE_INTEGRITY_STREAM MUST NOT set.");
}
}
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:53,代码来源:FileInfo_Query_FileAttributeTagInformation.cs
示例8: GetFileList
public static List<long> GetFileList(FileType type)
{
List<long> ids = new List<long>();
string sql = string.Format("SELECT id FROM Files WHERE type='{0}'", type.ToString());
SQLiteCommand cmd = new SQLiteCommand(sql, conn);
SQLiteDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
ids.Add(reader.GetInt64(reader.GetOrdinal("id")));
}
return ids;
}
示例9: FileInfo_Query_FileFullEaInformation_IsEASupported
private void FileInfo_Query_FileFullEaInformation_IsEASupported(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create File
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
status = this.fsaAdapter.CreateFile(fileType);
//Step 2: Set FILE_FULLEA_INFORMATION
string eaName = this.fsaAdapter.ComposeRandomFileName(8);
string eaValue = this.fsaAdapter.ComposeRandomFileName(8);
FileFullEaInformation fileFullEaInfo = new FileFullEaInformation();
fileFullEaInfo.NextEntryOffset = 0;
fileFullEaInfo.Flags = FILE_FULL_EA_INFORMATION_FLAGS.NONE;
fileFullEaInfo.EaNameLength = (byte)eaName.Length;
fileFullEaInfo.EaValueLength = (ushort)eaValue.Length;
fileFullEaInfo.EaName = Encoding.ASCII.GetBytes(eaName + "\0");
fileFullEaInfo.EaValue = Encoding.ASCII.GetBytes(eaValue);
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. SetFileInformation with FileInfoClass.FILE_FULLEA_INFORMATION.");
status = this.fsaAdapter.SetFileFullEaInformation(fileFullEaInfo);
//Step 3: Query FILE_FULLEA_INFORMATION
long byteCount;
byte[] outputBuffer;
uint outputBufferSize = (uint)TypeMarshal.ToBytes<FileFullEaInformation>(fileFullEaInfo).Length;
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. QueryFileInformation with FileInfoClass.FILE_FULLEA_INFORMATION");
status = this.fsaAdapter.QueryFileFullEaInformation(outputBufferSize, out byteCount, out outputBuffer);
//Step 4: Verify test result
BaseTestSite.Log.Add(LogEntryKind.TestStep, "4. Verify returned NTSTATUS code.");
if (this.fsaAdapter.Transport == Transport.SMB)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status,
"STATUS_SUCCESS when one or more entries were returned from Open.File.ExtendedAttributes and there are no more entries to return.");
return;
}
if (this.fsaAdapter.IsExtendedAttributeSupported == false)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_DEVICE_REQUEST, status,
"If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.");
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status,
"STATUS_SUCCESS when one or more entries were returned from Open.File.ExtendedAttributes and there are no more entries to return.");
}
}
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:50,代码来源:FileInfo_Query_FileFullEaInformation.cs
示例10: FileInfo_Query_FileEaInformation_IsEASupported
private void FileInfo_Query_FileEaInformation_IsEASupported(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create file
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
status = this.fsaAdapter.CreateFile(fileType);
//Step 2: Set FILE_FULLEA_INFORMATION
string eaName = this.fsaAdapter.ComposeRandomFileName(8);
string eaValue = this.fsaAdapter.ComposeRandomFileName(8);
FileFullEaInformation fileFullEaInfo = new FileFullEaInformation();
fileFullEaInfo.NextEntryOffset = 0;
fileFullEaInfo.Flags = FILE_FULL_EA_INFORMATION_FLAGS.NONE;
fileFullEaInfo.EaNameLength = (byte)eaName.Length;
fileFullEaInfo.EaValueLength = (ushort)eaValue.Length;
fileFullEaInfo.EaName = Encoding.ASCII.GetBytes(eaName + "\0");
fileFullEaInfo.EaValue = Encoding.ASCII.GetBytes(eaValue);
byte[] inputBuffer = TypeMarshal.ToBytes<FileFullEaInformation>(fileFullEaInfo);
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. SetFileInformation with FileInfoClass.FILE_FULLEA_INFORMATION.");
status = this.fsaAdapter.SetFileFullEaInformation(fileFullEaInfo);
//Step 3: Query FILE_EA_INFORMATION
long byteCount;
byte[] outputBuffer;
FileEaInformation fileEaInfo = new FileEaInformation();
uint outputBufferSize = (uint)TypeMarshal.ToBytes<FileEaInformation>(fileEaInfo).Length;
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. QueryFileInformation with FileInfoClass.FILE_EA_INFORMATION");
status = this.fsaAdapter.QueryFileInformation(FileInfoClass.FILE_EA_INFORMATION, outputBufferSize, out byteCount, out outputBuffer);
//Step 4: Verify test result
fileEaInfo = TypeMarshal.ToStruct<FileEaInformation>(outputBuffer);
BaseTestSite.Log.Add(LogEntryKind.TestStep, "4. Verify outputBuffer.EaSize");
if (this.fsaAdapter.IsExtendedAttributeSupported == false)
{
this.fsaAdapter.AssertAreEqual(this.Manager, (uint)0, fileEaInfo.EaSize,
"ExtendedAttribute is not supported, OutputBuffer.EaSize should be 0.");
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, true, fileEaInfo.EaSize > 0,
"ExtendedAttribute is supported, OutputBuffer.EaSize should be greater than 0.");
}
}
示例11: FsCtl_Set_ZeroData_IsZeroDataSupported
private void FsCtl_Set_ZeroData_IsZeroDataSupported(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create file
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
status = this.fsaAdapter.CreateFile(fileType);
//Step 2: FSCTL request with FSCTL_SET_ZERO_DATA
FSCTL_SET_ZERO_DATA_Request setZeroDataRequest = new FSCTL_SET_ZERO_DATA_Request();
setZeroDataRequest.FileOffset = 0;
setZeroDataRequest.BeyondFinalZero = 0;
uint inputBufferSize = (uint)TypeMarshal.ToBytes<FSCTL_SET_ZERO_DATA_Request>(setZeroDataRequest).Length;
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. FSCTL request with FSCTL_SET_ZERO_DATA");
status = this.fsaAdapter.FsCtlSetZeroData(setZeroDataRequest, inputBufferSize);
//Step 3: Verify test result
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify returned NTSTATUS code.");
if (this.fsaAdapter.IsSetZeroDataSupported == false)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_DEVICE_REQUEST, status,
"If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.");
}
else
{
if (fileType == FileType.DataFile)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status,
"FSCTL_SET_ZERO_DATA is supported, status set to STATUS_SUCCESS.");
}
else
{
if (this.fsaAdapter.FileSystem == FileSystem.CSVFS)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.STATUS_NOT_IMPLEMENTED, status,
"If the Open is a directory on a Cluster Shared Volume File System (CSVFS), the operation MUST be failed with STATUS_NOT_IMPLEMENTED.");
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_PARAMETER, status,
"The operation MUST be failed with STATUS_INVALID_PARAMETER if Open.Stream.StreamType is not DataStream.");
}
}
}
}
示例12: FileInfo_Set_FileValidDataLengthInformation_IsSupported
private void FileInfo_Set_FileValidDataLengthInformation_IsSupported(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create file
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
status = this.fsaAdapter.CreateFile(fileType);
//Step 2: Write some bytes into the file
long bytesToWrite;
if (fileType == FileType.DataFile)
{
//Write some bytes into the DataFile.
bytesToWrite = 1024;
long bytesWritten = 0;
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Write the file with " + bytesToWrite + " bytes data.");
status = this.fsaAdapter.WriteFile(0, bytesToWrite, out bytesWritten);
}
else
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Do not write data into DirectoryFile.");
bytesToWrite = 0;
}
//Step 3: Set FILE_VALIDDATALENGTH_INFORMATION
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. SetFileInformation with FileInfoClass.FILE_VALIDDATALENGTH_INFORMATION.");
FileValidDataLengthInformation fileValidDataLengthInfo = new FileValidDataLengthInformation();
BaseTestSite.Log.Add(LogEntryKind.Debug, "Parameter: Set ValidDataLength to " + bytesToWrite);
fileValidDataLengthInfo.ValidDataLength = bytesToWrite;
byte[] inputBuffer = TypeMarshal.ToBytes<FileValidDataLengthInformation>(fileValidDataLengthInfo);
status = this.fsaAdapter.SetFileInformation(FileInfoClass.FILE_VALIDDATALENGTH_INFORMATION, inputBuffer);
//Step 4: Verify test result
BaseTestSite.Log.Add(LogEntryKind.TestStep, "4. Verify returned NTSTATUS code.");
if (fileType == FileType.DataFile)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status, "Status set to STATUS_SUCCESS.");
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_PARAMETER, status,
"The operation MUST be failed with STATUS_INVALID_PARAMETER if Open.File.FileType is DirectoryFile.");
}
}
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:48,代码来源:FileInfo_Set_FileValidDataLengthInformation.cs
示例13: FsCtl_Set_Compression_IsCompressionSupported
private void FsCtl_Set_Compression_IsCompressionSupported(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create file
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
status = this.fsaAdapter.CreateFile(fileType);
//Step 2: FSCTL request with FSCTL_SET_COMPRESSION
FSCTL_SET_COMPRESSION_Request setCompressionRequest = new FSCTL_SET_COMPRESSION_Request();
setCompressionRequest.CompressionState = FSCTL_SET_COMPRESSION_Request_CompressionState_Values.COMPRESSION_FORMAT_DEFAULT;
uint inputBufferSize = (uint)TypeMarshal.ToBytes<FSCTL_SET_COMPRESSION_Request>(setCompressionRequest).Length;
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. FSCTL request with FSCTL_SET_COMPRESSION");
status = this.fsaAdapter.FsCtlSetCompression(setCompressionRequest, inputBufferSize);
//Step 3: Verify test result
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify returned NTSTATUS code.");
if (this.fsaAdapter.IsCompressionSupported == false)
{
if (this.fsaAdapter.FileSystem == FileSystem.REFS)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.NOT_SUPPORTED, status,
("For ReFS, it is only supported and returns STATUS_SUCCESS when CompressionState is set to COMPRESSION_FORMAT_NONE. " +
"The method fails with STATUS_NOT_SUPPORTED for any other value of CompressionState."));
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_DEVICE_REQUEST, status,
"If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.");
}
}
else
{
if (fileType == FileType.DirectoryFile && this.fsaAdapter.FileSystem == FileSystem.CSVFS)
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.ACCESS_DENIED, status, "CSVFS does not support setting compressed attribute on the folders.");
}
else
{
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status, "COMPRESSION is supported, status set to STATUS_SUCCESS.");
}
}
}
示例14: FsInfo_Set_FileFsSectorSizeInformation_InvalidInfoClass
private void FsInfo_Set_FileFsSectorSizeInformation_InvalidInfoClass(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create file
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
status = this.fsaAdapter.CreateFile(fileType);
//Step 2: Set File_FsSectorSizeInformation
FILE_FS_SECTOR_SIZE_INFORMATION fileFsSectorSizeInfo = new FILE_FS_SECTOR_SIZE_INFORMATION();
byte[] inputBuffer = TypeMarshal.ToBytes<FILE_FS_SECTOR_SIZE_INFORMATION>(fileFsSectorSizeInfo);
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Set File_FsSectorSizeInformation.");
status = this.fsaAdapter.SetFileSystemInformation((uint)FileSystemInfoClass.File_FsSectorSizeInformation, inputBuffer);
//Step 3: Verify test result
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify returned NTStatus code.");
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_INFO_CLASS, status,
"This operation is not supported and MUST be failed with STATUS_INVALID_INFO_CLASS.");
}
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:21,代码来源:FsInfo_Set_FileFsSectorSizeInformation.cs
示例15: FileInfo_Set_FileEaInformation_IsEASupported
private void FileInfo_Set_FileEaInformation_IsEASupported(FileType fileType)
{
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
MessageStatus status;
//Step 1: Create file
BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
status = this.fsaAdapter.CreateFile(FileType.DataFile);
//Step 2: Set FILE_EA_INFORMATION
FileEaInformation fileEaInfo = new FileEaInformation();
fileEaInfo.EaSize = 1024;
byte[] inputBuffer = TypeMarshal.ToBytes<FileEaInformation>(fileEaInfo);
BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. SetFileInformation with FileInfoClass.FILE_EA_INFORMATION.");
status = this.fsaAdapter.SetFileInformation(FileInfoClass.FILE_EA_INFORMATION, inputBuffer);
//Step 3: Verify test result
BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify returned NTSTATUS code.");
this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_INFO_CLASS, status,
"This operation is not supported and MUST be failed with STATUS_ INVALID_INFO_CLASS.");
}