Ejemplo n.º 1
0
        public void GivenIDragRabbitMQConsumeToolOntoTheDesignSurface()
        {
            var resourceCatalog = new Mock <IResourceCatalog>();

            resourceCatalog.Setup(catalog => catalog.GetResource <RabbitMQSource>(It.IsAny <Guid>(), It.IsAny <Guid>())).Returns(new RabbitMQSource());
            var consumeActivity = new DsfConsumeRabbitMQActivity(resourceCatalog.Object);

            var modelItem = ModelItemUtils.CreateModelItem(consumeActivity);
            var model     = new Mock <IRabbitMQSourceModel>();

            var viewModel     = new RabbitMQConsumeDesignerViewModel(modelItem, model.Object);
            var privateObject = new PrivateObject(consumeActivity);

            scenarioContext.Add("ViewModel", viewModel);
            scenarioContext.Add("Model", model);
            scenarioContext.Add("Activity", consumeActivity);
            scenarioContext.Add("PrivateObj", privateObject);
        }
Ejemplo n.º 2
0
        public void RabbitMQConsumeDesignerViewModel_Validate_With_No_RabbitMQ_Source_ShouldBreakRule()
        {
            //------------Setup for test--------------------------
            var model = new Mock <IRabbitMQSourceModel>();

            model.Setup(m => m.RetrieveSources()).Returns(new List <IRabbitMQServiceSourceDefinition>());

            var vm = new RabbitMQConsumeDesignerViewModel(CreateModelItem(), model.Object);

            vm.SelectedRabbitMQSource = null;
            //------------Execute Test---------------------------
            vm.Validate();
            //------------Assert Results-------------------------
            Assert.IsNotNull(vm);
            var errors = vm.Errors;

            Assert.IsNotNull(errors);
            Assert.IsTrue(errors.Any(info => info.Message == Warewolf.Resource.Errors.ErrorResource.RabbitMqSourceNotNullErrorTest));
        }
Ejemplo n.º 3
0
        public void RabbitMQConsumeDesignerViewModel_IsObject_IsChanged()
        {
            var shellVm = new Mock <IShellViewModel>();

            CustomContainer.Register(shellVm.Object);
            var model = new Mock <IRabbitMQSourceModel>();

            model.Setup(m => m.RetrieveSources()).Returns(new List <IRabbitMQServiceSourceDefinition>());

            //------------Execute Test---------------------------
            var consumeRabbitMqActivity = new DsfConsumeRabbitMQActivity();
            var modelItem = ModelItemUtils.CreateModelItem(consumeRabbitMqActivity);
            var vm        = new RabbitMQConsumeDesignerViewModel(modelItem, model.Object)
            {
                IsObject = true
            };

            //------------Assert Results-------------------------
            Assert.IsTrue(vm.IsObject);
            Assert.IsTrue(consumeRabbitMqActivity.IsObject);
        }