예제 #1
0
        public void SupportsFileFoundOnNamespacePathSettings()
        {
            var reader = new JsonFileCommandReader(GetFromFile());
            var result = reader.GetCommand(typeof(TypeB), "SupportsFileFoundOnNamespacePathSettings");

            NotNull(result);
        }
예제 #2
0
        public void Successfully()
        {
            var reader = new JsonFileCommandReader(GetFromFile());
            var result = reader.GetCommand(typeof(GetCommand), "ExplicitKey");

            NotNull(result);
        }
예제 #3
0
        public void SupportsFileFoundOnRelativeDownPathWithoutNamespaceSettingPath()
        {
            var reader = new JsonFileCommandReader(GetFromFile());
            var result = reader.GetCommand(typeof(TypeJ), "SupportsFileFoundOnRelativeDownPath");

            NotNull(result);
        }
예제 #4
0
        public void SupportsSingleLevelNamespace()
        {
            var reader = new JsonFileCommandReader(GetFromFile());
            var result = reader.GetCommand(typeof(TypeD), "SupportsSingleLevelNamespace");

            NotNull(result);
            Equal("select 'TypeD';", result.CommandText);
        }
예제 #5
0
        public void FallsBackToNamespaceForTypeSettings()
        {
            var reader = new JsonFileCommandReader(GetFromFile());
            var result = reader.GetCommand(typeof(TypeA), "FallsBackToNamespace");

            NotNull(result);
            Equal("select 'TypeA';", result.CommandText);
        }
예제 #6
0
        /// <summary>
        /// Creates an instance of the IDbCommander, similar to how you might
        /// from an IoC framework.
        /// </summary>
        /// <returns></returns>
        public static IDbCommander CreateCommander()
        {
            var settings  = JsonConvert.DeserializeObject <Settings>(File.ReadAllText("Drapper.Settings.json"));
            var reader    = new JsonFileCommandReader(settings);
            var connector = new DbConnector(settings);

            return(new DbCommander(connector, reader));
        }
예제 #7
0
 public void UnknownKeyThrowsArgumentNullException()
 {
     var reader = new JsonFileCommandReader(GetFromFile());
     var result = Throws <ArgumentNullException>(() => reader.GetCommand(typeof(GetCommand), "Unknown"));
 }
예제 #8
0
 public void NullKeyArgumentThrowsArgumentNullException()
 {
     var reader = new JsonFileCommandReader(GetFromFile());
     var result = Throws <ArgumentNullException>(() => reader.GetCommand(typeof(GetCommand), null));
 }
예제 #9
0
 public void NullTypeArgumentThrowsArgumentNullException()
 {
     var reader = new JsonFileCommandReader(GetFromFile());
     var result = Throws <ArgumentNullException>(() => reader.GetCommand(null, "ExplicitKey"));
 }
예제 #10
0
 public void LeadingCharactersThrowsFileNotFoundException()
 {
     var reader = new JsonFileCommandReader(GetFromFile());
     var result = Throws <FileNotFoundException>(() => reader.GetCommand(typeof(TypeK), "LeadingCharactersThrowsException"));
 }