public void DocumentIdEqualityTest() { var docId11a = new DocumentId(11); var docId11b = new DocumentId(11); var docId21a = new DocumentId(21); Assert.True(docId11a == docId11b); Assert.False(docId11a != docId11b); Assert.False(docId11a == docId21a); Assert.True(docId11a != docId21a); Assert.True(docId11a.Equals(docId11b)); Assert.False(docId11a.Equals(docId21a)); var hashSet = new HashSet <DocumentId> { docId11a, docId11b, }; Assert.Single(hashSet); Assert.Contains(docId11b, hashSet); Assert.DoesNotContain(docId21a, hashSet); }
public void IntIdTests() { int value = 123; DocumentId id = value; (id == value).Should().BeTrue(); (id != value).Should().BeFalse(); id.Equals(value).Should().BeTrue(); id.Equals((object)value).Should().BeTrue(); }
public void StringIdTests() { string value = "MyId"; DocumentId id = value; (id == value).Should().BeTrue(); (id != value).Should().BeFalse(); id.Equals(value).Should().BeTrue(); id.Equals((object)value).Should().BeTrue(); }
public void GuidIdTests() { Guid value = Guid.NewGuid(); DocumentId id = value; (id == value).Should().BeTrue(); (id != value).Should().BeFalse(); id.Equals(value).Should().BeTrue(); id.Equals((object)value).Should().BeTrue(); }
public bool Equals(BuisnessMetadata other) { //Check whether the compared object is null. if (Object.ReferenceEquals(other, null)) { return(false); } //Check whether the compared object references the same data. if (Object.ReferenceEquals(this, other)) { return(true); } //Should be enought to compare equity return(Key.Equals(other.Key) && Value.Equals(other.Value) && DocumentId.Equals(other.DocumentId)); }
public EmailTemplate GetEmailTemplate(int id) { var emailTemplate = (EmailTemplate)entities.EmailTemplates.Where(DocumentId => DocumentId.Equals(id)); return(emailTemplate); }