public static void GetAll_Should_Return_New_Instance_Of_TestPage() { var helper = new TypeScanIndexableTypeMapperResolver(); var indexableTypeMappers = helper.GetAll().ToList(); Assert.Equal(1, indexableTypeMappers.Count); Assert.Equal(typeof(TestPage), indexableTypeMappers[0].GetType()); }
public static void TestPage_Type_Mapping_Should_Create_Index_And_Return_IsValid() { var elasticClient = new ElasticClient(new Uri("http://localhost:9200")); var helper = new TypeScanIndexableTypeMapperResolver(); var indexableTypeMappers = helper.GetAll().ToList(); var typeMapper = indexableTypeMappers.First(); var typeMapping = typeMapper.CreateTypeMapping(new CultureInfo("en")); var typeName = typeMapper.TypeName; var mappingsDescriptor = new MappingsDescriptor(); mappingsDescriptor.Map<IIndexablePageData>(typeName, x => typeMapping); var createIndexResponse = elasticClient.CreateIndex("site_en_1", x => x.Mappings(m => mappingsDescriptor)); Assert.Equal(true, createIndexResponse.IsValid); Assert.Equal(true, createIndexResponse.Acknowledged); }