Library/Library.Test/TestTransactedCompoundFile.cs
C# | Copy Code |
---|---|
using (TempFile temp = new TempFile()) { TransactedCompoundFile.Options o = new TransactedCompoundFile.Options(temp.TempPath); Assert.AreEqual(temp.TempPath, o.FilePath); Assert.AreEqual(4096, o.BlockSize); Assert.AreEqual(8192, o.BlockSize = 8192); Assert.AreEqual(false, o.CreateNew); Assert.AreEqual(true, o.CreateNew = true); Assert.AreEqual(false, o.ReadOnly); Assert.AreEqual(true, o.ReadOnly = true); Assert.AreEqual(false, o.CommitOnDispose); Assert.AreEqual(true, o.CommitOnDispose = true); Assert.AreEqual(false, o.CommitOnWrite); Assert.AreEqual(true, o.CommitOnWrite = true); Assert.AreEqual(FileOptions.None, o.FileOptions); Assert.AreEqual(FileOptions.WriteThrough, o.FileOptions = FileOptions.WriteThrough); Assert.AreEqual(TransactedCompoundFile.LoadingRule.Default, o.LoadingRule); Assert.AreEqual(TransactedCompoundFile.LoadingRule.Primary, o.LoadingRule = TransactedCompoundFile.LoadingRule.Primary); TransactedCompoundFile.Options copy = (TransactedCompoundFile.Options) ((ICloneable) o).Clone(); Assert.AreEqual(FileOptions.WriteThrough, copy.FileOptions); } |
VB.NET | Copy Code |
---|---|
Using temp As New TempFile() Dim o As New TransactedCompoundFile.Options(temp.TempPath) Assert.AreEqual(temp.TempPath, o.FilePath) Assert.AreEqual(4096, o.BlockSize) Assert.AreEqual(8192, o.BlockSize = 8192) Assert.AreEqual(False, o.CreateNew) Assert.AreEqual(True, o.CreateNew = True) Assert.AreEqual(False, o.[ReadOnly]) Assert.AreEqual(True, o.[ReadOnly] = True) Assert.AreEqual(False, o.CommitOnDispose) Assert.AreEqual(True, o.CommitOnDispose = True) Assert.AreEqual(False, o.CommitOnWrite) Assert.AreEqual(True, o.CommitOnWrite = True) Assert.AreEqual(FileOptions.None, o.FileOptions) Assert.AreEqual(FileOptions.WriteThrough, o.FileOptions = FileOptions.WriteThrough) Assert.AreEqual(TransactedCompoundFile.LoadingRule.[Default], o.LoadingRule) Assert.AreEqual(TransactedCompoundFile.LoadingRule.Primary, o.LoadingRule = TransactedCompoundFile.LoadingRule.Primary) Dim copy As TransactedCompoundFile.Options = DirectCast((DirectCast(o, ICloneable)).Clone(), TransactedCompoundFile.Options) Assert.AreEqual(FileOptions.WriteThrough, copy.FileOptions) End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7