コード例 #1
0
 // we're expecting an array of values that I can map to a Vehicle
 // as a note for checking against the provided file, I may need to amend this function to further validate the data.
 public Vehicle Construct(string[] values)
 {
     return(new Vehicle
     {
         Registration = values[0],
         Make = values[1],
         Model = values[2],
         Colour = values[3],
         FuelType = FuelTypeValidator.Validate(values[4])
     });
 }
コード例 #2
0
        public void ShouldReturnElectric()
        {
            var valueToCheck = "eclectic";
            var expected     = new FuelType
            {
                Key           = "Electric",
                OriginalValue = valueToCheck
            };

            var result = FuelTypeValidator.Validate(valueToCheck);

            Assert.AreEqual(expected.Key, result.Key);
            Assert.AreEqual(expected.OriginalValue, result.OriginalValue);
        }
コード例 #3
0
        public void ShouldReturnHybrid()
        {
            var valueToCheck = "hybd";
            var expected     = new FuelType
            {
                Key           = "Hybrid",
                OriginalValue = valueToCheck
            };

            var result = FuelTypeValidator.Validate(valueToCheck);

            Assert.AreEqual(expected.Key, result.Key);
            Assert.AreEqual(expected.OriginalValue, result.OriginalValue);
        }
コード例 #4
0
        public void ShouldReturnDiesel()
        {
            var valueToCheck = "daesal";
            var expected     = new FuelType
            {
                Key           = "Diesel",
                OriginalValue = valueToCheck
            };

            var result = FuelTypeValidator.Validate(valueToCheck);

            Assert.AreEqual(expected.Key, result.Key);
            Assert.AreEqual(expected.OriginalValue, result.OriginalValue);
        }