コード例 #1
0
        public void Should_ShowWarning_When_ItemIsInvalid()
        {
            var viewClosed = false;
            var item       = new Item();
            var parent     = Substitute.For <Item>();
            var command    = new AddCommand(item, parent, () => { viewClosed = true; });
            var handler    = new AddCommandHandler(_settingsStore, _jobScheduler, _usageReporter, _dialogService);

            handler.Handle(command);

            Assert.IsFalse(viewClosed);

            _dialogService.Received().ShowWarning(Arg.Any <string>(), Arg.Any <string>());

            parent.DidNotReceive().Add(item);
            _settingsStore.DidNotReceive().TrySave();
            _jobScheduler.DidNotReceive().Schedule(item);
            _usageReporter.DidNotReceive().ReportEvent(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>());
        }