public void TestInitialise() { _OriginalFactory = Factory.TakeSnapshot(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(cs => cs.Load()).Returns(_Configuration); _Log = TestUtilities.CreateMockSingleton<ILog>(); _HeartbeatService = TestUtilities.CreateMockSingleton<IHeartbeatService>(); _WebServer = new Mock<IWebServer>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _AutoConfigWebServer = TestUtilities.CreateMockSingleton<IAutoConfigWebServer>(); _AutoConfigWebServer.Setup(s => s.WebServer).Returns(_WebServer.Object); _UPnpManager = new Mock<IUniversalPlugAndPlayManager>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _NewVersionChecker = TestUtilities.CreateMockSingleton<INewVersionChecker>(); _HeartbeatTick = new EventRecorder<EventArgs>(); _BaseStationAircraftList = new Mock<IBaseStationAircraftList>(); _PluginManager = TestUtilities.CreateMockSingleton<IPluginManager>(); _RebroadcastServerManager = TestUtilities.CreateMockSingleton<IRebroadcastServerManager>(); _SelfConfiguringListener = TestUtilities.CreateMockSingleton<IAutoConfigListener>(); _Listener = new Mock<IListener>(MockBehavior.Default) { DefaultValue = DefaultValue.Mock }; _SelfConfiguringListener.Setup(r => r.Listener).Returns(_Listener.Object); _Presenter = Factory.Singleton.Resolve<IMainPresenter>(); _Provider = new Mock<IMainPresenterProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Provider.Setup(p => p.UtcNow).Returns(DateTime.UtcNow); _Presenter.Provider = _Provider.Object; _View = new Mock<IMainView>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _Implementation = new Configuration(); }
/// <summary> /// Returns a copy of the current <see cref="Singleton"/>. Subsequent type registrations made to <see cref="Singleton"/> /// will not affect the copy. /// </summary> /// <returns>A copy of the current <see cref="Singleton"/>.</returns> public static IClassFactory TakeSnapshot() { IClassFactory result = _Singleton; _Singleton = _Singleton.CreateChildFactory(); return result; }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _RuntimeEnvironment.Setup(r => r.IsMono).Returns(false); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(r => r.Load()).Returns(_Configuration); _ConfigurationStorage.Setup(r => r.Folder).Returns(Path.Combine(TestContext.TestDeploymentDir, "StandingDataTest")); _Implementation = Factory.Singleton.Resolve<IStandingDataManager>(); _Provider = new Mock<IStandingDataManagerProvider>(); _Implementation.Provider = _Provider.Object; _FileExists = new Dictionary<string,bool>(); _FileExists.Add(DatabaseFileName, true); _FileExists.Add(FlightNumberCoverageFileName, true); _Provider.Setup(p => p.FileExists(It.IsAny<string>())).Returns((string fileName) => { return _FileExists[Path.GetFileName(fileName).ToUpper()]; }); _ReadAllLines = new Dictionary<string,List<string>>(); _ReadAllLines.Add(FlightNumberCoverageFileName, new List<string>()); _Provider.Setup(p => p.ReadAllLines(It.IsAny<string>())).Returns((string fileName) => { return _ReadAllLines[Path.GetFileName(fileName).ToUpper()].ToArray(); }); _ReadAllLines[FlightNumberCoverageFileName].Add("A,B,C,D,E"); _ReadAllLines[FlightNumberCoverageFileName].Add("2001-02-01,2002-12-31,1000,X,X"); }
public void TestInitialise() { _OriginalClassFactory = Factory.TakeSnapshot(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(s => s.Load()).Returns(_Configuration); _CreateDatabaseFileName = Path.Combine(TestContext.TestDeploymentDir, "CreatedDatabase.sqb"); if(File.Exists(_CreateDatabaseFileName)) File.Delete(_CreateDatabaseFileName); _EmptyDatabaseFileName = Path.Combine(TestContext.TestDeploymentDir, "TestCopyBaseStation.sqb"); File.Copy(Path.Combine(TestContext.TestDeploymentDir, "BaseStation.sqb"), _EmptyDatabaseFileName, true); _Database = Factory.Singleton.Resolve<IBaseStationDatabase>(); _Database.FileName = _EmptyDatabaseFileName; _Provider = new Mock<IBaseStationDatabaseProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Database.Provider = _Provider.Object; _Provider.Setup(p => p.UtcNow).Returns(DateTime.UtcNow); _ConnectionStringBuilder = new SQLiteConnectionStringBuilder() { DataSource = _EmptyDatabaseFileName }; _Criteria = new SearchBaseStationCriteria() { FromDate = DateTime.MinValue, ToDate = DateTime.MaxValue, }; _FileNameChangingEvent = new EventRecorder<EventArgs>(); _FileNameChangedEvent = new EventRecorder<EventArgs>(); }
public void TestInitialise() { _OriginalClassFactory = Factory.TakeSnapshot(); _HeartbeatService = TestUtilities.CreateMockSingleton<IHeartbeatService>(); _StandingDataManager = TestUtilities.CreateMockSingleton<IStandingDataManager>(); _StandingDataManager.Setup(r => r.FindCodeBlock(It.IsAny<string>())).Returns(new CodeBlock() { Country = "X" }); _StandingDataManager.Setup(r => r.CodeBlocksLoaded).Returns(true); _Statistics = Factory.Singleton.Resolve<IStatistics>().Singleton; _Statistics.Initialise(); _Statistics.ResetConnectionStatistics(); _Statistics.ResetMessageCounters(); _Translator = Factory.Singleton.Resolve<IRawMessageTranslator>(); _Provider = new Mock<IRawMessageTranslatorProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Provider.Setup(r => r.UtcNow).Returns(new DateTime(1999, 12, 31)); _Translator.Provider = _Provider.Object; _PositionResetEvent = new EventRecorder<EventArgs<string>>(); _Translator.PositionReset += _PositionResetEvent.Handler; _NowUtc = new DateTime(2012, 1, 2, 3, 4, 5, 6); _ModeSMessage = new ModeSMessage() { DownlinkFormat = DownlinkFormat.AllCallReply, Icao24 = 0x112233, ParityInterrogatorIdentifier = 0 }; _AdsbMessage = new AdsbMessage(_ModeSMessage); _RandomIcaos = new List<int>(); }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _Presenter = Factory.Singleton.Resolve<IInvalidPluginsPresenter>(); _View = new Mock<IInvalidPluginsView>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _PluginManager = TestUtilities.CreateMockSingleton<IPluginManager>(); }
public void TestInitialise() { _FactorySnapshot = Factory.TakeSnapshot(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _RuntimeEnvironment.Setup(e => e.IsMono).Returns(false); _Audio = Factory.Singleton.Resolve<IAudio>(); }
/// <summary> /// Initialises the class factory with all the standard implementations in this library. /// </summary> /// <param name="factory"></param> public static void Register(IClassFactory factory) { factory.Register<IAutoConfigBaseStationDatabase, BaseStation.AutoConfigBaseStationDatabase>(); factory.Register<IBackgroundDataDownloader, StandingData.BackgroundDataDownloader>(); factory.Register<IBaseStationDatabase, BaseStation.Database>(); factory.Register<ILogDatabase, Log.Database>(); factory.Register<IStandingDataManager, StandingData.StandingDataManager>(); factory.Register<IStandingDataUpdater, StandingData.StandingDataUpdater>(); }
public void TestInitialise() { _OriginalClassFactory = Factory.TakeSnapshot(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _ConfigurationStorage.Setup(r => r.Folder).Returns(ConfigurationFolder); _StandingDataManager = TestUtilities.CreateMockSingleton<IStandingDataManager>(); _StandingDataManagerLock = new object(); _StandingDataManager.Setup(r => r.Lock).Returns(_StandingDataManagerLock); _Implementation = Factory.Singleton.Resolve<IStandingDataUpdater>(); _Provider = new Mock<IStandingDataUpdaterProvider>(); _Implementation.Provider = _Provider.Object; _FileExists = new Dictionary<string,bool>(); foreach(var fileName in AllFileNames) { _FileExists.Add(fileName, true); } _Provider.Setup(p => p.FileExists(It.IsAny<string>())).Returns((string fileName) => { return _FileExists[fileName.ToUpper()]; }); _ReadLines = new Dictionary<string,List<string>>(); foreach(var fileName in AllFileNames) { _ReadLines.Add(fileName, new List<string>()); } _Provider.Setup(p => p.ReadLines(It.IsAny<string>())).Returns((string fileName) => { return _ReadLines[fileName.ToUpper()].ToArray(); }); _DownloadLines = new Dictionary<string,List<string>>(); foreach(var url in AllUrls) { _DownloadLines.Add(url, new List<string>()); } _Provider.Setup(p => p.DownloadLines(It.IsAny<string>())).Returns((string url) => { return _DownloadLines[url.ToUpper()].ToArray(); }); _SavedLines = new Dictionary<string,List<string>>(); _Provider.Setup(p => p.WriteLines(It.IsAny<string>(), It.IsAny<string[]>())).Callback((string fileName, string[] lines) => { var key = fileName.ToUpper(); var value = new List<string>(lines); _SavedLines.Add(key, value); }); _DownloadedCompressedFiles = new Dictionary<string,string>(); _Provider.Setup(r => r.DownloadAndDecompressFile(It.IsAny<string>(), It.IsAny<string>())).Callback((string url, string fileName) => { _DownloadedCompressedFiles.Add(url.ToUpper(), fileName.ToUpper()); }); _MovedFiles = new Dictionary<string,string>(); _Provider.Setup(r => r.MoveFile(It.IsAny<string>(), It.IsAny<string>())).Callback((string temporaryFileName, string liveFileName) => { _MovedFiles.Add(temporaryFileName.ToUpper(), liveFileName.ToUpper()); }); }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _NewVersionChecker = Factory.Singleton.Resolve<INewVersionChecker>(); _Provider = new Mock<INewVersionCheckerProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _NewVersionChecker.Provider = _Provider.Object; _NewVersionAvailable = new EventRecorder<EventArgs>(); _ApplicationInformation = TestUtilities.CreateMockImplementation<IApplicationInformation>(); }
public static void _Reset() { _Id = _Name = _Version = null; _HasOptions = false; _ConstructorCallCount.Clear(); _RegisterImplementationsCallCount.Clear(); _ConstructorThrowsException = false; _RegisterImplementationsClassFactory = null; _RegisterImplementationsThrowsException = false; }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _StandingDataManager = TestUtilities.CreateMockSingleton<IStandingDataManager>(); _StandingDataUpdater = TestUtilities.CreateMockImplementation<IStandingDataUpdater>(); _Presenter = Factory.Singleton.Resolve<IDownloadDataPresenter>(); _View = new Mock<IDownloadDataView>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _DirectoryCache = TestUtilities.CreateMockImplementation<IDirectoryCache>(); _Configuration = new Configuration(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _ConfigurationStorage.Setup(s => s.Load()).Returns(_Configuration); _AutoConfig = Factory.Singleton.Resolve<IAutoConfigPictureFolderCache>(); }
public void TestInitialise() { _OriginalFactory = Factory.TakeSnapshot(); _View = new Mock<IAboutView>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _ApplicationInformation = TestUtilities.CreateMockImplementation<IApplicationInformation>(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _Presenter = Factory.Singleton.Resolve<IAboutPresenter>(); }
public void TestInitialise() { _OriginalClassFactory = Factory.TakeSnapshot(); _AutoConfigBaseStationDatabase = TestUtilities.CreateMockSingleton<IAutoConfigBaseStationDatabase>(); _BaseStationDatabase = new Mock<IBaseStationDatabase>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _AutoConfigBaseStationDatabase.Setup(r => r.Database).Returns(_BaseStationDatabase.Object); _Presenter = Factory.Singleton.Resolve<IReceiverLocationsPresenter>(); _View = new Mock<IReceiverLocationsView>() { DefaultValue = DefaultValue.Mock} .SetupAllProperties(); }
/// <summary> /// Initialises the class factory with all the standard implementations in this library. /// </summary> /// <param name="factory"></param> public static void Register(IClassFactory factory) { factory.Register<IAutoConfigWebServer, AutoConfigWebServer>(); factory.Register<IResponder, Responder>(); factory.Register<IWebServer, WebServer>(); if(Type.GetType("Mono.Runtime") == null) { factory.Register<IUniversalPlugAndPlayManager, DotNetUniversalPlugAndPlayManager>(); } else { factory.Register<IUniversalPlugAndPlayManager, MonoUniversalPlugAndPlayManager>(); } }
public void TestInitialise() { _BackgroundException = null; _ClassFactorySnapshot = Factory.TakeSnapshot(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _RuntimeEnvironment.Setup(r => r.IsTest).Returns(true); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(m => m.Load()).Returns(_Configuration); _AircraftPictureManager = TestUtilities.CreateMockSingleton<IAircraftPictureManager>(); _HeartbeatService = TestUtilities.CreateMockSingleton<IHeartbeatService>(); _AutoConfigPictureFolderCache = TestUtilities.CreateMockSingleton<IAutoConfigPictureFolderCache>(); _PictureDirectoryCache = new Mock<IDirectoryCache>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _AutoConfigPictureFolderCache.Setup(a => a.DirectoryCache).Returns(_PictureDirectoryCache.Object); _AircraftList = Factory.Singleton.Resolve<IBaseStationAircraftList>(); _AircraftList.ExceptionCaught += AircraftListExceptionCaughtHandler; _Provider = new Mock<IBaseStationAircraftListProvider>().SetupAllProperties(); _Provider.Setup(m => m.UtcNow).Returns(DateTime.UtcNow); _Port30003Listener = new Mock<IListener>().SetupAllProperties(); _BaseStationDatabase = new Mock<IBaseStationDatabase>().SetupAllProperties(); _StandingDataManager = TestUtilities.CreateMockSingleton<IStandingDataManager>(); _AircraftList.Provider = _Provider.Object; _AircraftList.Listener = _Port30003Listener.Object; _AircraftList.BaseStationDatabase = _BaseStationDatabase.Object; _AircraftList.StandingDataManager = _StandingDataManager.Object; _BaseStationMessage = new BaseStationMessage(); _BaseStationMessage.MessageType = BaseStationMessageType.Transmission; _BaseStationMessage.Icao24 = "4008F6"; _BaseStationMessageEventArgs = new BaseStationMessageEventArgs(_BaseStationMessage); _BaseStationAircraft = new BaseStationAircraft(); _BaseStationDatabase.Setup(m => m.GetAircraftByCode("4008F6")).Returns(_BaseStationAircraft); _Heathrow = new Airport() { IcaoCode = "EGLL", IataCode = "LHR", Name = "Heathrow", Country = "UK", }; _JohnFKennedy = new Airport() { IcaoCode = "KJFK", IataCode = "JFK", Country = "USA", }; _Helsinki = new Airport() { IataCode = "HEL", }; _Boston = new Airport() { IcaoCode = "KBOS", }; _Route = new Route() { From = _Heathrow, To = _JohnFKennedy, Stopovers = { _Helsinki }, }; _ExceptionCaughtEvent = new EventRecorder<EventArgs<Exception>>(); _CountChangedEvent = new EventRecorder<EventArgs>(); }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _Database = TestUtilities.CreateMockImplementation<IBaseStationDatabase>(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(s => s.Load()).Returns(_Configuration); _AutoConfigDatabase = Factory.Singleton.Resolve<IAutoConfigBaseStationDatabase>(); }
public void TestInitialise() { _OriginalClassFactory = Factory.TakeSnapshot(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(c => c.Load()).Returns(_Configuration); _DirectoryCache = new Mock<IDirectoryCache>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _CacheCleared = new EventRecorder<EventArgs>(); _PictureManager = Factory.Singleton.Resolve<IAircraftPictureManager>(); }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _ConfigurationStorage.Setup(c => c.Folder).Returns("configFolder"); _Storage = Factory.Singleton.Resolve<IPluginSettingsStorage>(); _Provider = new Mock<IPluginSettingsStorageProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Provider.Setup(p => p.FileExists(It.IsAny<string>())).Returns(true); _Storage.Provider = _Provider.Object; _ConfigurationChangedEvent = new EventRecorder<EventArgs>(); }
public void TestInitialise() { _OriginalFactory = Factory.TakeSnapshot(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _ConfigurationStorage.Setup(m => m.Folder).Returns(TestContext.TestDeploymentDir); _FullPath = Path.Combine(_ConfigurationStorage.Object.Folder, _FileName); _LogDatabase = Factory.Singleton.Resolve<ILogDatabase>(); _Provider = new Mock<ILogDatabaseProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Provider.Setup(m => m.UtcNow).Returns(() => { return DateTime.UtcNow; }); _LogDatabase.Provider = _Provider.Object; }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _LogClients = new List<LogClient>(); _LogSessions = new List<LogSession>(); _LogDatabase = TestUtilities.CreateMockSingleton<ILogDatabase>(); _LogDatabase.Setup(d => d.FetchSessions(It.IsAny<IList<LogClient>>(), It.IsAny<IList<LogSession>>(), It.IsAny<DateTime>(), It.IsAny<DateTime>())).Callback((IList<LogClient> clients, IList<LogSession> sessions, DateTime startDate, DateTime endDate) => { foreach(var client in _LogClients) clients.Add(client); foreach(var session in _LogSessions) sessions.Add(session); }); _Presenter = Factory.Singleton.Resolve<IConnectionSessionLogPresenter>(); _View = new Mock<IConnectionSessionLogView>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _FlightSimulatorX = TestUtilities.CreateMockImplementation<IFlightSimulatorX>(); _FlightSimulatorX.Setup(fsx => fsx.IsInstalled).Returns(true); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(c => c.Load()).Returns(_Configuration); _Log = TestUtilities.CreateMockSingleton<ILog>(); _Presenter = Factory.Singleton.Resolve<IFlightSimulatorXPresenter>(); _Provider = new Mock<IFlightSimulatorXPresenterProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Provider.Setup(p => p.UtcNow).Returns(DateTime.UtcNow); _LimitTimedInvokeCallbacks = 1; int callbacks = 0; _Provider.Setup(p => p.TimedInvokeOnBackgroundThread(It.IsAny<Action>(), It.IsAny<int>())).Callback((Action callback, int milliseconds) => { if(callbacks++ < _LimitTimedInvokeCallbacks) callback(); }); _Presenter.Provider = _Provider.Object; _SelectedAircraft = new Mock<IAircraft>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties().Object; _View = new Mock<IFlightSimulatorXView>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _View.Setup(v => v.CanBeRefreshed).Returns(true); _View.Setup(v => v.SelectedRealAircraft).Returns(_SelectedAircraft); _BaseStationAircraftList = new Mock<IBaseStationAircraftList>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _FlightSimulatorAircraftList = new Mock<ISimpleAircraftList>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); long trash1, trash2; _RealAircraftList = new List<IAircraft>(); _BaseStationAircraftList.Setup(b => b.TakeSnapshot(out trash1, out trash2)).Returns(_RealAircraftList); _FSXAircraftList = new List<IAircraft>(); var syncLock = new object(); _FlightSimulatorAircraftList.Setup(f => f.Aircraft).Returns(_FSXAircraftList); _FlightSimulatorAircraftList.Setup(f => f.ListSyncLock).Returns(syncLock); _WebServer = new Mock<IWebServer>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Presenter.BaseStationAircraftList = _BaseStationAircraftList.Object; _Presenter.FlightSimulatorAircraftList = _FlightSimulatorAircraftList.Object; _Presenter.WebServer = _WebServer.Object; }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(c => c.Load()).Returns(_Configuration); _AutoConfigListener = TestUtilities.CreateMockSingleton<IAutoConfigListener>(); _AutoConfigListener.Setup(r => r.Listener).Returns((IListener)null); _AutoConfigListener.Setup(r => r.Initialise()).Callback(() => { _AutoConfigListener.Setup(r => r.Listener).Returns(_Listener.Object); }); _Log = TestUtilities.CreateMockSingleton<ILog>(); _HearbeatService = TestUtilities.CreateMockSingleton<IHeartbeatService>(); _StandingDataManager = TestUtilities.CreateMockSingleton<IStandingDataManager>(); _Listener = new Mock<IListener>(MockBehavior.Default) { DefaultValue = DefaultValue.Mock }; _BaseStationAircraftList = TestUtilities.CreateMockImplementation<IBaseStationAircraftList>(); _AutoConfigWebServer = TestUtilities.CreateMockSingleton<IAutoConfigWebServer>(); _WebServer = new Mock<IWebServer>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _AutoConfigWebServer.Setup(s => s.WebServer).Returns(_WebServer.Object); _WebSite = TestUtilities.CreateMockImplementation<IWebSite>(); _FlightSimulatorXAircraftList = TestUtilities.CreateMockImplementation<ISimpleAircraftList>(); _UniversalPlugAndPlayManager = TestUtilities.CreateMockImplementation<IUniversalPlugAndPlayManager>(); _ConnectionLogger = TestUtilities.CreateMockSingleton<IConnectionLogger>(); _LogDatabase = TestUtilities.CreateMockSingleton<ILogDatabase>(); _BackgroundDataDownloader = TestUtilities.CreateMockSingleton<IBackgroundDataDownloader>(); _PluginManager = TestUtilities.CreateMockSingleton<IPluginManager>(); _ApplicationInformation = TestUtilities.CreateMockImplementation<IApplicationInformation>(); _AutoConfigPictureFolderCache = TestUtilities.CreateMockSingleton<IAutoConfigPictureFolderCache>(); _RebroadcastServerManager = TestUtilities.CreateMockSingleton<IRebroadcastServerManager>(); _Statistics = TestUtilities.CreateMockSingleton<IStatistics>(); _BackgroundExceptionEvent = new EventRecorder<EventArgs<Exception>>(); _BaseStationDatabase = new Mock<IBaseStationDatabase>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _AutoConfigBaseStationDatabase = TestUtilities.CreateMockSingleton<IAutoConfigBaseStationDatabase>(); _AutoConfigBaseStationDatabase.Setup(a => a.Database).Returns(_BaseStationDatabase.Object); _BaseStationDatabase.Setup(d => d.FileName).Returns("x"); _BaseStationDatabase.Setup(d => d.TestConnection()).Returns(true); _Provider = new Mock<ISplashPresenterProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Provider.Setup(p => p.FolderExists(It.IsAny<string>())).Returns(true); _Presenter = Factory.Singleton.Resolve<ISplashPresenter>(); _Presenter.Provider = _Provider.Object; _View = new Mock<ISplashView>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _HeartbeatService = TestUtilities.CreateMockSingleton<IHeartbeatService>(); _WebServer = new Mock<IWebServer>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _LogDatabase = new Mock<ILogDatabase>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _LogSession = new Mock<LogSession>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _ExceptionCaughtEvent = new EventRecorder<EventArgs<Exception>>(); _ConnectionLogger = Factory.Singleton.Resolve<IConnectionLogger>(); _ConnectionLogger.WebServer = _WebServer.Object; _ConnectionLogger.LogDatabase = _LogDatabase.Object; _Provider = new Mock<IConnectionLoggerProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _ConnectionLogger.Provider = _Provider.Object; }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _ConfigurationStorage.Object.Folder = @"ztt:\ump"; _FullPath = Path.Combine(_ConfigurationStorage.Object.Folder, _FileName); _Provider = new Mock<ILogProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Provider.Setup(p => p.FileExists(It.IsAny<string>())).Returns(true); _Provider.Setup(p => p.FolderExists(It.IsAny<string>())).Returns(true); _UtcNow = new DateTime(2001, 2, 3, 4, 5, 6, 789); _Provider.Setup(p => p.UtcNow).Returns(_UtcNow); _Log = Factory.Singleton.Resolve<ILog>(); _Log.Provider = _Provider.Object; }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _WebServer = TestUtilities.CreateMockImplementation<IWebServer>(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _ExternalIPAddressService = TestUtilities.CreateMockSingleton<IExternalIPAddressService>(); _HeartbeatService = TestUtilities.CreateMockSingleton<IHeartbeatService>(); _Log = TestUtilities.CreateMockSingleton<ILog>(); _Configuration = new Configuration(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _ConfigurationStorage.Setup(s => s.Load()).Returns(_Configuration); _InstallerSettingsStorage = TestUtilities.CreateMockImplementation<IInstallerSettingsStorage>(); _InstallerSettings = new InstallerSettings(); _InstallerSettingsStorage.Setup(s => s.Load()).Returns(_InstallerSettings); _AutoConfigWebServer = Factory.Singleton.Resolve<IAutoConfigWebServer>(); }
public void TestInitialise() { _ClassFactorySnapshot = Factory.TakeSnapshot(); _HeartbeatService = TestUtilities.CreateMockSingleton<IHeartbeatService>(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _StandingDataUpdater = TestUtilities.CreateMockImplementation<IStandingDataUpdater>(); _StandingDataManager = TestUtilities.CreateMockSingleton<IStandingDataManager>(); _Log = TestUtilities.CreateMockSingleton<ILog>(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _Configuration = new Configuration(); _Configuration.FlightRouteSettings.AutoUpdateEnabled = true; _ConfigurationStorage.Setup(c => c.Load()).Returns(_Configuration); _BackgroundDataDownloader = Factory.Singleton.Resolve<IBackgroundDataDownloader>(); _Provider = new Mock<IBackgroundDataDownloaderProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _BackgroundDataDownloader.Provider = _Provider.Object; }
public void TestInitialise() { _Statistics = Factory.Singleton.Resolve<IStatistics>().Singleton; _Statistics.Initialise(); _Statistics.ResetConnectionStatistics(); _Statistics.ResetMessageCounters(); _OriginalClassFactory = Factory.TakeSnapshot(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _RuntimeEnvironment.Setup(r => r.IsTest).Returns(true); _Port30003Translator = TestUtilities.CreateMockImplementation<IBaseStationMessageTranslator>(); _ModeSTranslator = TestUtilities.CreateMockImplementation<IModeSTranslator>(); _AdsbTranslator = TestUtilities.CreateMockImplementation<IAdsbTranslator>(); _RawMessageTranslator = new Mock<IRawMessageTranslator>(MockBehavior.Default) { DefaultValue = DefaultValue.Mock }; _ModeSParity = TestUtilities.CreateMockImplementation<IModeSParity>(); _ModeSMessage = new ModeSMessage(); _AdsbMessage = new AdsbMessage(_ModeSMessage); _Port30003Message = new BaseStationMessage(); _Port30003Translator.Setup(r => r.Translate(It.IsAny<string>())).Returns(_Port30003Message); _AdsbTranslator.Setup(r => r.Translate(It.IsAny<ModeSMessage>())).Returns(_AdsbMessage); _ModeSTranslator.Setup(r => r.Translate(It.IsAny<byte[]>())).Returns(_ModeSMessage); _ModeSTranslator.Setup(r => r.Translate(It.IsAny<byte[]>(), It.IsAny<int>())).Returns(_ModeSMessage); _RawMessageTranslator.Setup(r => r.Translate(It.IsAny<DateTime>(), It.IsAny<ModeSMessage>(), It.IsAny<AdsbMessage>())).Returns(_Port30003Message); _Listener = Factory.Singleton.Resolve<IListener>(); _Provider = new MockListenerProvider(); _BytesExtractor = new MockMessageBytesExtractor(); _ExceptionCaughtEvent = new EventRecorder<EventArgs<Exception>>(); _ConnectionStateChangedEvent = new EventRecorder<EventArgs>(); _ModeSMessageReceivedEvent = new EventRecorder<ModeSMessageEventArgs>(); _Port30003MessageReceivedEvent = new EventRecorder<BaseStationMessageEventArgs>(); _SourceChangedEvent = new EventRecorder<EventArgs>(); _Listener.ConnectionStateChanged += _ConnectionStateChangedEvent.Handler; _Listener.ExceptionCaught += _ExceptionCaughtEvent.Handler; _Listener.ModeSMessageReceived += _ModeSMessageReceivedEvent.Handler; _Listener.Port30003MessageReceived += _Port30003MessageReceivedEvent.Handler; _Listener.SourceChanged += _SourceChangedEvent.Handler; _ExceptionCaughtEvent.EventRaised += DefaultExceptionCaughtHandler; }
public void TestInitialise() { _OriginalFactory = Factory.TakeSnapshot(); _SharedConfiguration = TestUtilities.CreateMockSingleton <ISharedConfiguration>(); _Configuration = new Configuration(); _SharedConfiguration.Setup(cs => cs.Get()).Returns(_Configuration); _Log = TestUtilities.CreateMockSingleton <ILog>(); _HeartbeatService = TestUtilities.CreateMockSingleton <IHeartbeatService>(); _WebServer = new Mock <IWebServer>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _AutoConfigWebServer = TestUtilities.CreateMockSingleton <IAutoConfigWebServer>(); _AutoConfigWebServer.Setup(s => s.WebServer).Returns(_WebServer.Object); _UPnpManager = new Mock <IUniversalPlugAndPlayManager>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _NewVersionChecker = TestUtilities.CreateMockSingleton <INewVersionChecker>(); _HeartbeatTick = new EventRecorder <EventArgs>(); _BaseStationAircraftList = new Mock <IBaseStationAircraftList>(); _PluginManager = TestUtilities.CreateMockSingleton <IPluginManager>(); _RebroadcastServerManager = TestUtilities.CreateMockSingleton <IRebroadcastServerManager>(); _UserManager = TestUtilities.CreateMockSingleton <IUserManager>(); _Feeds = new List <Mock <IFeed> >(); _Listeners = new List <Mock <IListener> >(); var useVisibleFeeds = false; _FeedManager = FeedHelper.CreateMockFeedManager(_Feeds, _Listeners, useVisibleFeeds, 1, 2); _Clock = new ClockMock(); Factory.Singleton.RegisterInstance <IClock>(_Clock.Object); _Presenter = Factory.Singleton.Resolve <IMainPresenter>(); _View = new Mock <IMainView>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); }
/// <summary> /// 获取月亮大小,以视域角度为单位 /// </summary> ///<returns>视域角度</returns> public EarthView.World.Spatial.Math.Degree GetMoonTextureAngularSize() { IntPtr __ptr = EarthView_World_Spatial_Effect3D_CMoon_getMoonTextureAngularSize_CDegree(this.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.Math.Degree csObj = new EarthView.World.Spatial.Math.Degree(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CDegree"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.Math.Degree; csObj.BindNativeObject(__ptr, "CDegree"); } return(csObj); }
/// <summary> /// 创建相控阵雷达垂直威力面 /// </summary> /// <param name="verticalSpan">垂直方向跨度</param> /// <param name="verticalNum">垂直方向威力数据分布</param> /// <param name="overaweDistance">雷达威力范围</param> /// <returns>相控阵雷达垂直威力面</returns> public static EarthView.IndustryEngine.MilitaryEngine.RadarLibrary.RadarSection CreateRadarSection(EarthView.World.Spatial.Math.Degree verticalAngleSpan, int verticalNum, double overaweDistance) { IntPtr __ptr = EarthView_IndustryEngine_MilitaryEngine_RadarLibrary_CPARadarCharacter_createRadarSection_CRadarSection_CDegree_ev_int32_ev_real64(object.Equals(verticalAngleSpan, null) ? IntPtr.Zero : verticalAngleSpan.NativeObject, ref verticalNum, ref overaweDistance); if (__ptr == IntPtr.Zero) { return(null); } EarthView.IndustryEngine.MilitaryEngine.RadarLibrary.RadarSection csObj = new EarthView.IndustryEngine.MilitaryEngine.RadarLibrary.RadarSection(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CRadarSection"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.IndustryEngine.MilitaryEngine.RadarLibrary.RadarSection; csObj.BindNativeObject(__ptr, "CRadarSection"); } return(csObj); }
/// <summary> /// 从数据流中解析地理元素对象 /// </summary> /// <param name="stream">数据流</param> /// <param name="type">地理要素类型</param> /// <param name="width">瓦片宽度,单位:像素</param> /// <param name="height">瓦片高度,单位:像素</param> /// <param name="byteOrder">数据流所对应大小尾:大尾为0,小尾为1</param> /// <returns>生成地理元素对象的指针</returns> public static EarthView.World.Spatial.GeoElement FromStream(EarthView.World.Core.DataStream stream, EarthView.World.Spatial.EVGEOELEMENTTYPE type, uint width, uint height, int byteOrder) { IntPtr __ptr = EarthView_World_Spatial_CGeoElement_fromStream_CGeoElement_CDataStream_EVGeoElementType_ev_uint32_ev_uint32_ev_int32(object.Equals(stream, null) ? IntPtr.Zero : stream.NativeObject, type, width, height, byteOrder); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.GeoElement csObj = new EarthView.World.Spatial.GeoElement(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CGeoElement"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.GeoElement; csObj.BindNativeObject(__ptr, "CGeoElement"); } return(csObj); }
///<summary> ///创建指定投影的数据集,只创建Tif格式的数据集 ///</summary> /// <param name="pSrcDS">源数据集</param> /// <param name="pszSrcWKT">源数据集坐标(WKT)描述,为NULL ///将从pSrcDS读出相应信息</param> /// <param name="pszDstWKT">目标数据集坐标(WKT)描述</param> /// <param name="pszDstFilePath">目标数据集所在位置,为NULL创建虚拟数据集</param> /// <param name="iWidth">目标数据集宽度,为0时用源图像对应的宽度</param> /// <param name="iHeight">目标数据集高度,为0时用源图像对应的高度</param> /// <param name="pAffine">仿射变换参数,为NULL时用源图像对应的参数,必须与width跟hieght ///相适应</param> public static EarthView.World.Spatial2D.Raster.RasterDataSet CreateDatasetForProj(EarthView.World.Spatial2D.Raster.RasterDataSet pSrcDS, byte[] pszSrcWKT, byte[] pszDstWKT, byte[] pszDstFilePath, int iWidth, int iHeight, EarthView.World.Spatial2D.Raster.AffineTransform pAffine) { IntPtr __ptr = EarthView_World_Spatial2D_Raster_CReprojectAlg_createDatasetForProj_CRasterDataSet_CRasterDataSet_ev_char_ev_char_ev_char_ev_int32_ev_int32_CAffineTransform(object.Equals(pSrcDS, null) ? IntPtr.Zero : pSrcDS.NativeObject, pszSrcWKT, pszDstWKT, pszDstFilePath, iWidth, iHeight, object.Equals(pAffine, null) ? IntPtr.Zero : pAffine.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial2D.Raster.RasterDataSet csObj = new EarthView.World.Spatial2D.Raster.RasterDataSet(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CRasterDataSet"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial2D.Raster.RasterDataSet; csObj.BindNativeObject(__ptr, "CRasterDataSet"); } return(csObj); }
public EarthView.World.Display.PageSize BoundedTo(EarthView.World.Display.PageSize other) { IntPtr __ptr = EarthView_World_Display_CPageSize_boundedTo_CPageSize_CPageSize(this.NativeObject, object.Equals(other, null) ? IntPtr.Zero : other.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Display.PageSize csObj = new EarthView.World.Display.PageSize(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CPageSize"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Display.PageSize; csObj.BindNativeObject(__ptr, "CPageSize"); } return(csObj); }
/// <summary> /// 从流中获取属性元素 /// </summary> /// <param name="stream">数据流</param> /// <param name="fieldName">字段名称</param> /// <param name="fieldType">地理要素类型,int32 1,long 2,real64 11,string 12,unknown 0</param> /// <param name="byteOrder">数据流大小尾,小尾1,大尾0</param> /// <returns>属性元素</returns> public static EarthView.World.Spatial.AttributionElement FromStream(EarthView.World.Core.DataStream stream, string fieldName, int fieldType, int byteOrder) { IntPtr __ptr = EarthView_World_Spatial_CAttributionElement_fromStream_CAttributionElement_CDataStream_EarthView_World_Core_ev_string_ev_int32_ev_int32(object.Equals(stream, null) ? IntPtr.Zero : stream.NativeObject, fieldName, fieldType, byteOrder); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.AttributionElement csObj = new EarthView.World.Spatial.AttributionElement(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CAttributionElement"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.AttributionElement; csObj.BindNativeObject(__ptr, "CAttributionElement"); } return(csObj); }
private void btnCreate_Click(object sender, EventArgs e) { try { IClassFactory factory = (IClassFactory)m_pObject; object new_object; Guid IID_IUnknown = COMInterfaceEntry.IID_IUnknown; Dictionary <string, string> props = new Dictionary <string, string>(); props.Add("Name", m_objName); factory.CreateInstance(null, ref IID_IUnknown, out new_object); ObjectInformation view = new ObjectInformation(m_registry, m_entry, m_objName, new_object, props, m_registry.GetInterfacesForObject(new_object)); Program.GetMainForm(m_registry).HostControl(view); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 获取当前缓存路径下已经缓存过数据的web服务URL列表 /// </summary> /// <param name=""></param> /// <returns></returns> public EarthView.World.Core.StringVector GetCachedURLList() { IntPtr __ptr = EarthView_World_FrameWorkProxy_DataSourceManager_CWebDataSourceCacheManager_getCachedURLList_StringVector(this.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Core.StringVector csObj = new EarthView.World.Core.StringVector(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "StringVector"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Core.StringVector; csObj.BindNativeObject(__ptr, "StringVector"); } return(csObj); }
public EarthView.World.Graphic.GpuProgramPtr GetGpuFragmentProgram() { IntPtr __ptr = EarthView_World_Graphic_RTShaderSystem_CProgramSet_getGpuFragmentProgram_CGpuProgramPtr(this.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Graphic.GpuProgramPtr csObj = new EarthView.World.Graphic.GpuProgramPtr(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CGpuProgramPtr"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Graphic.GpuProgramPtr; csObj.BindNativeObject(__ptr, "CGpuProgramPtr"); } return(csObj); }
private object CreateImpl(Type abstractionType, IInjectionContext context, Type[] argumentTypes, params object[] args) { try { context.BeginCreate(abstractionType); IImplementationConfiguration configuration = GetSingleImplementation(abstractionType); IClassFactory factory = configuration.GetFactory(argumentTypes, creationContext); return(UnWrap(abstractionType, factory.Create(context, args))); } catch (Exception) { context.Crash(); throw; } finally { context.EndCreate(abstractionType); } }
/// <summary> /// 由圆创建球面折线 /// </summary> /// <param name="centerLon">圆心经度(度)</param> /// <param name="centerLat">圆心纬度(度)</param> /// <param name="radius">半径(米)</param> /// <returns></returns> public EarthView.World.Spatial.Geometry.LineString CreateFromCircle(double centerLon, double centerLat, double radius) { IntPtr __ptr = EarthView_World_Spatial_Geometry_CSphereGeometryFactory_createFromCircle_CLineString_ev_real64_ev_real64_ev_real64(this.NativeObject, centerLon, centerLat, radius); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.Geometry.LineString csObj = new EarthView.World.Spatial.Geometry.LineString(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CLineString"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.Geometry.LineString; csObj.BindNativeObject(__ptr, "CLineString"); } return(csObj); }
/// <summary> /// 由点创建球面折线(暂未实现) /// </summary> /// <param name="points">点串</param> /// <param name="nCount">点数</param> /// <returns></returns> public EarthView.World.Spatial.Geometry.LineString CreateFromPoints(EarthView.World.Spatial.Geometry.Coordinate points, uint nCount) { IntPtr __ptr = EarthView_World_Spatial_Geometry_CSphereGeometryFactory_createFromPoints_CLineString_CCoordinate_ev_uint32(this.NativeObject, object.Equals(points, null) ? IntPtr.Zero : points.NativeObject, nCount); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.Geometry.LineString csObj = new EarthView.World.Spatial.Geometry.LineString(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CLineString"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.Geometry.LineString; csObj.BindNativeObject(__ptr, "CLineString"); } return(csObj); }
/// <summary> /// 获取某个mesh名称下对应的ID集合,有可能只有一个 /// </summary> /// <param name="meshName">模型类别</param> /// <returns>存储ID的容器</returns> public EarthView.World.Spatial3D.Dataset.ObjectIDList GetIDSByMeshName(string meshName) { IntPtr __ptr = EarthView_World_Spatial3D_ModelManager_CModelEffectManager_getIDSByMeshName_CObjectIDList_EVString(this.NativeObject, meshName); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial3D.Dataset.ObjectIDList csObj = new EarthView.World.Spatial3D.Dataset.ObjectIDList(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CObjectIDList"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial3D.Dataset.ObjectIDList; csObj.BindNativeObject(__ptr, "CObjectIDList"); } return(csObj); }
/// <summary> /// 获取模型库中的所有模型类别 /// </summary> /// <returns>用户类别列表</returns> public EarthView.World.Core.StringVector GetAllUserType() { IntPtr __ptr = EarthView_World_Spatial3D_ModelManager_CModelEffectManager_getAllUserType_StringVector(this.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Core.StringVector csObj = new EarthView.World.Core.StringVector(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "StringVector"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Core.StringVector; csObj.BindNativeObject(__ptr, "StringVector"); } return(csObj); }
/// <summary> /// /// </summary> /// <returns></returns> public EarthView.World.Core.MemoryDataStreamPtr GenKmlPicCache(string picPath) { IntPtr __ptr = EarthView_World_Spatial3D_KmlManager_CKmlCacheManager_genKmlPicCache_MemoryDataStreamPtr_EVString(this.NativeObject, picPath); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Core.MemoryDataStreamPtr csObj = new EarthView.World.Core.MemoryDataStreamPtr(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "MemoryDataStreamPtr"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Core.MemoryDataStreamPtr; csObj.BindNativeObject(__ptr, "MemoryDataStreamPtr"); } return(csObj); }
/// <summary> /// 获取指定真实坐标对应的瓦片信息对象 /// </summary> /// <returns>指定真实坐标所在瓦片信息对象的指针</returns> public EarthView.World.Spatial.TileInfo GetTileInfoByXY(double x, double y) { IntPtr __ptr = EarthView_World_Spatial_CTilesInfo_getTileInfoByXY_CTileInfo_ev_real64_ev_real64(this.NativeObject, x, y); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.TileInfo csObj = new EarthView.World.Spatial.TileInfo(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CTileInfo"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.TileInfo; csObj.BindNativeObject(__ptr, "CTileInfo"); } return(csObj); }
/// <summary> /// 获取指定级别的级别信息对象,不建议使用 /// </summary> /// <param name="level">瓦片级别</param> /// <param name="ptr1">某EarthView::World::Spatial::CTileLevelInfo对象的首地址</param> /// <param name="dpiPerInch">每英寸的DPI数(默认为96,用于计算比例尺和分辨率)</param> /// <returns>指定级别的信息对象指针,不需释放</returns> public EarthView.World.Spatial.TileLevelInfo GetLevelInfo(int level, IntPtr ptr1, uint dpiPerInch) { IntPtr __ptr = EarthView_World_Spatial_CTileReference_getLevelInfo_CTileLevelInfo_ev_int32_void_ev_uint32(this.NativeObject, level, ptr1, dpiPerInch); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.TileLevelInfo csObj = new EarthView.World.Spatial.TileLevelInfo(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CTileLevelInfo"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.TileLevelInfo; csObj.BindNativeObject(__ptr, "CTileLevelInfo"); } return(csObj); }
/// <summary> /// 获取属性元素 /// </summary> /// <returns>属性</returns> public EarthView.World.Core.Variant GetAttributionValue() { IntPtr __ptr = EarthView_World_Spatial_CAttributionElement_getAttributionValue_CVariant(this.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Core.Variant csObj = new EarthView.World.Core.Variant(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CVariant"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Core.Variant; csObj.BindNativeObject(__ptr, "CVariant"); } return(csObj); }
///<summary> ///获取一个低级别的数据库句柄并绑定到cvariant对象上 ///</summary> ///<param name=""></param> ///<returns>绑定有数据库句柄的cvariant对象</returns> public virtual EarthView.World.Core.Variant Handle_NoVirtual() { IntPtr __ptr = EarthView_World_Core_Database_CSqlResult_handle_CVariant_NoVirtual(this.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Core.Variant csObj = new EarthView.World.Core.Variant(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CVariant"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Core.Variant; csObj.BindNativeObject(__ptr, "CVariant"); } return(csObj); }
/// <summary> /// 创建WGS84格式影像的TileReference对象 /// </summary> /// <returns>WGS84格式影像的TileReference对象指针</returns> public static EarthView.World.Spatial.TileReference CreateImageTileReferenceForWGS84() { IntPtr __ptr = EarthView_World_Spatial_CTileReferenceFactory_createImageTileReferenceForWGS84_CTileReference(); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.TileReference csObj = new EarthView.World.Spatial.TileReference(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CTileReference"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.TileReference; csObj.BindNativeObject(__ptr, "CTileReference"); } return(csObj); }
/// <summary> /// 复制 /// </summary> /// <returns>相控阵雷达特征</returns> public override EarthView.IndustryEngine.MilitaryEngine.RadarLibrary.RadarCharacter Clone() { IntPtr __ptr = EarthView_IndustryEngine_MilitaryEngine_RadarLibrary_CPARadarCharacter_clone_CRadarCharacter(this.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.IndustryEngine.MilitaryEngine.RadarLibrary.RadarCharacter csObj = new EarthView.IndustryEngine.MilitaryEngine.RadarLibrary.RadarCharacter(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CRadarCharacter"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.IndustryEngine.MilitaryEngine.RadarLibrary.RadarCharacter; csObj.BindNativeObject(__ptr, "CRadarCharacter"); } return(csObj); }
/// <summary> /// 插值生成曲线上某点坐标 /// </summary> /// <param name="fromIndex">控制点索引</param> /// <param name="t">参变量t</param> /// <returns>点坐标</returns> public EarthView.World.Spatial.Math.Quaternion Interpolate(uint fromIndex, double t) { IntPtr __ptr = EarthView_World_Graphic_CRotationalSpline_interpolate_CQuaternion_ev_uint32_Real(this.NativeObject, fromIndex, t); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.Math.Quaternion csObj = new EarthView.World.Spatial.Math.Quaternion(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CQuaternion"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.Math.Quaternion; csObj.BindNativeObject(__ptr, "CQuaternion"); } return(csObj); }
/// <summary> /// 生成瓦片路径规则 /// </summary> /// <param name="dataType">数据类型,影像、矢量、DEM</param> /// <param name="tilePathType">路径类型,离散文件、库文件</param> /// <param name="tileModeType">模式,WGS84、Mercator还是古唐</param> /// <returns></returns> public static EarthView.World.Spatial.TilePathRule CreateTilePathRule(EarthView.World.Spatial.EVTILEDATATYPE dataType, EarthView.World.Spatial.EVTILEPATHTYPE tilePathType, EarthView.World.Spatial.EVTILEMODETYPE tileModeType) { IntPtr __ptr = EarthView_World_Spatial_CTilePathRuleFactory_createTilePathRule_CTilePathRule_EVTileDataType_EVTilePathType_EVTileModeType(dataType, tilePathType, tileModeType); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.TilePathRule csObj = new EarthView.World.Spatial.TilePathRule(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CTilePathRule"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.TilePathRule; csObj.BindNativeObject(__ptr, "CTilePathRule"); } return(csObj); }
public EarthView.World.Core.XmlElement ToXmlElement() { IntPtr __ptr = EarthView_World_Spatial2D_Raster_CRasterHistogram_toXmlElement_CXmlElement(this.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Core.XmlElement csObj = new EarthView.World.Core.XmlElement(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CXmlElement"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Core.XmlElement; csObj.BindNativeObject(__ptr, "CXmlElement"); } return(csObj); }
public void TestClassFactoryWorks() { var i1Mock = NewMock <I1>(); context.Expect(c => c.InternalContainer).Return(internalContainer); internalContainer.ExpectGet(context, i1Mock); IClassFactory classFactory = classCreator.BuildFactory( new ContainerConstructorInfo { ConstructorInfo = testType.GetConstructor(new[] { typeof(I1) }) }, null); context.Expect(c => c.BeginConstruct(testType)); context.Expect(c => c.EndConstruct(testType)); object instance = classFactory.Create(context, new object[0]); Assert.That(instance, Is.InstanceOf(testType)); Assert.AreSame(i1Mock, ((I2Impl)instance).i1); }
/// <summary> /// 获取 /// </summary> /// <param name=""></param> /// <returns>返回</returns> /// <memo></memo> public EarthView.World.Spatial.Math.Vector3 GetCurrentPoint() { IntPtr __ptr = EarthView_World_Spatial3D_Analysis_CAnalysis3DMeasureAzimuthParam_getCurrentPoint_CVector3(this.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.Math.Vector3 csObj = new EarthView.World.Spatial.Math.Vector3(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CVector3"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.Math.Vector3; csObj.BindNativeObject(__ptr, "CVector3"); } return(csObj); }
/// <summary> /// 克隆 /// </summary> /// <returns>克隆对象的指针</returns> public override EarthView.World.Spatial.TilePathRule Clone() { IntPtr __ptr = EarthView_World_Spatial_CTileDBPathRule_clone_CTilePathRule(this.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.TilePathRule csObj = new EarthView.World.Spatial.TilePathRule(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CTilePathRule"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.TilePathRule; csObj.BindNativeObject(__ptr, "CTilePathRule"); } return(csObj); }
/// <summary> /// 获取相控阵雷达垂直方向威力间隔 /// </summary> /// <returns>相控阵雷达垂直方向威力间隔(角度值)</returns> public EarthView.World.Spatial.Math.Degree GetVerticalAngleDelta() { IntPtr __ptr = EarthView_IndustryEngine_MilitaryEngine_RadarLibrary_CPARadarCharacter_getVerticalAngleDelta_CDegree(this.NativeObject); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.Math.Degree csObj = new EarthView.World.Spatial.Math.Degree(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CDegree"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.Math.Degree; csObj.BindNativeObject(__ptr, "CDegree"); } return(csObj); }
/// <summary> /// 获得第n份子高度范围 /// </summary> /// <param name="index">子高度范围序号</param> /// <returns>子高度范围</returns> public EarthView.World.Spatial.Effect3D.HeightRange GetSubHeightRange(int index) { IntPtr __ptr = EarthView_World_Spatial_Effect3D_CHeightRange_getSubHeightRange_CHeightRange_ev_int32(this.NativeObject, index); if (__ptr == IntPtr.Zero) { return(null); } EarthView.World.Spatial.Effect3D.HeightRange csObj = new EarthView.World.Spatial.Effect3D.HeightRange(CreatedWhenConstruct.CWC_NotToCreate); csObj.BindNativeObject(__ptr, "CHeightRange"); IClassFactory csObjClassFactory = GlobalClassFactoryMap.Get(csObj.GetCppInstanceTypeName()); if (csObjClassFactory != null) { csObj.Delegate = true; csObj = csObjClassFactory.Create() as EarthView.World.Spatial.Effect3D.HeightRange; csObj.BindNativeObject(__ptr, "CHeightRange"); } return(csObj); }