コード例 #1
0
        public void GetHashCode_AreNotEqualWithDifferentValues(string other)
        {
            var bstring      = new BString("Test String");
            var otherBString = new BString(other);

            bstring.GetHashCode().Should().NotBe(otherBString.GetHashCode());
        }
コード例 #2
0
ファイル: Cell.cs プロジェクト: pwdlugosz/Spectre
        /// <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;
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: BStringTests.cs プロジェクト: Trontastic/BencodeNET
        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);
        }
コード例 #5
0
ファイル: BStringTests.cs プロジェクト: Trontastic/BencodeNET
        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());
        }
コード例 #6
0
        public void BStringHashcode()
        {
            BString a = new BString("testHashCode");

            Assert.AreEqual("testHashCode".GetHashCode(), a.GetHashCode());
        }
コード例 #7
0
ファイル: BStringTests.cs プロジェクト: tautcony/BencodeNET
 public void GetHashCode_AreNotEqualWithDifferentValues(string other)
 {
     var bstring = new BString("Test String");
     var otherBString = new BString(other);
     bstring.GetHashCode().Should().NotBe(otherBString.GetHashCode());
 }
コード例 #8
0
ファイル: BStringTests.cs プロジェクト: tautcony/BencodeNET
        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);
        }