public void EmailDesignerViewModel_Handles_UpdateResourceMessage_EmailSourceIsUpdated()
        {
            //------------Setup for test--------------------------
            var resourceID  = Guid.NewGuid();
            var emailSource = new EmailSource
            {
                ResourceID   = resourceID,
                ResourceName = "Email1",
                UserName     = "******",
                Password     = "******"
            };

            // var emailSources = CreateEmailSources(2);
            var modelItem = ModelItemUtils.CreateModelItem(new DsfSendEmailActivity
            {
                SelectedEmailSource = emailSource
            });

            var viewModel = CreateViewModel(new List <EmailSource> {
                emailSource
            }, modelItem);

            var updatedEmailSource = new EmailSource
            {
                ResourceID   = resourceID,
                ResourceName = "EmailTest",
                UserName     = "******",
                Password     = "******"
            };

            //var xaml = new StringBuilder
            var resourceModel = new Mock <IContextualResourceModel>();

            resourceModel.Setup(r => r.WorkflowXaml).Returns(new StringBuilder(updatedEmailSource.ToXml().ToString()));

            var message = new UpdateResourceMessage(resourceModel.Object);

            //------------Execute Test---------------------------
            viewModel.Handle(message);

            //------------Assert Results-------------------------
            var selectedSource = viewModel.SelectedEmailSourceModelItemValue;

            Assert.AreEqual(updatedEmailSource.UserName, selectedSource.UserName);
            Assert.AreEqual(updatedEmailSource.Password, selectedSource.Password);
        }
예제 #2
0
        public void NavigationViewModel_SetNodeOverwrite_SetToFalse_FalseReturned()
        {
            Init(false, true);
            var newResource = new Mock <IContextualResourceModel>();

            newResource.Setup(r => r.ResourceType)
            .Returns(ResourceType.WorkflowService);
            newResource.Setup(r => r.Category).Returns("Testing");
            newResource.Setup(r => r.ResourceName).Returns("Cake");
            newResource.Setup(r => r.Environment)
            .Returns(_mockEnvironmentModel.Object);

            var updatemsg = new UpdateResourceMessage(newResource.Object);

            _vm.Handle(updatemsg);

            Assert.IsFalse(_vm.SetNodeOverwrite(newResource.Object, false));
        }