Exemplo n.º 1
0
 public static void AssetThereWasAtleastOneCanExecuteChangedEventAndCommandExecutableStateIs
     (this CommandObserver commandObserver, bool executableState)
 {
     commandObserver.AssetAllSendersWereCorrect();
     Assert.AreNotEqual(0, commandObserver.NumberOfEventsRecieved, "No events were recieved");
     Assert.AreEqual(executableState, commandObserver.ValueOfCanExecuteOnLatestEvent, "The command is executable");
 }
Exemplo n.º 2
0
        public static CommandObserver GetDelegateCommandObserver(this DelegateCommand command)
        {
            CommandObserver observer = new CommandObserver();

            observer.ValueOfCanExecuteOnLatestEvent = command.CanExecute();
            command.CanExecuteChanged += (obj, e) =>
            {
                if (command == obj)
                {
                    observer.WasTheSendersCorrect.Add(true);
                }
                observer.ValueOfCanExecuteOnLatestEvent = command.CanExecute();
                observer.NumberOfEventsRecieved++;
            };
            return(observer);
        }
Exemplo n.º 3
0
 public static void AssertTheCommandBecameNonExecutable(this CommandObserver commandObserver)
 {
     commandObserver.
     AssetThereWasAtleastOneCanExecuteChangedEventAndCommandExecutableStateIs(false);
 }
Exemplo n.º 4
0
 public static void AssetAllSendersWereCorrect(this CommandObserver commandObserver)
 {
     Assert.AreEqual(0, commandObserver.WasTheSendersCorrect.Count(x => false), "There was atleast one sender for this command that not correct");
 }