MatchingPropertiesAreEqual_WhenGivenTwoObjects_ShouldCompareSameNamedPropertiesAndThrowIfTheyDoNotMatchValue() { //---------------Set up test pack------------------- var v1 = GetRandomString(); var v2 = GetRandomInt(); var v3 = GetRandomDate(); var obj1 = new { v1, v2, v3 }; var obj2 = new { v1 = v1 + " ", v2, v3, v4 = GetRandomBoolean() }; //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- Expect(() => PropertyAssert.AreIntersectionEqual(obj1, obj2)) .To.Throw <AssertionException>(); //---------------Test Result ----------------------- }
public void IntersectionEquals_ShouldBeAbleToCompare_ICollection_And_IEnumerable() { //--------------- Arrange ------------------- var dataSource = new[] { "1", "a", "%" }; var collection = new Collection <string>(dataSource); var enumerable = dataSource.AsEnumerable(); var left = new HasCollectionOfStuff { Stuff = collection }; var right = new HasEnumerableStuff { Stuff = enumerable }; Assert.IsTrue(left.Stuff.GetType().ImplementsEnumerableGenericType()); Assert.IsTrue(right.Stuff.GetType().ImplementsEnumerableGenericType()); //--------------- Assume ---------------- //--------------- Act ---------------------- PropertyAssert.AreIntersectionEqual(left, right); //--------------- Assert ----------------------- }