Пример #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.");
        }
Пример #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.");
        }
Пример #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");
        }
Пример #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");
        }