void instance_equality_equals()
        {
            var actual = new ShortGuid(SampleShortGuidString);

            Assert.True(actual.Equals(actual));
            Assert.False(actual.Equals(null));
            Assert.True(actual.Equals(SampleGuid));
            Assert.True(actual.Equals(SampleGuidString));
            Assert.True(actual.Equals(SampleShortGuidString));
        }
        public void Equals_ShouldDetermineEqualityWithOtherShortGuid(string encoded, string encoded2,
                                                                     bool expected)
        {
            var shortGuid  = new ShortGuid(encoded);
            var shortGuid2 = new ShortGuid(encoded2);

            bool areEqual = shortGuid.Equals(shortGuid2);

            areEqual.Should().Be(expected);
        }
Example #3
0
        public void EqualsTest()
        {
            ShortGuid target   = new ShortGuid(); // TODO: Initialize to an appropriate value
            object    obj      = null;            // TODO: Initialize to an appropriate value
            bool      expected = false;           // TODO: Initialize to an appropriate value
            bool      actual;

            actual = target.Equals(obj);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #4
0
        public void ShortGuidEqualsTest()
        {
            const string x = "fe66b08f-a1bd-4d40-9711-4e1469c5193a";
            const string y = "07bb23cd-7b24-42b4-8467-3f0be7fa9ea5";

            Guid xg   = new Guid(x);
            var  xsg  = new ShortGuid(x);
            var  xsg2 = new ShortGuid(x);

            Assert.IsTrue(xsg.Equals(xsg2));
            Assert.IsTrue(xsg.Equals(x));
            Assert.IsTrue(xsg.Equals(xg));
            Assert.IsTrue(xsg.Equals(xsg2));
            Assert.IsTrue(xsg.Equals(xsg2.ToString()));
            Assert.IsTrue(xsg.Equals(xsg2.Value));
            Assert.IsFalse(xsg.Equals($"bad@{xsg2.Value}@bad"));


            Guid yg  = new Guid(y);
            var  ysg = new ShortGuid(y);

            Assert.IsFalse(xsg.Equals(ysg));
            Assert.IsFalse(xsg.Equals(y));
            Assert.IsFalse(xsg.Equals(yg));
            Assert.IsFalse(xsg.Equals(ysg));
            Assert.IsFalse(xsg.Equals(ysg.ToString()));
            Assert.IsFalse(xsg.Equals(ysg.Value));
            Assert.IsFalse(xsg.Equals($"bad@{ysg.Value}@bad"));

            const string gs = "DwUBBA8PDAAPBAYFBAEEDw";

            var sg1 = new ShortGuid(gs);
            var sg2 = new ShortGuid(gs);

            Assert.IsTrue(sg1 == sg2);
            Assert.IsTrue(ShortGuid.Empty.Equals(new ShortGuid(Guid.Empty)));
        }