Esempio n. 1
0
    void Awake()
    {
        if (GameManager.instance != null)
        {
            if (GameManager.instance != this)
            {
                Destroy(this.gameObject);
            }
        }
        else
        {
            instance = this;
        }

        if (rules == null)
        {
            rules = GetComponent <RulesController>();
        }
        if (_inputRules == null)
        {
            _inputRules = GetComponent <KeyController>();
        }
        _play = true;
        ChoosePlayer();
        Pause();
        StartCoroutine(Action());
    }
        public void EvaluateMinBal_InvalidData()
        {
            var             balance    = 500;
            var             accountid  = 1001;
            RulesController controller = new RulesController();
            string          result     = controller.EvaluateMinBal(balance, accountid);

            Assert.AreEqual(result, "Denied");
        }
Esempio n. 3
0
 void OnDestroy()
 {
     GoogleMobileAdsController.Instance.HideBanner();
     Debug.Log("RulesController:OnDestroy()");
     if(rulesController != null)
     {
         rulesController = null;
     }
 }
Esempio n. 4
0
        private async Task CreateRulesAsync()
        {
            var c = new RulesController(_context);

            foreach (var rule in rules)
            {
                var result = await c.Create(new RuleModel { RuleID = rule.RuleID, Name = rule.Name, RuleStatus = rule.RuleStatus });
            }
        }
Esempio n. 5
0
 public void Setup()
 {
     _rulesRepo           = new RulesRepository();
     _rulesRepoMock       = new Mock <IRulesRepository>();
     _balanceProviderMock = new Mock <IBalanceProvider>();
     _monthlyProviderMock = new Mock <IMonthlyJobProvider>();
     _rulesController     = new RulesController(_balanceProviderMock.Object, _monthlyProviderMock.Object);
     _rulesRepoMock.Setup(x => x.GetMinBalance(It.IsAny <int>())).Returns(1000);
     _balanceProviderMock.Setup(x => x.GetMinBalance(It.IsAny <int>())).Returns(1000);
 }
        public void getServiceCharges_BalanceIsLessthanMinimumBakance_ReturnsServiceCharges()
        {
            var mock = new Mock <IRulesRep>();

            mock.Setup(p => p.getServiceCharges()).Returns(s1);
            RulesController obj  = new RulesController(mock.Object);
            var             data = obj.getServiceCharges();
            var             res  = data as OkObjectResult;

            Assert.AreEqual(res.StatusCode, 200);
        }
Esempio n. 7
0
        public void Arrange()
        {
            _mediator    = new Mock <IMediator>();
            _rulesResult = new GetAccountRulesResult {
                GlobalRules = new List <GlobalRule>()
            };
            _mediator.Setup(x => x.Send(It.IsAny <GetAccountRulesQuery>(),
                                        It.IsAny <CancellationToken>()))
            .ReturnsAsync(_rulesResult);

            _rulesController = new RulesController(_mediator.Object);
        }
Esempio n. 8
0
        private async Task DeleteAllRulesAsync()
        {
            var c     = new RulesController(_context);
            var index = await c.Index();

            var list = (Microsoft.AspNetCore.Mvc.ViewResult)index;

            foreach (var rule in (List <RuleModel>)list.Model)
            {
                var result = await c.DeleteConfirmed(rule.RuleID);
            }
        }
Esempio n. 9
0
        public void Arrange()
        {
            _mediator        = new Mock <IMediator>();
            _rulesController = new RulesController(_mediator.Object);

            _command = new CreateUserRuleAcknowledgementCommand
            {
                Id         = Guid.NewGuid().ToString(),
                RuleId     = 1234,
                TypeOfRule = RuleType.GlobalRule
            };
        }
Esempio n. 10
0
        public void Arrange()
        {
            _fixture = new Fixture();
            _accountLegalEntityId = _fixture.Create <long>();
            _datesResult          = new GetAvailableDatesResult {
                AvailableDates = new List <AvailableDateStartWindow>()
            };
            _mediator = new Mock <IMediator>();
            _mediator.Setup(x => x.Send(It.Is <GetAvailableDatesQuery>(query => query.AccountLegalEntityId == _accountLegalEntityId),
                                        It.IsAny <CancellationToken>()))
            .ReturnsAsync(_datesResult);

            _rulesController = new RulesController(_mediator.Object);
        }
 public void getServiceCharges_BalanceIsMorethanMinimumBakance_NoServiceChargeapplicable()
 {
     try {
         var mock = new Mock <IRulesRep>();
         mock.Setup(p => p.getServiceCharges()).Returns(s1);
         RulesController obj  = new RulesController(mock.Object);
         var             data = obj.getServiceCharges();
         var             res  = data as BadRequestResult;
         Assert.AreEqual(400, res.StatusCode);
     }
     catch (Exception e)
     {
         Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
     }
 }
 public void evaluateMinBalSavings_IncorrectBalancePassed_ReturnsBadRequestResult()
 {
     try
     {
         var mock = new Mock <IRulesRep>();
         mock.Setup(p => p.evaluateMinBalSavings()).Returns(rm);
         RulesController obj  = new RulesController(mock.Object);
         var             data = obj.evaluateMinBalSavings();
         var             res  = data as BadRequestObjectResult;
         Assert.AreEqual(400, res.StatusCode);
     }
     catch (Exception e)
     {
         Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
     }
 }
Esempio n. 13
0
        public RulesControllerTest()
        {
            var mockIotHubClient   = new Mock <IIotHubManagerClient>();
            var mockBlobClient     = new Mock <IBlobStorageClient>();
            var mockStorageAdapter = new Mock <IStorageAdapterClient>();
            var mockConvertLogger  = new Mock <ILogger <RulesConverter> >();
            var mockLogger         = new Mock <ILogger <BeginConversionHelper> >();

            this.mockGenerator = new Mock <IKeyGenerator>();

            this.mockConverter = new Mock <RulesConverter>(
                mockBlobClient.Object,
                mockStorageAdapter.Object,
                mockConvertLogger.Object);
            this.mockHelper = new Mock <BeginConversionHelper>(
                mockIotHubClient.Object,
                mockLogger.Object,
                this.mockGenerator.Object);

            var mockHttpContext = new Mock <HttpContext> {
                DefaultValue = DefaultValue.Mock
            };
            var mockHttpRequest = new Mock <HttpRequest> {
                DefaultValue = DefaultValue.Mock
            };

            mockHttpRequest.Setup(m => m.HttpContext).Returns(mockHttpContext.Object);
            mockHttpContext.Setup(m => m.Request).Returns(mockHttpRequest.Object);

            this.controller = new RulesController(
                this.mockConverter.Object,
                this.mockHelper.Object)
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = mockHttpContext.Object,
                },
            };
            this.contextItems = new Dictionary <object, object>
            {
                { RequestExtension.ContextKeyTenantId, MockTenantId },
            };
            mockHttpContext.Setup(m => m.Items).Returns(this.contextItems);
        }
Esempio n. 14
0
 public void Setup()
 {
     _ruleProviderMock = new Mock <IRuleProvider>();
     _rulesController  = new RulesController(_ruleProviderMock.Object);
 }
Esempio n. 15
0
 void Awake()
 {
     rulesController = this;
     GoogleMobileAdsController.Instance.ShowInterstitial();
     GoogleMobileAdsController.Instance.HideBanner();
 }