public void Interface_Layouts_Correct(InterfaceInfo info) { var winmdInterface = WinmdTestUtils.GetInterfaceInfo(this.typeSystem, info.Name); var jsonText = Newtonsoft.Json.JsonConvert.SerializeObject(winmdInterface, formatting: Newtonsoft.Json.Formatting.Indented); System.Diagnostics.Debug.WriteLine($"Read {info.Name} from winmd as:\n{jsonText}"); Assert.Equal(info.Name, winmdInterface.Name); Assert.Equal(info.Methods.Length, winmdInterface.Methods.Length); for (int i = 0; i < winmdInterface.Methods.Length; i++) { Assert.Equal(info.Methods[i], winmdInterface.Methods[i]); } }
public static InterfaceInfo GetInterfaceInfo(DecompilerTypeSystem typeSystem, string typeName) { var type = DecompilerUtils.GetSelfDefinedWinmdToplevelTypes(typeSystem).Where(t => t.Kind == TypeKind.Interface && t.Name == typeName).Single(); InterfaceInfo ret = new InterfaceInfo() { Name = type.Name }; List <string> protoTypes = new List <string>(); foreach (IMethod method in type.Methods) { protoTypes.Add(GetMethodPrototype(method)); } ret.Methods = protoTypes.ToArray(); return(ret); }