public void CanCompareToScalar() { BooleanValue bv = new BooleanValue(true); ScalarValue sv = ScalarValue.Create(1); Assert.IsTrue(bv == sv); Assert.IsFalse(bv != sv); Assert.IsTrue(sv == bv); Assert.IsFalse(sv != bv); sv = ScalarValue.Create(0); Assert.IsTrue(bv != sv); Assert.IsFalse(bv == sv); Assert.IsTrue(sv != bv); Assert.IsFalse(sv == bv); sv = ScalarValue.Create(3.1415926535897932384626433832795); Assert.IsTrue(bv == sv); Assert.IsFalse(bv != sv); Assert.IsTrue(sv == bv); Assert.IsFalse(sv != bv); sv = ScalarValue.Create(0.0d); Assert.IsTrue(bv != sv); Assert.IsFalse(bv == sv); Assert.IsTrue(sv != bv); Assert.IsFalse(sv == bv); bv = new BooleanValue(false); sv = ScalarValue.Create(1); Assert.IsTrue(bv != sv); Assert.IsFalse(bv == sv); Assert.IsTrue(sv != bv); Assert.IsFalse(sv == bv); sv = ScalarValue.Create(0); Assert.IsTrue(bv == sv); Assert.IsFalse(bv != sv); Assert.IsTrue(sv == bv); Assert.IsFalse(sv != bv); sv = ScalarValue.Create(3.1415926535897932384626433832795); Assert.IsTrue(bv != sv); Assert.IsFalse(bv == sv); Assert.IsTrue(sv != bv); Assert.IsFalse(sv == bv); Assert.IsFalse(bv.Equals(sv)); sv = ScalarValue.Create(0.0d); Assert.IsTrue(bv == sv); Assert.IsFalse(bv != sv); Assert.IsTrue(sv == bv); Assert.IsFalse(sv != bv); Assert.IsFalse(bv.Equals(sv)); }
public override bool LoadPostData(string postDataKey, NameValueCollection postCollection) { var postedValue = postCollection[postDataKey]; var boolValue = !string.IsNullOrEmpty(postedValue); if (!BooleanValue.Equals(boolValue)) { Value = boolValue; return(true); } return(false); }
public override bool LoadPostData(string postDataKey, NameValueCollection postCollection) { string postedValue = postCollection[postDataKey]; bool boolValue = false; if (!(postedValue == null || postedValue == string.Empty)) { boolValue = true; } if (!BooleanValue.Equals(boolValue)) { Value = boolValue; return(true); } return(false); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is CatalogCustomAttributeValue other && ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) && ((StringValue == null && other.StringValue == null) || (StringValue?.Equals(other.StringValue) == true)) && ((CustomAttributeDefinitionId == null && other.CustomAttributeDefinitionId == null) || (CustomAttributeDefinitionId?.Equals(other.CustomAttributeDefinitionId) == true)) && ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) && ((NumberValue == null && other.NumberValue == null) || (NumberValue?.Equals(other.NumberValue) == true)) && ((BooleanValue == null && other.BooleanValue == null) || (BooleanValue?.Equals(other.BooleanValue) == true)) && ((SelectionUidValues == null && other.SelectionUidValues == null) || (SelectionUidValues?.Equals(other.SelectionUidValues) == true)) && ((Key == null && other.Key == null) || (Key?.Equals(other.Key) == true))); }