Example #1
0
 public DungeonLoader(ILoadingScreenPM i_loadingPM, IBackendManager i_backend, ICurrentDungeonGameManager i_currentDungeon, ISceneManager i_sceneManager)
 {
     mLoadingPM          = i_loadingPM;
     mBackendManager     = i_backend;
     mCurrentDungeonData = i_currentDungeon;
     mSceneManager       = i_sceneManager;
 }
Example #2
0
 public BackendInfoTests()
 {
     // These are satellite classes with simple functionality and adding the actual implementations
     // much more convenient than replicating functionality for the purpose of the tests.
     Provide <IDestinationManagerFactory, DestinationManagerFactory>();
     Provide <IProxyHttpClientFactoryFactory, ProxyHttpClientFactoryFactory>();
     _backendManager = Provide <IBackendManager, BackendManager>();
 }
Example #3
0
        public MyCountdown(IBackendManager i_backend, long i_targetTimeMs, ICountdownCallback i_callback)
        {
            mBackend     = i_backend;
            Callback     = i_callback;
            TargetTimeMs = i_targetTimeMs;

            CalculateRemainingTime();
        }
        public RemoveDeviceLinkPM(IStringTableManager i_stringTable, IBackendManager i_backendManager, ISceneManager i_sceneManager)
        {
            mStringTable    = i_stringTable;
            mBackendManager = i_backendManager;
            mSceneManager   = i_sceneManager;

            SetTextProperty();
            Hide();
        }
Example #5
0
        public bool HasRewardBeenClaimedToday(IBackendManager i_backend)
        {
            int curDay            = i_backend.GetBackend <IBasicBackend>().GetDateTime().DayOfYear;
            int curYear           = i_backend.GetBackend <IBasicBackend>().GetDateTime().Year;
            int lastCollectedDay  = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(LastCollectedTime).DayOfYear;
            int lastCollectedYear = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(LastCollectedTime).Year;

            return(lastCollectedYear == curYear && lastCollectedDay >= curDay);
        }
Example #6
0
        public ShowLoginPromosStep(IBackendManager i_backend, ILoginPromoPopupHelper i_popupHelper, ILoginPromoDisplaysPM i_allPromosPM, ILoginPromotionManager i_manager, IMessageService i_messenger, ISceneStartFlowManager i_sceneManager) : base(i_sceneManager)
        {
            mMessenger    = i_messenger;
            mPromoManager = i_manager;
            mAllPromosPM  = i_allPromosPM;
            mHelper       = i_popupHelper;

            ActivePromoSaveData = i_manager.GetActivePromoSaveData();
        }
        public HealthProbeWorker(ILogger <HealthProbeWorker> logger, IBackendManager backendManager, IBackendProberFactory backendProberFactory)
        {
            Contracts.CheckValue(logger, nameof(logger));
            Contracts.CheckValue(backendManager, nameof(backendManager));
            Contracts.CheckValue(backendProberFactory, nameof(backendProberFactory));

            _logger               = logger;
            _backendManager       = backendManager;
            _backendProberFactory = backendProberFactory;
        }
        public void CommonInstall()
        {
            MockBackend      = Substitute.For <IBackendManager>();
            MockMessenger    = Substitute.For <IMessageService>();
            MockPromoManager = Substitute.For <ILoginPromotionManager>();
            MockAllPromosPM  = Substitute.For <ILoginPromoDisplaysPM>();
            MockFlowManager  = Substitute.For <ISceneStartFlowManager>();
            MockHelper       = Substitute.For <ILoginPromoPopupHelper>();

            SetActiveProgressOnMockManagerWithIds(new List <string>());
        }
        public void WhenCreatingCountdown_RemainingTime_AsExpected(long i_serverTime, long i_targetTime, long i_expectedRemainingTime)
        {
            IBasicBackend mockBackend = Substitute.For <IBasicBackend>();

            mockBackend.GetDateTime().Returns(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(i_serverTime));

            IBackendManager mockBackendManager = Substitute.For <IBackendManager>();

            mockBackendManager.GetBackend <IBasicBackend>().Returns(mockBackend);

            MyCountdown systemUnderTest = new MyCountdown(mockBackendManager, i_targetTime, Substitute.For <ICountdownCallback>());

            Assert.AreEqual(i_expectedRemainingTime, systemUnderTest.RemainingTimeMs);
        }
        public ReverseProxyConfigManagerTests()
        {
            var httpClientFactoryMock = new Mock <IProxyHttpClientFactory>(MockBehavior.Strict);

            Mock <IProxyHttpClientFactoryFactory>()
            .Setup(p => p.CreateFactory())
            .Returns(httpClientFactoryMock.Object);

            // The following classes simply store information and using the actual implementations
            // is easier than replicating functionality with mocks.
            Provide <IEndpointManagerFactory, EndpointManagerFactory>();
            _backendManager = Provide <IBackendManager, BackendManager>();
            _routeManager   = Provide <IRouteManager, RouteManager>();
            Provide <IRuntimeRouteBuilder, RuntimeRouteBuilder>();
        }
Example #11
0
        public void IsNoChain_ReturnsAsExpected(DateTime i_curTime, DateTime i_lastCollectedTime, bool i_expected)
        {
            IBackendManager mockBackendManager = Substitute.For <IBackendManager>();
            IBasicBackend   mockBackend        = Substitute.For <IBasicBackend>();

            mockBackend.GetDateTime().Returns(i_curTime);
            mockBackendManager.GetBackend <IBasicBackend>().Returns(mockBackend);

            SingleLoginPromoProgressSaveData systemUnderTest = new SingleLoginPromoProgressSaveData();

            systemUnderTest.LastCollectedTime = (long)i_lastCollectedTime.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;

            bool hasClaimedToday = systemUnderTest.HasRewardBeenClaimedToday(mockBackendManager);

            Assert.AreEqual(i_expected, hasClaimedToday);
        }
        public HealthProbeWorkerTests()
        {
            // Set up all the parameter needed for healthProberWorker.
            Provide <IMonotonicTimer, MonotonicTimer>();
            Provide <ILogger, Logger <HealthProbeWorker> >();
            Mock <IProxyHttpClientFactoryFactory>()
            .Setup(f => f.CreateFactory())
            .Returns(new Mock <IProxyHttpClientFactory>().Object);

            // Set up backends. We are going to fake multiple service for us to probe.
            _backendManager = Provide <IBackendManager, BackendManager>();
            _backendConfig  = new BackendConfig(
                healthCheckOptions: new BackendConfig.BackendHealthCheckOptions(
                    enabled: true,
                    interval: TimeSpan.FromSeconds(1),
                    timeout: TimeSpan.FromSeconds(1),
                    port: 8000,
                    path: "/example"),
                loadBalancingOptions: default);
        public ReverseProxyConfigManager(
            ILogger <ReverseProxyConfigManager> logger,
            IDynamicConfigBuilder configBuilder,
            IRuntimeRouteBuilder routeEndpointBuilder,
            IBackendManager backendManager,
            IRouteManager routeManager,
            IProxyDynamicEndpointDataSource dynamicEndpointDataSource)
        {
            Contracts.CheckValue(logger, nameof(logger));
            Contracts.CheckValue(configBuilder, nameof(configBuilder));
            Contracts.CheckValue(routeEndpointBuilder, nameof(routeEndpointBuilder));
            Contracts.CheckValue(backendManager, nameof(backendManager));
            Contracts.CheckValue(routeManager, nameof(routeManager));
            Contracts.CheckValue(dynamicEndpointDataSource, nameof(dynamicEndpointDataSource));

            _logger                    = logger;
            _configBuilder             = configBuilder;
            _routeEndpointBuilder      = routeEndpointBuilder;
            _backendManager            = backendManager;
            _routeManager              = routeManager;
            _dynamicEndpointDataSource = dynamicEndpointDataSource;
        }
Example #14
0
 public BackendController(ILogger <BackendController> logger, IBackendManager backendManager)
 {
     this._logger        = logger;
     this.backendManager = backendManager;
 }
 public OpenTimedChestRequest(IBackendManager i_backend, string i_chestId)
 {
     mBackend = i_backend;
     mParams.Add(CHEST_ID, i_chestId);
 }
Example #16
0
 public void CommonInstall()
 {
     MockRewardSpawner = Substitute.For <IDungeonRewardSpawner>();
     MockAllPromosPM   = Substitute.For <ILoginPromoDisplaysPM>();
     MockBackend       = Substitute.For <IBackendManager>();
 }
 public LoginPromoPopupHelper(IDungeonRewardSpawner i_rewardSpawner, IBackendManager i_backend, ILoginPromoDisplaysPM i_allDisplaysPM)
 {
     mAllPromosPM   = i_allDisplaysPM;
     mBackend       = i_backend;
     mRewardSpawner = i_rewardSpawner;
 }