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)); }
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); }
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)); }
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); }
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; } }
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); }