public virtual void TestDiskLimitsCutoffSetters() { string[] dirs = new string[] { "dir" }; DirectoryCollection dc = new DirectoryCollection(dirs, 0.0F, 100); float testValue = 57.5F; float delta = 0.1F; dc.SetDiskUtilizationPercentageCutoff(testValue); NUnit.Framework.Assert.AreEqual(testValue, dc.GetDiskUtilizationPercentageCutoff( ), delta); testValue = -57.5F; dc.SetDiskUtilizationPercentageCutoff(testValue); NUnit.Framework.Assert.AreEqual(0.0F, dc.GetDiskUtilizationPercentageCutoff(), delta ); testValue = 157.5F; dc.SetDiskUtilizationPercentageCutoff(testValue); NUnit.Framework.Assert.AreEqual(100.0F, dc.GetDiskUtilizationPercentageCutoff(), delta); long spaceValue = 57; dc.SetDiskUtilizationSpaceCutoff(spaceValue); NUnit.Framework.Assert.AreEqual(spaceValue, dc.GetDiskUtilizationSpaceCutoff()); spaceValue = -57; dc.SetDiskUtilizationSpaceCutoff(spaceValue); NUnit.Framework.Assert.AreEqual(0, dc.GetDiskUtilizationSpaceCutoff()); }
public virtual void TestConstructors() { string[] dirs = new string[] { "dir" }; float delta = 0.1F; DirectoryCollection dc = new DirectoryCollection(dirs); NUnit.Framework.Assert.AreEqual(100.0F, dc.GetDiskUtilizationPercentageCutoff(), delta); NUnit.Framework.Assert.AreEqual(0, dc.GetDiskUtilizationSpaceCutoff()); dc = new DirectoryCollection(dirs, 57.5F); NUnit.Framework.Assert.AreEqual(57.5F, dc.GetDiskUtilizationPercentageCutoff(), delta ); NUnit.Framework.Assert.AreEqual(0, dc.GetDiskUtilizationSpaceCutoff()); dc = new DirectoryCollection(dirs, 57); NUnit.Framework.Assert.AreEqual(100.0F, dc.GetDiskUtilizationPercentageCutoff(), delta); NUnit.Framework.Assert.AreEqual(57, dc.GetDiskUtilizationSpaceCutoff()); dc = new DirectoryCollection(dirs, 57.5F, 67); NUnit.Framework.Assert.AreEqual(57.5F, dc.GetDiskUtilizationPercentageCutoff(), delta ); NUnit.Framework.Assert.AreEqual(67, dc.GetDiskUtilizationSpaceCutoff()); dc = new DirectoryCollection(dirs, -57.5F, -67); NUnit.Framework.Assert.AreEqual(0.0F, dc.GetDiskUtilizationPercentageCutoff(), delta ); NUnit.Framework.Assert.AreEqual(0, dc.GetDiskUtilizationSpaceCutoff()); dc = new DirectoryCollection(dirs, 157.5F, -67); NUnit.Framework.Assert.AreEqual(100.0F, dc.GetDiskUtilizationPercentageCutoff(), delta); NUnit.Framework.Assert.AreEqual(0, dc.GetDiskUtilizationSpaceCutoff()); }