public void NullPersistentFileThrowsException() { PFW.CSIST203.Project1.Functions.ArrayFunctions obj; AssertDelegateFailure(() => { obj = new Project1.Functions.ArrayFunctions(null); }, typeof(ArgumentException), "Instantiation should not have succeeded with a null persistent file specified"); }
public void PersistentFilePointsToNonExistentDirectory() { PFW.CSIST203.Project1.Functions.ArrayFunctions obj; var path = @"C:\temp\" + System.Guid.NewGuid().ToString() + @"\temp.tmp"; AssertDelegateFailure(() => { obj = new Project1.Functions.ArrayFunctions(path); }, typeof(System.IO.DirectoryNotFoundException), "Instantiation should not have succeeded with a persistent file path pointing to a non-existent directory"); }
public void Parameterless() { PFW.CSIST203.Project1.Functions.ArrayFunctions obj = null; AssertDelegateSuccess(() => { obj = new Project1.Functions.ArrayFunctions(); }, "Failed to instantiate object correctly using default constructor"); Assert.IsNotNull(obj, "This object cannot be null"); Assert.AreEqual(PFW.CSIST203.Project1.Functions.ArrayFunctions.DefaultPersistentFile, obj.PersistentFile); Assert.IsNotNull(obj.Randomizer); }
public void EmptyOrWhitespacePersistentFilenameThrowsException() { PFW.CSIST203.Project1.Functions.ArrayFunctions obj; AssertDelegateFailure(() => { obj = new Project1.Functions.ArrayFunctions(string.Empty); }, typeof(ArgumentException), "Instantiation should not have succeeded with an emtpy string for the persistent file"); AssertDelegateFailure(() => { obj = new Project1.Functions.ArrayFunctions(" "); }, typeof(ArgumentException), "Instantiation should not have succeeded with a whitespace string for the persistent file"); }
public void AllParameters() { string path = System.IO.Path.GetTempFileName(); PFW.CSIST203.Project1.Functions.ArrayFunctions obj = null; AssertDelegateSuccess(() => { obj = new Project1.Functions.ArrayFunctions(path, 123); }, "Failed to instantiate object correctly using default constructor"); Assert.IsNotNull(obj, "This object cannot be null"); Assert.AreEqual(path, obj.PersistentFile); Assert.IsNotNull(obj.Randomizer); }