private object GetObjectAtSection(JSection section, Type type) { var genericMethodInfo = this.GetType().GetMethod(nameof(Read), BindingFlags.Static | BindingFlags.NonPublic); var methodInfo = genericMethodInfo.MakeGenericMethod(type); return(methodInfo.Invoke(null, new object[] { section })); }
public JSection ConvertSection(XSection section, ParentObjectInfo parentInfo) { if (section.ID == null) { throw new Exception("Объект section не может быть преобразован в JSection"); } if (string.IsNullOrEmpty(parentInfo.CardVersion)) { throw new Exception("У секции " + section.Alias + " отсутствует версия (карточки)"); } if (parentInfo.CardLibID == null || parentInfo.CardLibID == Guid.Empty) { throw new Exception("У секции " + section.Alias + " отсутствует идентификатор библиотеки карточек"); } if (parentInfo.CardID == null || parentInfo.CardID == Guid.Empty) { throw new Exception("У секции " + section.Alias + " отсутствует идентификатор карточки"); } var version = new JSectionVersion { SystemVersion = parentInfo.SystemVersion, Version = parentInfo.CardVersion, Sections = section.Sections != null?section.Sections.Select(t => t.ID).ToArray() : new Guid[0], Fields = section.Fields != null?section.Fields.Select(t => t.ID).ToArray() : new Guid[0], }; if (section.Sections != null) { version.Sections = section.Sections.Select(t => t.ID).ToArray(); } var jSection = new JSection { ID = section.ID, Alias = section.Alias, CardLibID = parentInfo.CardLibID, CardID = parentInfo.CardID, Name = GetRuName(section.Names), ParentSectionID = parentInfo.SectionID, Versions = new List <JSectionVersion> { version } }; return(jSection); }
public void Setup() { _runner = MongoDbRunner.Start(); testData = JSectionReader.Section("AirTravel.json", Encoding.UTF8); }
public void AirTravelCollectionMongoDbSetUp() { travelCollection = new MongoClient(_connectionString).GetDatabase("testdb").GetCollection <AirTravel>("travel"); testData = JSectionReader.Section("AirTravel.json", Encoding.UTF8); }
public void Setup() { _runner = MongoDbRunner.Start(); mongoCollection = new MongoClient(_runner.ConnectionString).GetDatabase("testdb").GetCollection <Test>("testcollection"); testData = JSectionReader.Section("AirTravel.json", Encoding.UTF8); }
private static object Read <T>(JSection section) { var result = section.GetObject <T>(); return(result); }
public void Setup() { _runner = MongoDbRunner.Start(); testData = JSectionReader.Section("movieDetailsTestData.json", Encoding.UTF8); }