public void It_should_be_invalid_after_initialization_and_setting_only_attributes()
        {
            var dataMapping = new DataMapping();

            dataMapping.Attributes.Add("Span");
            dataMapping.Attributes.Add("Shape");
            dataMapping.Attributes.Add(CategoryAttribute);

            Assert.That(dataMapping.IsValid(), Is.False);
        }
        public void It_should_be_valid_after_initialization_and_setting_only_attributes_and_category()
        {
            var dataMapping = new DataMapping();

            dataMapping.Attributes.Add("Span");
            dataMapping.Attributes.Add("Shape");
            dataMapping.Attributes.Add(CategoryAttribute);

            dataMapping.Category = CategoryAttribute;

            Assert.That(dataMapping.IsValid(), Is.True);
            Assert.That(dataMapping.Delimiter, Is.EqualTo(DataMapping.DefaultDelimiter));
        }
        public void It_should_be_invalid_after_initialization_and_setting_attributes_and__invalid_category_and_delimiter()
        {
            var dataMapping = new DataMapping();

            dataMapping.Attributes.Add("Span");
            dataMapping.Attributes.Add("Shape");
            dataMapping.Attributes.Add(CategoryAttribute);

            dataMapping.Category = "invalidcategory";
            dataMapping.Delimiter = ";";

            Assert.That(dataMapping.IsValid(), Is.False);
        }
        private DataTransformator(string dataMappingFileName)
        {
            try
            {
                _dataMapping = DataSerializer.Deserialize<DataMapping>(dataMappingFileName);
            }
            catch (Exception e)
            {
                var exceptionMessage = String.Format("Unable to open data file: {0}\n{1}", dataMappingFileName, e);
                throw new DataTransformationException(exceptionMessage);
            }

            if (_dataMapping.IsValid())
                return;

            var validationMessage = String.Format("Data mapping file is invalid: {0}\n", dataMappingFileName);
            throw new DataTransformationException(validationMessage);
        }
        public void It_should_be_invalid_after_initialization()
        {
            var dataMapping = new DataMapping();

            Assert.That(dataMapping.IsValid(), Is.False);
        }
        private static DataMapping GetValidDataMapping()
        {
            var dataMapping = new DataMapping();

            dataMapping.Attributes.Add("Span");
            dataMapping.Attributes.Add("Shape");
            dataMapping.Attributes.Add(CategoryAttribute);

            dataMapping.Category = CategoryAttribute;
            dataMapping.Delimiter = " ";
            return dataMapping;
        }