Esempio n. 1
0
        public void TestCleanFilesSize()
        {
            IReportViewer reportViewer = new ReportViewer(new FakeStubFileServiceReturnSize(), "TestReturnValue");

            reportViewer.Clean();
            Assert.AreEqual(2048, reportViewer.UsedSize);
        }
Esempio n. 2
0
        public void TestZeroFilesSize() //Тест, что при передаче несуществующего пути метод Clean() корректно завершает свою работу
        {                               //Стаб возвращает эксепшн при pathToDelete == "TestException"
            IReportViewer reportViewer = new ReportViewer(new FakeStubFileServiceReturnSize(), "TestException");

            reportViewer.Clean();
            Assert.AreEqual(0, reportViewer.UsedSize);
        }
Esempio n. 3
0
        public void RemoveTemporaryFilesMockTest()
        {
            var mock         = new Mock <IFileService>();
            var reportViewer = new ReportViewer(mock.Object);

            reportViewer.Clean();
            mock.Verify(r => r.RemoveTemporaryFiles("Text.txt"), Times.Once());
        }
Esempio n. 4
0
        public void ReportViewer_Clean_MoqRemoveTemporaryFilesWasCalled()
        {
            _mock.Setup(x => x.RemoveTemporaryFiles(It.IsAny <string>()));

            _report.Clean("sasd");

            _mock.VerifyAll();
        }
Esempio n. 5
0
        public void Clean_dirPath_CallRemoveTemporaryFiles()
        {
            var reportViewer = new ReportViewer(mockIFService.Object);

            reportViewer.Clean(dirPath);

            mockIFService.Verify(m => m.RemoveTemporaryFiles(dirPath), Times.Once);
        }
Esempio n. 6
0
        public void ReportViewer_Clean_27()
        {
            ReportViewer rv = new ReportViewer();

            rv.Clean(_path);

            Assert.AreEqual(rv.UsedSize, 27);
        }
Esempio n. 7
0
        public void ReportViewer_Clean_0()
        {
            ReportViewer rv = new ReportViewer();

            rv.Clean(Path.Combine("C:", "add"));

            Assert.AreEqual(rv.UsedSize, 0);
        }
Esempio n. 8
0
        public void RemoveTemporaryFilesMockTest()
        {
            var          fileService  = new FakeMockFileService();
            ReportViewer reportViewer = new ReportViewer(fileService);

            reportViewer.Clean();
            Assert.That(fileService.RemoveTemporaryFilesCallsCount, Is.EqualTo(1));
        }
Esempio n. 9
0
        public void TestFileServiceMethodIsCalled() //Использование Mock'а
        {
            FakeMockFileService fileService  = new FakeMockFileService();
            IReportViewer       reportViewer = new ReportViewer(fileService, "TestPath");

            reportViewer.Clean();
            Assert.AreEqual("TestPath", fileService.ReceivedPath);
        }
Esempio n. 10
0
        public void RemoveTemporaryFilesStubTest()
        {
            var          fileService  = new FakeStubFileService();
            ReportViewer reportViewer = new ReportViewer(fileService);

            reportViewer.Clean();
            Assert.AreEqual(1024, reportViewer.UsedSize);
        }
Esempio n. 11
0
        public void Clean_exeption_Stop()
        {
            stubIFService.Setup(s => s.RemoveTemporaryFiles(It.IsAny <string>())).Throws(new DirectoryNotFoundException());
            var reportViewer = new ReportViewer(stubIFService.Object);

            int SIGNAL_CODE = reportViewer.Clean(It.IsAny <string>());

            Assert.That(Is.Equals(SIGNAL_CODE, 2));
        }
        public void TestRemoveTemporaryFilesGetCalled()
        {
            var stub         = new FakeFileService();
            var reportViewer = new ReportViewer(stub);

            reportViewer.Clean("E:");

            Assert.That(stub.IsCalled, Is.EqualTo(true));
        }
Esempio n. 13
0
        public void RemoveTemporaryFilesStubTest()
        {
            var stub = new Mock <IFileService>();

            stub.Setup(r => r.RemoveTemporaryFiles("Text.txt")).Returns(1024);
            var reportViewer = new ReportViewer(stub.Object);

            reportViewer.Clean();
            Assert.AreEqual(reportViewer.UsedSize, 1024);
        }
        public void TestRemoveTemporaryFilesGetCalledOnce()
        {
            Mock <IFileService> mock = new Mock <IFileService>();

            var reportViewer = new ReportViewer(mock.Object);

            reportViewer.Clean(string.Empty);

            mock.Verify(i => i.RemoveTemporaryFiles(It.IsAny <string>()), Times.Once);
        }
Esempio n. 15
0
        public void Clean_dirPath_SetUsedSize()
        {
            long fakeSize = 9999;

            stubIFService.Setup(s => s.RemoveTemporaryFiles(It.IsAny <string>())).Returns(fakeSize);
            var reportViewer = new ReportViewer(stubIFService.Object);

            reportViewer.Clean(dirPath);

            Assert.That(reportViewer.UsedSize, Is.EqualTo(fakeSize));
        }
        public void TestReportViewerUsedSize()
        {
            Mock <IFileService> mock = new Mock <IFileService>();

            mock.Setup(i => i.RemoveTemporaryFiles(It.IsAny <string>())).Returns(256);

            var reportViewer = new ReportViewer(mock.Object);

            reportViewer.Clean("E:");

            Assert.That(reportViewer.UsedSize, Is.EqualTo(256));
        }
Esempio n. 17
0
 public void ReportViewer_Clean_RemoveTemporaryFilesWasCalled()
 {
     _reportViewer.Clean("sadas");
     Assert.IsTrue(_mockFileService.RemoveTemporaryFilesWasCalled);
 }
 public void TestInvalidCleanPathThrow()
 {
     Assert.That(() => _reportViewer.Clean(":/-'`"), Throws.ArgumentException);
 }