Strings Assertions

			string actual;
			
			actual.Should().Be.EqualTo("a");
			actual.Should().Be.Empty();
			actual.Should().Be.Null();
			actual.Should().Be.NullOrEmpty();
			actual.Should().Contain("some");
			actual.Should().StartWith("some");
			actual.Should().EndWith("ing");
			actual.Should().Match("ome[tT]h");

			var re = new Regex("a.b", RegexOptions.Singleline | RegexOptions.IgnoreCase);
			"a\nb".Should().Match(re);

Examples with negation and chain

			string something = "something";

			something.Should()
				.StartWith("so")
				.And
				.EndWith("ing")
				.And
				.Contain("meth");

			something.Should()
				.StartWith("so")
				.And
				.EndWith("ing")
				.And
				.Not.Contain("body");

			something.Should()
				.Not.StartWith("ing")
				.And
				.Not.EndWith("so")
				.And
				.Not.Contain("body");

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

Comments

No comments yet.