System.Type Assertions

		private class B { }

		[Serializable]
		private class D1 : B { }

		private interface ID2 { }
		private class D2 : D1, ID2 { }


			var actual = typeof (D1);

			actual.Should().Be.EqualTo<D1>();
			actual.Should().Be.Null();
			actual.Should().Be.SubClassOf<B>();
			actual.Should().Be.AssignableFrom<D2>();
			actual.Should().Be.AssignableTo<B>();
			actual.Should().Have.Attribute<SerializableAttribute>();

Examples with negation and chain

			typeof(D1).Should().Not.Be.SubClassOf<D2>();
			typeof(D1).Should().Not.Be.AssignableFrom<B>();

			typeof(D1).Should().Not.Be.Null()
				.And.Not.Be.EqualTo<B>();

Last edited Oct 29, 2009 at 1:14 PM by fabiomaulo, version 2

Comments

No comments yet.