Dummy class for unit testing purpose.
Inheritance: Person
 public void InheritsFromWorksAlsoWithTheSameType()
 {
     var child = new Child { Name = "Telemachus" };
     Check.That(child).InheritsFrom<Child>();
 }
 public void WeCanSeeTheDifferenceBewteenTwoDifferentObjectsThatHaveTheSameToString()
 {
     Person dad = new Person { Name = "John" };
     Person son = new Child { Name = "John" };
     Check.That(son).IsEqualTo(dad);
 }
 public void InheritsFromWorks()
 {
     var child = new Child { Name = "Telemachus" };
     Check.That(child).InheritsFrom<Person>();
 }
 public void IsInstanceOfThrowsExceptionWithDerivedTypeAsCheckedExpression()
 {
     var child = new Child { Name = "Telemachus" };
     Check.That(child).IsInstanceOf<Person>();
 }
Example #5
0
        public void IsInstanceOfThrowsExceptionWithDerivedTypeAsCheckedExpression()
        {
            var child = new Child { Name = "Telemachus" };

            Check.ThatCode(() =>
            {
                Check.That(child).IsInstanceOf<Person>();
            })
            .Throws<FluentCheckException>()
            .WithMessage(Environment.NewLine+ "The checked value is not an instance of the expected type." + Environment.NewLine + "The checked value:" + Environment.NewLine + "\t[Telemachus] of type: [NFluent.Tests.Child]" + Environment.NewLine + "The expected value:" + Environment.NewLine + "\tan instance of type: [NFluent.Tests.Person]");
        }
Example #6
0
        public void WeCanSeeTheDifferenceBewteenTwoDifferentObjectsThatHaveTheSameToString()
        {
            Person dad = new Person { Name = "John" };
            Person son = new Child { Name = "John" };

            Check.ThatCode(() =>
            {
                Check.That(son).IsEqualTo(dad);
            })
            .Throws<FluentCheckException>()
            .WithMessage(Environment.NewLine+ "The checked value is different from the expected one." + Environment.NewLine + "The checked value:" + Environment.NewLine + "\t[John] of type: [NFluent.Tests.Child]" + Environment.NewLine + "The expected value:" + Environment.NewLine + "\t[John] of type: [NFluent.Tests.Person]");
        }
Example #7
0
namespace NFluent.Tests