This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static string ToString(IContainer container, IFieldType field, Type toResolve, int deep) => | |
toResolve.IsAssignableTo<IComplexGraphType>() | |
? ToStringAsField(container, field, toResolve, deep, FieldFormat) | |
: ToStringAsUnion(container, field, toResolve, deep); | |
private static string FormatWithPropertiesForUnions(IContainer container, IFieldType field, Type toResolve, int deep) | |
{ | |
var unionTypes = (UnionGraphType) container.Resolve(toResolve); | |
var unions = unionTypes.Types | |
.Select(type => FormatAsField(container, field, type, deep, UnionFormat)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class QueryTest | |
{ | |
public readonly string Name; | |
public readonly string Arguments; | |
public readonly IEnumerable<string> Fields; | |
public QueryTest(string name, string arguments, IEnumerable<string> fields) | |
{ | |
this.Name = name; | |
this.Arguments = arguments; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static QueryTest BuildQuery(string type, TArguments args, IEnumerable<string> fields) | |
{ | |
var arguments = args == null ? "" : GetArguments(args); | |
var query = $"{{{type}{arguments}{{{string.Join(' ', fields)}}}}}"; | |
return new QueryTest(query); | |
} | |
private static string GetArguments(TArguments args) | |
{ | |
var values = args.GetType() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
${ | |
using Typewriter.Extensions.WebApi; | |
using System.Text.RegularExpressions; | |
const string ContractPrefix = "App.Contract"; | |
static string[] NotIncluedeControllers = new []{"Excel", "Diagnostics", "Download"}; | |
string FileNameFromType(string fullName) { | |
var fullNameWithoutGenericParameter = Regex.Replace(fullName, @" ?\<.*?\>", string.Empty); | |
return fullNameWithoutGenericParameter | |
.Split(new string[]{ContractPrefix}, StringSplitOptions.None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const string ContractPrefix = "App.Contract"; | |
string ImportStatements(Class @class) | |
{ | |
var otherTypesInFile = new List<Type>() | |
.Concat(@class.Methods.Select(x => x.Type)) | |
.Concat(@class.Methods.SelectMany(x => x.Type.TypeArguments)) | |
.Concat(@class.Methods.SelectMany(x => x.Parameters).Select(x => x.Type)) | |
.Concat(@class.Methods.SelectMany(x => x.Parameters).SelectMany(x => x.Type.TypeArguments)) | |
.SelectMany(GetTypes) | |
.ToList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open FSharp.Data | |
type packages = XmlProvider<"""<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<package id="Machine.Fakes.RhinoMocks" version="2.3.0" targetFramework="net462" /> | |
<package id="Machine.Specifications" version="0.9.3" targetFramework="net462" /> | |
<package id="Machine.Specifications.Should" version="0.7.2" targetFramework="net462" /> | |
<package id="RhinoMocks" version="3.6.1" targetFramework="net462" /> | |
</packages>"""> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type CsvParser(path: string) = | |
let _path = path | |
let index(headers: string[] option, column) = headers.Value |> Seq.findIndex (fun k -> k = column) | |
let getValuesFor(func) = | |
use data = CsvFile.Load(_path) | |
data.Rows | |
|> Seq.map(fun x -> func(data.Headers, x)) | |
|> Seq.toArray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type CsvParser(path: string) = | |
let _path = path | |
let index(headers: string[] option, column) = headers.Value |> Seq.findIndex (fun k -> k = column) | |
let getValuesFor(func) = | |
use data = CsvFile.Load(_path) | |
data.Rows | |
|> Seq.map(fun x -> func(data.Headers, x)) | |
|> Seq.toArray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type CsvParserType = CsvProvider<"base.csv", IgnoreErrors=true> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<Literal>] | |
let schema = "Column 1 (float),Column 2 (string),Date (DateTime option)" | |
type CsvParserType = CsvProvider<"base.csv", schema=schema> |
NewerOlder