예제 #1
0
        public void GivenValidAddExtendedQueryTagEntry_WhenValidating_ShouldSucced()
        {
            AddExtendedQueryTagEntry addExtendedQueryTagEntry = new AddExtendedQueryTagEntry()
            {
                Path = "00101001", Level = "Study"
            };
            var validationContext = new ValidationContext(addExtendedQueryTagEntry);
            IEnumerable <ValidationResult> results = addExtendedQueryTagEntry.Validate(validationContext);

            Assert.Empty(results);
        }
예제 #2
0
        public void GivenInvalidLevel_WhenValidating_ResultShouldHaveExceptions()
        {
            AddExtendedQueryTagEntry addExtendedQueryTagEntry = new AddExtendedQueryTagEntry()
            {
                Path = "00101001", Level = "Studys"
            };
            var validationContext = new ValidationContext(addExtendedQueryTagEntry);
            IEnumerable <ValidationResult> results = addExtendedQueryTagEntry.Validate(validationContext);

            Assert.Single(results);
            Assert.Equal("Input Dicom Tag Level 'Studys' is invalid. It must have value 'Study', 'Series' or 'Instance'.", results.First().ErrorMessage);
        }
예제 #3
0
        public void GivenInvalidPath_WhenValidating_ResultShouldHaveExceptions(string pathValue)
        {
            AddExtendedQueryTagEntry addExtendedQueryTagEntry = new AddExtendedQueryTagEntry()
            {
                Path = pathValue, Level = "Study"
            };
            var validationContext = new ValidationContext(addExtendedQueryTagEntry);
            IEnumerable <ValidationResult> results = addExtendedQueryTagEntry.Validate(validationContext);

            Assert.Single(results);
            Assert.Equal("The Dicom Tag Property Path must be specified and must not be null, empty or whitespace.", results.First().ErrorMessage);
        }
        public void GivenEmptyNullOrWhitespaceLevel_WhenValidating_ResultShouldHaveExceptions()
        {
            AddExtendedQueryTagEntry addExtendedQueryTagEntry = new AddExtendedQueryTagEntry()
            {
                Path = "00101001", Level = null
            };
            var validationContext = new ValidationContext(addExtendedQueryTagEntry);
            IEnumerable <ValidationResult> results = addExtendedQueryTagEntry.Validate(validationContext);

            Assert.Collection(
                results,
                item => Assert.Equal("The Dicom Tag Property Level must be specified and must not be null, empty or whitespace.", item.ErrorMessage));
        }
예제 #5
0
        public void GivenEmptyNullOrWhitespaceLevel_WhenValidating_ResultShouldHaveExceptions(string levelValue)
        {
            AddExtendedQueryTagEntry addExtendedQueryTagEntry = new AddExtendedQueryTagEntry()
            {
                Path = "00101001", Level = levelValue
            };
            var validationContext = new ValidationContext(addExtendedQueryTagEntry);
            IEnumerable <ValidationResult> results = addExtendedQueryTagEntry.Validate(validationContext);

            Assert.Collection(
                results,
                item => Assert.Equal("The Dicom Tag Property Level must be specified and must not be null, empty or whitespace.", item.ErrorMessage),
                item => Assert.Equal(string.Format("Input Dicom Tag Level '{0}' is invalid. It must have value 'Study', 'Series' or 'Instance'.", levelValue), item.ErrorMessage)
                );
        }