public void GetHashCode_AreNotEqualWithDifferentValues(string other) { var bstring = new BString("Test String"); var otherBString = new BString(other); bstring.GetHashCode().Should().NotBe(otherBString.GetHashCode()); }
/// <summary> /// /// </summary> /// <param name="AWValue"></param> public Cell(BString Value) : this() { this.AFFINITY = CellAffinity.BSTRING; // Handle null strings // if (Value == null) { this.BSTRING = BString.Empty; this.NULL = 1; return; } // Fix the values if (Value.Length == 0) // fix instances that are zero length { Value = BString.Empty; } else if (Value.Length >= MAX_STRING_LENGTH) // Fix strings that are too long { Value = Value.Substring(0, MAX_STRING_LENGTH); } this.BSTRING = Value; this.NULL = 0; this.INT_A = Value.GetHashCode(); this.INT_B = Value.Length; }
public void GetHashCode_AreEqualWithSameContent(string str1, string str2) { var bstring1 = new BString(str1); var bstring2 = new BString(str2); var expected = bstring1.GetHashCode(); var actual = bstring2.GetHashCode(); actual.Should().Be(expected); }
public void HashCodesAreEqual() { var bstring1 = new BString("Test String"); var bstring2 = new BString("Test String"); var expected = bstring1.GetHashCode(); var actual = bstring2.GetHashCode(); Assert.AreEqual(expected, actual); }
public void HashCodesAreNotEqual() { var bstring = new BString("Test String"); Assert.AreNotEqual(bstring.GetHashCode(), new BString("Test Strin").GetHashCode()); Assert.AreNotEqual(bstring.GetHashCode(), new BString("Test Strin ").GetHashCode()); Assert.AreNotEqual(bstring.GetHashCode(), new BString("Test String ").GetHashCode()); Assert.AreNotEqual(bstring.GetHashCode(), new BString("Test String2").GetHashCode()); Assert.AreNotEqual(bstring.GetHashCode(), new BString("Test StrinG").GetHashCode()); Assert.AreNotEqual(bstring.GetHashCode(), new BString("test string").GetHashCode()); Assert.AreNotEqual(bstring.GetHashCode(), new BString("TestString").GetHashCode()); Assert.AreNotEqual(bstring.GetHashCode(), new BString("teststring").GetHashCode()); Assert.AreNotEqual(bstring.GetHashCode(), new BString("TøstStrøng").GetHashCode()); }
public void BStringHashcode() { BString a = new BString("testHashCode"); Assert.AreEqual("testHashCode".GetHashCode(), a.GetHashCode()); }