[U] public void Null() { LongId c = 10; (c == null).Should().BeFalse(); (null == c).Should().BeFalse(); }
public void DifferentValuesAreUnequal() { var foo1 = new LongId(1L); var foo2 = new LongId(2L); Assert.NotEqual(foo1, foo2); }
public string ToCreateString() { //var strID = Id.Replace(" ", "") + intId.ToString(); // without "_" it tries to index by id var strID = "node_" + LongId.ToString(); return("(" + strID + ":" + Type + "{Content:\'" + Content + "\', Id:\'" + Id + "\', LongId:\'" + LongId + "\''})"); }
public void DifferentTypesAreUnequal() { var bar = GuidId2.New(); var foo = new LongId(23L); //Assert.NotEqual(bar, foo); // does not compile Assert.NotEqual((object)bar, (object)foo); }
public void SameValuesAreEqual() { var id = 123L; var foo1 = new LongId(id); var foo2 = new LongId(id); Assert.Equal(foo1, foo2); }
public StructWithSingleConstructor(Id <Product> productId, LongId <Product>?nullableProductId, string someString, decimal price, decimal?maybePrice, Date date, DateTime datetime) { this.productId = productId; this.nullableProductId = nullableProductId; this.someString = someString; this.price = price; this.maybePrice = maybePrice; this.date = date; this.datetime = datetime; }
public ClassWithMultipleConstructors(Id <Product> productId, string someString, decimal price, Date date, DateTime datetime) { this.productId = productId; this.nullableProductId = null; this.someString = someString; this.price = price; this.maybePrice = null; this.date = date; this.datetime = datetime; }
public override int GetHashCode() { var hash = base.GetHashCode(); hash ^= Readonly.GetHashCode(); hash ^= IntId.GetHashCode(); hash ^= UIntId.GetHashCode(); hash ^= LongId.GetHashCode(); hash ^= ULongId.GetHashCode(); hash ^= ShortId.GetHashCode(); hash ^= UShortId.GetHashCode(); hash ^= DoulbeId.GetHashCode(); hash ^= ByteId.GetHashCode(); hash ^= CharId.GetHashCode(); hash ^= SByteId.GetHashCode(); hash ^= CharRef.GetHashCode(); hash ^= ByteRef.GetHashCode(); hash ^= SByteRef.GetHashCode(); hash ^= Int16Id.GetHashCode(); hash ^= UInt16Id.GetHashCode(); hash ^= Int32Id.GetHashCode(); hash ^= UInt32Id.GetHashCode(); hash ^= Int64Id.GetHashCode(); hash ^= UInt64Id.GetHashCode(); hash ^= DateTime.GetHashCode(); hash ^= TitleEnum.GetHashCode(); hash ^= ATitleEnum.GetHashCode(); hash ^= FirstName.GetHashCode(); hash ^= LastName.GetHashCode(); hash ^= Bool.GetHashCode(); hash ^= BoolRef.GetHashCode(); if (Array != null) { hash ^= Array.GetHashCode(); } if (Enumerable != null) { hash ^= Enumerable.GetHashCode(); } if (Father != null) { hash ^= Father.GetHashCode(); } if (Mother != null) { hash ^= Mother.GetHashCode(); } if (Hidden != null) { hash ^= Hidden.GetHashCode(); } return(hash); }
public void OverloadsWorkCorrectly() { var id = 12L; var same1 = new LongId(id); var same2 = new LongId(id); var different = new LongId(3L); Assert.True(same1 == same2); Assert.False(same1 == different); Assert.False(same1 != same2); Assert.True(same1 != different); }
[U] public void NotEq() { LongId types = 3; LongId[] notEqual = { 4L, 4 }; foreach (var t in notEqual) { (t != types).ShouldBeTrue(t); t.Should().NotBe(types); } LongId l1 = 2, l2 = 3; (l1 != l2).ShouldBeTrue(l2); (l1 != 3).ShouldBeTrue(l1); l1.Should().NotBe(l2); l1.Should().NotBe(3); }
[U] public void Eq() { LongId types = 2; LongId[] equal = { 2L, 2 }; foreach (var t in equal) { (t == types).ShouldBeTrue(t); t.Should().Be(types); } LongId l1 = 2, l2 = 2; (l1 == l2).ShouldBeTrue(l2); (l1 == 2).ShouldBeTrue(l1); l1.Should().Be(l2); l1.Should().Be(2); }
public override int GetHashCode() { return(LongId.GetHashCode()); }