Exemplo n.º 1
0
        public void Should_Throw_When_CommandIsNull()
        {
            var settingsStore = Substitute.For <ISettingsStore>();
            var jobScheduler  = Substitute.For <IJobScheduler>();

            var handler = new DisableCommandHandler(settingsStore, jobScheduler);

            handler.Handle(null);
        }
Exemplo n.º 2
0
        public void Should_Disable_Unschedule_And_Save()
        {
            var settingsStore = Substitute.For <ISettingsStore>();
            var jobScheduler  = Substitute.For <IJobScheduler>();

            var item    = new Dummy();
            var command = new DisableCommand(item);
            var handler = new DisableCommandHandler(settingsStore, jobScheduler);

            handler.Handle(command);

            Assert.IsFalse(item.IsEnabled);

            settingsStore.Received().TrySave();

            jobScheduler.Received().Disable(item);
        }
Exemplo n.º 3
0
        public void Should_Disable_FolderItems()
        {
            var settingsStore = Substitute.For <ISettingsStore>();
            var jobScheduler  = Substitute.For <IJobScheduler>();

            var folder = new Folder();
            var item   = new Dummy();

            folder.Add(item);

            var command = new DisableCommand(folder);
            var handler = new DisableCommandHandler(settingsStore, jobScheduler);

            handler.Handle(command);

            Assert.IsTrue(item.IsDisabled);
            Assert.IsTrue(folder.IsDisabled);

            settingsStore.Received().TrySave();

            jobScheduler.Received(1).Disable(item);
            jobScheduler.DidNotReceive().Disable(folder);
        }