예제 #1
0
        public void Should_return_empty_dictionary_when_invalid_fields_parameters_passed(string invalidFields)
        {
            var validator = new FieldsValidator();

            var result = validator.GetValidFields(invalidFields, typeof(SimpleTypes));

            Assert.IsEmpty(result);
        }
예제 #2
0
        public void Should_return_dictionary_contains_valid_fields_without_underscores_when_valid_fields_parameters_passed(string validFields)
        {
            var validator = new FieldsValidator();

            var result = validator.GetValidFields(validFields, typeof(SimpleTypes));

            Assert.True(result.ContainsKey("firstproperty"));
        }
예제 #3
0
        public void Should_return_dictionary_with_valid_fields_when_valid_and_invalid_fields_parameters_passed(string mixedFields)
        {
            var validator = new FieldsValidator();

            var result = validator.GetValidFields(mixedFields, typeof(SimpleTypes));

            Assert.AreEqual(2, result.Count);
            Assert.True(result.ContainsKey("firstproperty"));
            Assert.True(result.ContainsKey("secondproperty"));
        }
        public void WhenValidFieldParameterPassed_ShouldReturnDictionaryContainingTheFieldWithoutUnderscores(string validField)
        {
            //Arange
            var cut = new FieldsValidator();

            //Act
            Dictionary <string, bool> result = cut.GetValidFields(validField, typeof(DummyObjectWithSimpleTypes));

            Assert.True(result.ContainsKey("firstproperty"));
        }
        public void WhenOnlyValidFieldsParameterPassed_ShouldReturnNonEmptyDictionary(string validFields)
        {
            //Arange
            var cut = new FieldsValidator();

            //Act
            Dictionary <string, bool> result = cut.GetValidFields(validFields, typeof(DummyObjectWithSimpleTypes));

            Assert.IsNotEmpty(result);
        }
        public void WhenInvalidFieldsWithSpecialSymbolsParameterPassed_ShouldReturnEmptyDictionary(string invalidFields)
        {
            //Arange
            var cut = new FieldsValidator();

            //Act
            Dictionary <string, bool> result = cut.GetValidFields(invalidFields, typeof(DummyObjectWithSimpleTypes));

            Assert.IsEmpty(result);
        }
        public void WhenValidFieldsParameterPassed_ShouldReturnDictionaryContainingEachValidFieldWithLowercase(string validFields)
        {
            //Arange
            var cut = new FieldsValidator();

            //Act
            Dictionary <string, bool> result = cut.GetValidFields(validFields, typeof(DummyObjectWithSimpleTypes));

            Assert.True(result.ContainsKey("firstproperty"));
            Assert.True(result.ContainsKey("secondproperty"));
        }
        public void WhenValidAndInvalidFieldsParameterPassed_ShouldReturnDictionaryWithValidFieldsOnly(string mixedFields)
        {
            //Arange
            var cut = new FieldsValidator();

            //Act
            Dictionary <string, bool> result = cut.GetValidFields(mixedFields, typeof(DummyObjectWithSimpleTypes));

            Assert.AreEqual(2, result.Count);
            Assert.True(result.ContainsKey("firstproperty"));
            Assert.True(result.ContainsKey("secondproperty"));
        }