private void InitializeMockObjects() { _mocks.GetOrAdd(typeof(VesselTarget), (type) => { var constructor = type.GetConstructor( BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(Vessel), typeof(SharedObjects) }, null); Structure obj = (Structure)constructor.Invoke(new object[] { null, new SharedObjects() }); if (obj == null) { Console.Error.WriteLine("Failed to create mock object for " + type.ToString()); } else { obj.HasSuffix("TYPENAME"); } return(obj); }); _mocks.GetOrAdd(typeof(BodyTarget), (type) => { var constructor = type.GetConstructor( BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(CelestialBody), typeof(SharedObjects) }, null); Structure obj = (Structure)constructor.Invoke(new object[] { null, new SharedObjects() }); if (obj == null) { Console.Error.WriteLine("Failed to create mock for " + type.ToString()); } return(obj); }); _mocks.GetOrAdd(typeof(kOS.Suffixed.Vector), (type) => { var obj = new kOS.Suffixed.Vector(); obj.HasSuffix("TYPENAME"); // force suffix initialization return(obj); }); _mocks.GetOrAdd(typeof(OrbitableVelocity), (type) => { return(new OrbitableVelocity((Vector)null, (Vector)null)); }); _mocks.GetOrAdd(typeof(KUniverseValue), (type) => { return(new KUniverseValue(new SharedObjects())); }); _mocks.GetOrAdd(typeof(OrbitInfo), (type) => { return(new OrbitInfo()); }); _mocks.GetOrAdd(typeof(StringValue), (type) => { var obj = new StringValue(""); obj.HasSuffix("TYPENAME"); // force suffix initialization return(obj); }); _mocks.GetOrAdd(typeof(VesselAlt), (type) => { return(new VesselAlt(new SharedObjects())); }); _mocks.GetOrAdd(typeof(Node), (type) => { return(new Node(0.0, 0.0, 0.0, 0.0, new SharedObjects())); }); _mocks.GetOrAdd(typeof(Suffixed.TimeSpan), (type) => { return(new Suffixed.TimeSpan(0.0)); }); _mocks.GetOrAdd(typeof(VesselEta), (type) => { return(new VesselEta(new SharedObjects())); }); _mocks.GetOrAdd(typeof(kOS.Core), (type) => { return(new Core(null, new SharedObjects())); }); _mocks.GetOrAdd(typeof(HomeConnection), (type) => { return(new HomeConnection(new SharedObjects())); }); _mocks.GetOrAdd(typeof(ControlConnection), (type) => { return(new ControlConnection(new SharedObjects())); }); _mocks.GetOrAdd(typeof(Direction), (type) => { return(new Direction()); }); _mocks.GetOrAdd(typeof(PIDLoop), (type) => { return(new PIDLoop()); }); _mocks.GetOrAdd(typeof(SteeringManager), (type) => { return(new SteeringManager((Vessel)null)); }); _mocks.GetOrAdd(typeof(GeoCoordinates), (type) => { var constructor = type.GetConstructor( BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] {}, null); Structure obj = (Structure)constructor.Invoke(new object[] {}); if (obj == null) { Console.Error.WriteLine("Failed to create mock for " + type.ToString()); } return(obj); }); _mocks.GetOrAdd(typeof(FlightControl), (type) => { return(new FlightControl((Vessel)null)); }); _mocks.GetOrAdd(typeof(ListValue), (type) => { var obj = new ListValue(); obj.HasSuffix("TYPENAME"); return(obj); }); _mocks.GetOrAdd(typeof(ListValue <Structure>), (type) => { var obj = new ListValue <Structure>(); obj.HasSuffix("TYPENAME"); return(obj); }); _mocks.GetOrAdd(typeof(PartValue), (type) => { var constructor = type.GetConstructor( BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(SharedObjects), typeof(global::Part), typeof(PartValue), typeof(DecouplerValue) }, null); Structure obj = (Structure)constructor.Invoke(new object[] { new SharedObjects(), null, null, null }); if (obj == null) { Console.Error.WriteLine("Failed to create mock for " + type.ToString()); } else { obj.HasSuffix("TYPENAME"); } return(obj); }); _mocks.GetOrAdd(typeof(kOS.Safe.Persistence.Volume), (type) => { return(new Persistence.MockVolume()); }); _mocks.GetOrAdd(typeof(kOS.Safe.Encapsulation.Lexicon), (type) => { return(new kOS.Safe.Encapsulation.Lexicon()); }); _mocks.GetOrAdd(typeof(ConstantValue), (type) => { return(new ConstantValue()); }); _mocks.GetOrAdd(typeof(VesselAlt), (type) => { return(new VesselAlt((SharedObjects)null)); }); _mocks.GetOrAdd(typeof(VesselEta), (type) => { return(new VesselEta((SharedObjects)null)); }); }