From d47ad48113a132fc27640f2cad51a2836b55a630 Mon Sep 17 00:00:00 2001 From: Lukas Gasselsberger Date: Thu, 31 Mar 2022 21:34:01 +0200 Subject: [PATCH 1/3] Documentation: Update collections examples This refs and closes #1841 --- docs/_data/tips/collections.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/_data/tips/collections.yml b/docs/_data/tips/collections.yml index bb50b7d01e..741e4ff34b 100644 --- a/docs/_data/tips/collections.yml +++ b/docs/_data/tips/collections.yml @@ -179,6 +179,18 @@ new-message: | Expected collection to contain a single item, but found {"", "", ""}. +- old: | + actual.Any(item => typeof(string).IsAssignableFrom(item.GetType())).Should().BeTrue(); + + new: | + actual.Should().ContainItemsAssignableTo(); + + old-message: | + Expected True, but found False. + + new-message: | + Expected collection to contain at least one element assignable to type "System.String", but found {System.Int32}. + - old: | actual.Should().HaveCount(0); From 5af27e3db832b530c19b3c7099972fca5b4b761c Mon Sep 17 00:00:00 2001 From: Lukas Gasselsberger Date: Sat, 2 Apr 2022 01:25:05 +0200 Subject: [PATCH 2/3] Review: fix documentation --- docs/_data/mstest-migration/collectionAssert.yml | 2 +- docs/_data/tips/collections.yml | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/docs/_data/mstest-migration/collectionAssert.yml b/docs/_data/mstest-migration/collectionAssert.yml index ec46322aaa..48db781861 100644 --- a/docs/_data/mstest-migration/collectionAssert.yml +++ b/docs/_data/mstest-migration/collectionAssert.yml @@ -128,6 +128,6 @@ CollectionAssert.AllItemsAreInstancesOfType failed. Element at index 0 is not of expected type. Expected type:. Actual type:. new-message: | - Expected collection to contain only items of type UnitTests2.MyIdenticalClass, but item SomeProperty: 1, OtherProperty: item at index 0 is of type UnitTests2.MyClass. + Expected collection to contain at least one element assignable to type "T", but found {System.Int32}. diff --git a/docs/_data/tips/collections.yml b/docs/_data/tips/collections.yml index 741e4ff34b..bb50b7d01e 100644 --- a/docs/_data/tips/collections.yml +++ b/docs/_data/tips/collections.yml @@ -179,18 +179,6 @@ new-message: | Expected collection to contain a single item, but found {"", "", ""}. -- old: | - actual.Any(item => typeof(string).IsAssignableFrom(item.GetType())).Should().BeTrue(); - - new: | - actual.Should().ContainItemsAssignableTo(); - - old-message: | - Expected True, but found False. - - new-message: | - Expected collection to contain at least one element assignable to type "System.String", but found {System.Int32}. - - old: | actual.Should().HaveCount(0); From 0c6a3a3ece2b88cf5b823731c9aa8ed62bb292e9 Mon Sep 17 00:00:00 2001 From: Lukas Gasselsberger Date: Sat, 2 Apr 2022 20:50:50 +0200 Subject: [PATCH 3/3] Review: Now add the correct failure message --- docs/_data/mstest-migration/collectionAssert.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_data/mstest-migration/collectionAssert.yml b/docs/_data/mstest-migration/collectionAssert.yml index 48db781861..4d46e8e29b 100644 --- a/docs/_data/mstest-migration/collectionAssert.yml +++ b/docs/_data/mstest-migration/collectionAssert.yml @@ -122,12 +122,12 @@ CollectionAssert.AllItemsAreInstancesOfType(actual, typeof(T)); new: | - actual.Should().ContainItemsAssignableTo(); + actual.Should().AllBeAssignableTo(); old-message: | CollectionAssert.AllItemsAreInstancesOfType failed. Element at index 0 is not of expected type. Expected type:. Actual type:. new-message: | - Expected collection to contain at least one element assignable to type "T", but found {System.Int32}. + Expected type to be "T", but found [System.String],