public void Execute_UnhandledExceptionShouldWriteErrorTrace()
        {
            bool writeErrorTraceWasCalled = false;
            FSI.IFileService fileservice = new StubIFileService()
            {
                GetUploadedFiles = () => { throw new Exception(); }
            };

            using (ShimsContext.Create())
            {
                ShimDiagnosticsProvider.ConstructorType = (dp, type) => { };
                Constants.ShimConstants.UploadedFilesExpirationDurationInHoursGet = () => 3;
                ShimDiagnosticsProvider.AllInstances.WriteErrorTraceTraceEventIdStringObjectArray = (diagnosticsProvider, traceEventId, message, args) => { writeErrorTraceWasCalled = true; };
                FileUpdateService fileUpdateService = new FileUpdateService(fileservice);
                fileUpdateService.Execute();
            }

            Assert.IsTrue(writeErrorTraceWasCalled);
        }
        public void Execute_ShouldCallGetUploadedFiles()
        {
            bool getUploadedFilesWasCalled = false;
            FSI.IFileService fileservice = new StubIFileService()
            {
                GetUploadedFiles = () => {
                    getUploadedFilesWasCalled = true;
                    return new List<File>();
                }
            };

            using (ShimsContext.Create())
            {
                ShimDiagnosticsProvider.ConstructorType = (dp, type) => { };
                Constants.ShimConstants.UploadedFilesExpirationDurationInHoursGet = () => 3;
                ShimDiagnosticsProvider.AllInstances.WriteInformationTraceTraceEventIdStringObjectArray = (diagnosticsProvider, traceEventId, message, args) => { };
                IFileService fileUpdateService = new FileUpdateService(fileservice);
                fileUpdateService.Execute();
            }

            Assert.IsTrue(getUploadedFilesWasCalled);
        }
        public void Execute_ShouldCallUpdateFileForEachFileReturnedByGetUploadedFiles()
        {
            int numberOfCallsToUpdateFile = 0;
            FSI.IFileService fileservice = new StubIFileService()
            {
                GetUploadedFiles = () => GetFiles(),
                UpdateFileFile = (file) => {
                    numberOfCallsToUpdateFile++;
                    return true;
                }
            };

            using (ShimsContext.Create())
            {
                ShimDiagnosticsProvider.ConstructorType = (dp, type) => { };
                Constants.ShimConstants.UploadedFilesExpirationDurationInHoursGet = () => 3;
                ShimDiagnosticsProvider.AllInstances.WriteInformationTraceTraceEventIdStringObjectArray = (diagnosticsProvider, traceEventId, message, args) => { };
                IFileService fileUpdateService = new FileUpdateService(fileservice);
                fileUpdateService.Execute();
            }

            Assert.AreEqual(4, numberOfCallsToUpdateFile);
        }