public async Task HourShifter_ShiftsDateTakenExifValue()
        {
            Options options = new Options
            {
                Hours = 1,
                CurrentDirectoryOnly = false,
                Quiet = true
            };

            IFileLoader      fileLoader       = new FileLoader(options, Directory.GetCurrentDirectory());
            IHourShifter     hourShifter      = new HourShifter.HourShifter(options, fileLoader);
            ProgramBootstrap programBootstrap = new ProgramBootstrap(hourShifter);

            DateTime originalDateTime = await getJpgDateTaken(sampleJpgFile);

            Assert.Multiple(async() =>
            {
                int?exitCode = null;

                Assert.That(async() =>
                {
                    exitCode = await programBootstrap.Run();
                }, Throws.Nothing);

                DateTime newDateTime = await getJpgDateTaken(sampleJpgFile);

                Assert.That(originalDateTime != newDateTime);
                Assert.That(originalDateTime.AddHours(1) == newDateTime);

                Assert.That(exitCode.HasValue);
                Assert.That(exitCode.Value, Is.Zero);
            });
        }
Exemple #2
0
        public void ProgramBootstrap_Run_ReturnsFailure()
        {
            Mock <IHourShifter> mock = new Mock <IHourShifter>();

            mock
            .Setup(m => m.Shift().Result)
            .Throws(new Exception())
            .Verifiable();

            ProgramBootstrap programBootstrap = new ProgramBootstrap(mock.Object);

            Assert.Multiple(() =>
            {
                int?exitCode = null;

                Assert.That(async() =>
                {
                    exitCode = await programBootstrap.Run();
                }, Throws.Nothing);

                Assert.That(exitCode.HasValue);
                Assert.That(exitCode.Value, Is.EqualTo(Constants.FAILURE_EXIT_CODE));
                mock.Verify(m => m.Shift(), Times.Once);
            });
        }