public void SupportsFileFoundOnNamespacePathSettings() { var reader = new JsonFileCommandReader(GetFromFile()); var result = reader.GetCommand(typeof(TypeB), "SupportsFileFoundOnNamespacePathSettings"); NotNull(result); }
public void Successfully() { var reader = new JsonFileCommandReader(GetFromFile()); var result = reader.GetCommand(typeof(GetCommand), "ExplicitKey"); NotNull(result); }
public void SupportsFileFoundOnRelativeDownPathWithoutNamespaceSettingPath() { var reader = new JsonFileCommandReader(GetFromFile()); var result = reader.GetCommand(typeof(TypeJ), "SupportsFileFoundOnRelativeDownPath"); NotNull(result); }
public void SupportsSingleLevelNamespace() { var reader = new JsonFileCommandReader(GetFromFile()); var result = reader.GetCommand(typeof(TypeD), "SupportsSingleLevelNamespace"); NotNull(result); Equal("select 'TypeD';", result.CommandText); }
public void FallsBackToNamespaceForTypeSettings() { var reader = new JsonFileCommandReader(GetFromFile()); var result = reader.GetCommand(typeof(TypeA), "FallsBackToNamespace"); NotNull(result); Equal("select 'TypeA';", result.CommandText); }
/// <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)); }
public void UnknownKeyThrowsArgumentNullException() { var reader = new JsonFileCommandReader(GetFromFile()); var result = Throws <ArgumentNullException>(() => reader.GetCommand(typeof(GetCommand), "Unknown")); }
public void NullKeyArgumentThrowsArgumentNullException() { var reader = new JsonFileCommandReader(GetFromFile()); var result = Throws <ArgumentNullException>(() => reader.GetCommand(typeof(GetCommand), null)); }
public void NullTypeArgumentThrowsArgumentNullException() { var reader = new JsonFileCommandReader(GetFromFile()); var result = Throws <ArgumentNullException>(() => reader.GetCommand(null, "ExplicitKey")); }
public void LeadingCharactersThrowsFileNotFoundException() { var reader = new JsonFileCommandReader(GetFromFile()); var result = Throws <FileNotFoundException>(() => reader.GetCommand(typeof(TypeK), "LeadingCharactersThrowsException")); }