public void ReadTest_FailureParamFile() { // arrange DashboardFileFactory target = new DashboardFileFactory(); // act try { target.Read(null); Assert.Fail("exception not thrown"); } catch (ArgumentNullException) { } catch { Assert.Fail("Invalid exception"); } }
public void ReadTest_Success() { // arrange DashboardFileFactory target = new DashboardFileFactory(); DashboardFile file = target.CreateFile(this.contents, this.filename); target.Save(file); // act string actual = target.Read(file); // assert Assert.AreEqual(this.contents, actual); // cleanup File.Delete(file.FileName); }
public void ReadTest_FailureFileNotFound() { // arrange DashboardFileFactory target = new DashboardFileFactory(); DashboardFile file = target.CreateFile(this.contents, "bogusname.txt"); // act try { target.Read(file); Assert.Fail("exception not thrown"); } catch (FileNotFoundException) { } catch { Assert.Fail("Invalid exception"); } }