예제 #1
0
 public void ConvertingWithWrongFormatShouldCauseException()
 {
     var converter = new DebugLevelConverter();
     var firstValue = DebugLevel.BoundingBoxes;
     var secondValue = DebugLevel.BoundingSpheres;
     var mergedValuesAsString = string.Format("{0}&{1}", firstValue, secondValue);
     converter.ConvertFrom(null, CultureInfo.InvariantCulture, mergedValuesAsString);
 }
예제 #2
0
 public void ConvertingSingleValueShouldReturnOnlyThatValueSet()
 {
     var converter = new DebugLevelConverter();
     var expected = DebugLevel.BoundingBoxes;
     var valueAsString = expected.ToString();
     var converted = converter.ConvertFrom(null, CultureInfo.InvariantCulture, valueAsString);
     Assert.That(converted, Is.EqualTo(expected));
 }
예제 #3
0
        public void ConvertingMultipleValuesShouldReturnAllValuesSet()
        {
            var converter = new DebugLevelConverter();
            var firstValue = DebugLevel.BoundingBoxes;
            var secondValue = DebugLevel.BoundingSpheres;
            var mergedValuesAsString = string.Format("{0}|{1}", firstValue, secondValue);
            var converted = (DebugLevel)converter.ConvertFrom(null, CultureInfo.InvariantCulture, mergedValuesAsString);

            Assert.That(converted & firstValue, Is.EqualTo(firstValue));
            Assert.That(converted & secondValue, Is.EqualTo(secondValue));
        }
예제 #4
0
 public void ConvertingWithInvalidValuesShouldCauseException()
 {
     var converter = new DebugLevelConverter();
     var valuesAsString = "Something|SomethingElse";
     converter.ConvertFrom(null, CultureInfo.InvariantCulture, valuesAsString);
 }
예제 #5
0
 public void ConverterShouldBeAbleToConvertToDebugLevel()
 {
     var converter = new DebugLevelConverter();
     var canConvert = converter.CanConvertTo(null, typeof(DebugLevel));
     Assert.That(canConvert, Is.True);
 }
예제 #6
0
 public void ConverterShouldBeAbleToConvertFromString()
 {
     var converter = new DebugLevelConverter();
     var canConvert = converter.CanConvertFrom(null, typeof (string));
     Assert.That(canConvert,Is.True);
 }