public void TestInitialize() { apicon = new APIContext(); xRep = new xRepository(apicon); controller = new relevantController(cRep); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); update = new relevantFactoryModel(); }
/// <summary> /// 条件编译符(Condition Complier):#if ... #elif ... #endif:编译时就选择哪一条语句编译 /// </summary> /// <param name="args"></param> public static void Main1(string[] args) { #if word Console.WriteLine("This is XML."); #else Console.WriteLine("This is Memory."); #endif #if XML // 条件编译符:使用时可以在 using 前面写 #define XML 来选择编译那条语句(但是这种写法需要修改源码):这种写法的作用域为当前文件 // 或者选择编辑项目属性,在生成 -> 常规 -> 条件编译和符号中填写 XML 或者 Memory(这种写法如果需要更换选择则需要重新编译项目):这种写法的作用域是整个项目 IRepoistory <Arcticle> repo = new XArticleRepository <Arcticle>(); #elif Memory IRepoistory <Arcticle> repo = new XRepository <Arcticle>(); #endif }