Example #1
0
        public void FieldInfoT_ShouldThrowIfFieldNotInClass()
        {
            //Arrange
            ValidationInfo subject = new ValidationInfo("_nameHere", typeof(string));

            //Act
            Action actual = () => subject.FieldInfo <ExampleChild>();

            //Assert
            actual.Should().Throw <AsserterException>().WithMessage("Expected field [name=_nameHere] to be of [type=String] but a field [name=_nameHere] was not found.");
        }
Example #2
0
        public void FieldInfo_ShouldThrowIfFieldNotFound()
        {
            //Arrange
            ValidationInfo subject = new ValidationInfo("_notFound", typeof(string));

            //Act
            Action actual = () => subject.FieldInfo(new Example("blort"));

            //Assert
            actual.Should().Throw <AsserterException>().WithMessage("Expected field [name=_notFound] to be of [type=String] but a field [name=_notFound] was not found.");
        }
Example #3
0
        public void FieldInfoT_ShouldThrowIfFieldNotFound()
        {
            //Arrange
            ValidationInfo subject = new ValidationInfo("_notFound", typeof(string));

            //Act
            Action actual = () => subject.FieldInfo <Example>();

            //Assert
            actual.Should().Throw <Exception>().WithMessage("Expected [name=_notFound] to be of [type=String] but found null");
        }
Example #4
0
        public void FieldInfoT_ShouldReturnFieldsInfo()
        {
            //Arrange
            ValidationInfo subject = new ValidationInfo("_nameHere", typeof(string));

            //Act
            FieldInfo actual = subject.FieldInfo <Example>();

            //Assert
            actual.Should().NotBeNull();
            actual.Name.Should().Be("_nameHere");
        }