public void FileDoesNotExistMock() { IFileServise iFile = new MockFileServise(); Lab1UnitTesting.ReportViewer iReport = new Lab1UnitTesting.ReportViewer(iFile); Assert.Throws <FileNotFoundException>(() => iReport.Clean("D:\\ToRead.txt")); }
public void FileDoesNotExistPropertyMoq() { moq.Setup(x => x.RemoveTemporaryFiles(It.IsAny <string>())).Throws <FileNotFoundException>(); Lab1UnitTesting.ReportViewer iReport = new Lab1UnitTesting.ReportViewer(); iReport.FileServise = moq.Object; iReport.Clean("D://test.asm"); //moq.VerifyAll(); }
public void FileDoesNotExistProperty() { IFileServise iFile = new StubFileServise(); Lab1UnitTesting.ReportViewer iReport = new Lab1UnitTesting.ReportViewer(); iReport.FileServise = iFile; Assert.Throws <FileNotFoundException>(() => iReport.Clean("D:\\ToRead.txt")); }
public void FileExist() { IFileServise iFile = new StubFileServise(); Lab1UnitTesting.ReportViewer iReport = new Lab1UnitTesting.ReportViewer(iFile); iReport.Clean("D:\\VisualStudio2019\\ToRead.txt"); var tmp = iReport.usedSize; var expected = 100; Assert.AreEqual(expected, tmp); }