public void Create_DoesReturnValidContextInstance()
        {
            var builder = new ScarletCommandBuilder(Utils.GetTestDispatcher(), Utils.GetTestCommandManager(), Utils.GetTestExceptionHandler(), Utils.GetTestMessenger(), Utils.GetTestExitService(), Utils.GetTestEventManager(), Utils.TestBusyStackFactory);

            var context = builder.Create <object>((o, token) => Task.CompletedTask, (o) => true);

            Assert.IsNotNull(context);
        }
        public void ShouldBeBusyWhenUsingBusyStack()
        {
            var dispatcher     = new TestDispatcher();
            var commandBuilder = new ScarletCommandBuilder(dispatcher, Utils.GetTestCommandManager(), Utils.GetTestExceptionHandler(), Utils.GetTestMessenger(), Utils.GetTestExitService(), Utils.GetTestEventManager(), (lambda) => new BusyStack(lambda));

            var vm = new DerivedViewModelListBase(commandBuilder);

            Assert.AreEqual(false, vm.IsBusy);
            vm.ValidateState(() =>
            {
                Assert.AreEqual(true, vm.IsBusy);
            });
            Assert.AreEqual(false, vm.IsBusy);
        }
        public void Ctor_ShouldInitializeDependencyProperties()
        {
            var dispatcher       = Utils.GetTestDispatcher();
            var commandManager   = Utils.GetTestCommandManager();
            var messenger        = Utils.GetTestMessenger();
            var exit             = Utils.GetTestExitService();
            var eventManager     = Utils.GetTestEventManager();
            var exceptionHandler = Utils.GetTestExceptionHandler();

            var builder = new ScarletCommandBuilder(dispatcher, commandManager, exceptionHandler, messenger, exit, eventManager, Utils.TestBusyStackFactory);

            Assert.AreEqual(dispatcher, builder.Dispatcher);
            Assert.AreEqual(commandManager, builder.CommandManager);
            Assert.AreEqual(messenger, builder.Messenger);
            Assert.AreEqual(exit, builder.Exit);
            Assert.AreEqual(eventManager, builder.WeakEventManager);
        }
Esempio n. 4
0
 public static void Setup()
 {
     _builder = new ScarletCommandBuilder(Utils.GetTestDispatcher(), Utils.GetTestCommandManager(), Utils.GetTestExceptionHandler(), Utils.GetTestMessenger(), Utils.GetTestExitService(), Utils.GetTestEventManager(), Utils.TestBusyStackFactory);
 }