Ejemplo n.º 1
0
        public void FileDoesNotExistMock()
        {
            IFileServise iFile = new MockFileServise();

            Lab1UnitTesting.ReportViewer iReport = new Lab1UnitTesting.ReportViewer(iFile);
            Assert.Throws <FileNotFoundException>(() => iReport.Clean("D:\\ToRead.txt"));
        }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
        public void FileDoesNotExistProperty()
        {
            IFileServise iFile = new StubFileServise();

            Lab1UnitTesting.ReportViewer iReport = new Lab1UnitTesting.ReportViewer();
            iReport.FileServise = iFile;
            Assert.Throws <FileNotFoundException>(() => iReport.Clean("D:\\ToRead.txt"));
        }
Ejemplo n.º 4
0
        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);
        }