Exemple #1
0
        public void TestGettingMessengerInstanceWhenNotSet()
        {
            var messenger = new Messenger();
            var vm1       = new TestViewModel(messenger);
            var vm2       = new TestViewModel();

            Assert.AreSame(messenger, vm1.GetMessengerInstance());
            Assert.AreSame(Messenger.Default, vm2.GetMessengerInstance());
        }
Exemple #2
0
        public void TestRaiseWithEmptyStringAndBroadcast()
        {
            var vm = new TestViewModel();

            const string value1 = "Hello";
            const string value2 = "World";

            var messengerValue = string.Empty;

            vm.GetMessengerInstance().Register <string>(this, msg => messengerValue = msg);

            try
            {
                vm.RaiseEmptyPropertyChangedWithBroadcast(value1, value2);
                Assert.Fail("ArgumentException was expected");
            }
            catch (ArgumentException)
            {
            }
        }