Exemplo n.º 1
0
        public void TestValidateClassThrowsContractException()
        {
            var sut = new BaseDtoImplementation1
            {
                RequiredStringProperty1 = "arbitrary-value"
            };

            sut.Validate("RequiredStringProperty2");
        }
Exemplo n.º 2
0
        public void TestValidateSinglePropertySucceeds()
        {
            var sut = new BaseDtoImplementation1
            {
                RequiredStringProperty1 = "arbitrary-value"
            };

            sut.Validate("RequiredStringProperty1");
        }
Exemplo n.º 3
0
        public void TestGetValidationResultsSinglePropertyAndValueSucceeds()
        {
            var sut = new BaseDtoImplementation1
            {
                RequiredStringProperty1 = "arbitrary-value"
            };

            var validationResults2 = sut.GetValidationResults("RequiredStringProperty2", null);

            Assert.AreEqual(1, validationResults2.Count);
        }
Exemplo n.º 4
0
        public void TestGetErrorMessagesSinglePropertyAndValueSucceeds()
        {
            var sut = new BaseDtoImplementation1
            {
                RequiredStringProperty1 = "arbitrary-value"
            };

            var errorMessages2 = sut.GetErrorMessages("RequiredStringProperty2", null);

            Assert.AreEqual(1, errorMessages2.Count);
        }
Exemplo n.º 5
0
        public void TestIsValidSinglePropertyAndValueSucceeds()
        {
            var sut = new BaseDtoImplementation1
            {
                RequiredStringProperty1 = "arbitrary-value"
            };

            var isValidProperty2 = sut.IsValid("RequiredStringProperty2", null);

            Assert.IsFalse(isValidProperty2);
        }
Exemplo n.º 6
0
        public void TestIsValidSinglePropertySucceeds()
        {
            var sut = new BaseDtoImplementation1
            {
                RequiredStringProperty1 = "arbitrary-value"
            };

            var isValidProperty1 = sut.IsValid("RequiredStringProperty1");

            Assert.IsTrue(isValidProperty1);

            var isValidProperty2 = sut.IsValid("RequiredStringProperty2");

            Assert.IsFalse(isValidProperty2);

            var isValidClass = sut.IsValid();

            Assert.IsFalse(isValidClass);
        }