Exemple #1
0
 public void TestInit()
 {
     vm = new AddCloudDialogViewModel(services);
     vm.InstanceName = fakeInstanceName;
     vm.Target       = fakeTarget;
     vm.Username     = fakeUsername;
     vm.GetPassword  = () => { return(fakeSecurePw); };
     vm.HttpProxy    = fakeHttpProxy;
     vm.SkipSsl      = skipSsl;
 }
        public void Constructor_Initializes()
        {
            var vm = new AddCloudDialogViewModel(services);

            vm.InstanceName = "My CF";
            vm.Target       = "http://test/";
            var view = new AddCloudDialogView(vm);

            // Verify DataContext initalized
            Assert.AreSame(vm, view.DataContext);

            // Verify Login command points to view model
            var command = view.AddCloudCommand as AsyncDelegatingCommand;

            Assert.IsNotNull(command);
            Assert.AreEqual(vm, command.action.Target);

            // Verify ViewModel callback for password
            Assert.IsNotNull(vm.GetPassword);

            // Verify bindings
            Assert.AreEqual(vm.InstanceName, view.tbInstanceName.Text);
            Assert.AreEqual(vm.Target, view.tbUrl.Text);
        }