Exemplo n.º 1
0
        public void BuildViewModelUnknownType()
        {
            var f   = new FakeContactDetail();
            var fvm = ContactDetailViewModel.BuildViewModel(f);

            Assert.IsNull(fvm, "BuildViewModel should return null when it doesn't know how to handle a type.");
        }
Exemplo n.º 2
0
        public void BuildViewModel()
        {
            Phone   p = new Phone();
            Email   e = new Email();
            Address a = new Address();

            var pvm = ContactDetailViewModel.BuildViewModel(p);

            Assert.IsInstanceOfType(pvm, typeof(PhoneViewModel), "Factory method created wrong ViewModel type.");
            Assert.AreEqual(p, pvm.Model, "Underlying model object on ViewModel is not correct.");

            var evm = ContactDetailViewModel.BuildViewModel(e);

            Assert.IsInstanceOfType(evm, typeof(EmailViewModel), "Factory method created wrong ViewModel type.");
            Assert.AreEqual(e, evm.Model, "Underlying model object on ViewModel is not correct.");

            var avm = ContactDetailViewModel.BuildViewModel(a);

            Assert.IsInstanceOfType(avm, typeof(AddressViewModel), "Factory method created wrong ViewModel type.");
            Assert.AreEqual(a, avm.Model, "Underlying model object on ViewModel is not correct.");
        }
Exemplo n.º 3
0
 public void CheckNullArgumentExceptions()
 {
     Utilities.CheckNullArgumentException(() => { ContactDetailViewModel.BuildViewModel(null); }, "detail", "BuildViewModel");
 }