コード例 #1
0
        public void TryParse_NegativeIntValue_CouldNotParse()
        {
            var value        = -1;
            var bitAttribute = new BitAttribute();
            var couldParse   = bitAttribute.TryParse(null, value, out object parsedFieldValue, out string failureMessage);

            Assert.IsFalse(couldParse);
            Assert.IsNull(parsedFieldValue);
            Assert.IsFalse(String.IsNullOrEmpty(failureMessage));
        }
コード例 #2
0
        public void TryParse_OneIntValue_CouldParseAndTrueReturned()
        {
            var value        = 1;
            var bitAttribute = new BitAttribute();
            var couldParse   = bitAttribute.TryParse(null, value, out object parsedFieldValue, out string failureMessage);

            Assert.IsTrue(couldParse);
            Assert.AreEqual(true, parsedFieldValue);
            Assert.IsNull(failureMessage);
        }
コード例 #3
0
        public void TryParse_GreaterThanOneDecimalValue_CouldNotParse()
        {
            var value        = (decimal)2;
            var bitAttribute = new BitAttribute();
            var couldParse   = bitAttribute.TryParse(null, value, out object parsedFieldValue, out string failureMessage);

            Assert.IsFalse(couldParse);
            Assert.IsNull(parsedFieldValue);
            Assert.IsFalse(String.IsNullOrEmpty(failureMessage));
        }
コード例 #4
0
        public void TryParse_ZeroDecimalValue_CouldParseAndFalseReturned()
        {
            var value        = (decimal)0;
            var bitAttribute = new BitAttribute();
            var couldParse   = bitAttribute.TryParse(null, value, out object parsedFieldValue, out string failureMessage);

            Assert.IsTrue(couldParse);
            Assert.AreEqual(false, parsedFieldValue);
            Assert.IsNull(failureMessage);
        }
コード例 #5
0
 public BitControl(BitAttribute attribute)
 {
     InitializeComponent();
     Label.Content = attribute.Label;
     this.SetValue(Grid.RowProperty, attribute.Row);
     this.SetValue(Grid.ColumnProperty, attribute.Column);
     this.SetValue(Grid.ColumnSpanProperty, attribute.ColumnSpan);
     _attribute = attribute;
     if (attribute.Value == "True")
     {
         CheckBox.IsChecked = true;
     }
 }
コード例 #6
0
        public void TryParse_TrueBooleanValueWithCustomFalseValue_CouldParseAndCustomFalseValueReturned()
        {
            var value        = false;
            var bitAttribute = new BitAttribute()
            {
                FalseValue = "NO"
            };
            var couldParse = bitAttribute.TryParse(null, value, out object parsedFieldValue, out string failureMessage);

            Assert.IsTrue(couldParse);
            Assert.AreEqual("NO", parsedFieldValue);
            Assert.IsNull(failureMessage);
        }