Inheritance: Caliburn.Micro.PropertyChangedBase, IWorkflowDescriptor
 public void ToXmlExpectedReturnsXml()
 {
     var workflow = new WorkflowDescriptor();
     var result = workflow.ToXml();
     Assert.IsNotNull(result);
     Assert.IsInstanceOfType(result, typeof(XElement));
 }
        public void ConstructorWithValidXmlArgumentExpectedInitializesAllProperties()
        {
            var xml = XmlResource.Fetch("Workflow");
            var workflow = new WorkflowDescriptor(xml);

            var properties = workflow.GetType().GetProperties();

            foreach(var property in properties)
            {
                if (property.Name == "IsNotifying" || property.Name == "IsSelected")
                {
                    continue;
                }

                var expected = xml.AttributeSafe(property.Name).ToLower();
                var actual = property.GetValue(workflow).ToString().ToLower();
                Assert.AreEqual(expected, actual);
            }
        }
        public void ToXmlExpectedSerializesIDandName()
        {
            var workflow = new WorkflowDescriptor
            {
                ResourceID = Guid.NewGuid().ToString(),
                ResourceName = "Testing123"
            };
            var result = workflow.ToXml();

            var properties = workflow.GetType().GetProperties();
            foreach(var property in properties)
            {
                if (property.Name == "IsNotifying" || property.Name == "IsSelected")
                {
                    continue;  
                }
                var expected = property.GetValue(workflow).ToString().ToLower();
                var actual = result.AttributeSafe(property.Name).ToLower();
                Assert.AreEqual(expected, actual);
            }
        }
        public LoggingSettings(XElement xml, string webserverUri)
            : base(xml, webserverUri)
        {
            IsInitializing = true;

            var postWorkflow = xml.Element("PostWorkflow");

            bool boolValue;
            int intValue;
            IsLoggingEnabled = bool.TryParse(xml.AttributeSafe("IsLoggingEnabled"), out boolValue) && boolValue;
            IsVersionLogged = bool.TryParse(xml.AttributeSafe("IsVersionLogged"), out boolValue) && boolValue;
            IsTypeLogged = bool.TryParse(xml.AttributeSafe("IsTypeLogged"), out boolValue) && boolValue;
            IsDurationLogged = bool.TryParse(xml.AttributeSafe("IsDurationLogged"), out boolValue) && boolValue;
            IsDataAndTimeLogged = bool.TryParse(xml.AttributeSafe("IsDataAndTimeLogged"), out boolValue) && boolValue;
            IsInputLogged = bool.TryParse(xml.AttributeSafe("IsInputLogged"), out boolValue) && boolValue;
            IsOutputLogged = bool.TryParse(xml.AttributeSafe("IsOutputLogged"), out boolValue) && boolValue;
            NestedLevelCount = Int32.TryParse(xml.AttributeSafe("NestedLevelCount"), out intValue) ? intValue : 0;
            LogAll = bool.TryParse(xml.AttributeSafe("LogAll"), out boolValue) && boolValue;
            LogFileDirectory = xml.AttributeSafe("LogFileDirectory");
            ServiceInput = xml.AttributeSafe("ServiceInput");

            var workflows = xml.Element("Workflows");
            if (workflows != null)
            {
                foreach (var workflow in workflows.Elements())
                {
                    Workflows.Add(new WorkflowDescriptor(workflow));
                }
            }

            if (postWorkflow != null)
            {
                PostWorkflow = new WorkflowDescriptor(xml.Element("PostWorkflow"));
            }

            RunPostWorkflow = PostWorkflow != null;

            IsInitializing = false;
        }
 private static WorkflowDescriptor GetWorkFlowDescriptor(bool isSelected = false)
 {
     var descriptor = new WorkflowDescriptor() { IsSelected = isSelected, ResourceID = Guid.NewGuid().ToString() };
     return descriptor;
 }
Example #6
0
        public void ToXmlSerializesCorrectly()
        {
            var logging = new LoggingSettings("localhost");

            logging.ServiceInput = "TestInput";
            logging.LogFileDirectory = "TestDir";
            logging.LogAll = true;
            logging.NestedLevelCount = 2;
            logging.IsOutputLogged = true;
            logging.IsInputLogged = true;
            logging.IsDataAndTimeLogged = true;
            logging.IsDurationLogged = true;
            logging.IsTypeLogged = true;
            logging.IsVersionLogged = true;
            logging.IsLoggingEnabled = true;
            var workflow = new WorkflowDescriptor(XmlResource.Fetch("Workflow"));
            logging.Workflows.Add(workflow);
            logging.PostWorkflow = workflow;

            var actual = logging.ToXml().ToString();
            var expected = XmlResource.Fetch("LoggingSettings").ToString();
            Assert.AreEqual(actual, expected);
        }
 public void ConstructorWithInvalidXmlArgumentExpectedDoesNotThrowException()
 {
     var workflow = new WorkflowDescriptor(new XElement("x", new XElement("y"), new XElement("z")));
     Assert.IsNotNull(workflow);
 }
 public void ConstructorWithNullXmlArgumentExpectedDoesNotThrowException()
 {
     var workflow = new WorkflowDescriptor(null);
     Assert.IsNotNull(workflow);
 }