コード例 #1
0
ファイル: PushTests.cs プロジェクト: jy-base/carwash
        public async Task Register_ByDefault_ReturnsNoContent()
        {
            var userControllerStub     = CreateUserControllerStub();
            var hostingEnvironmentStub = new Mock <IHostingEnvironment>();
            var pushServiceMock        = new Mock <IPushService>();

            pushServiceMock.Setup(m => m.Register(It.IsAny <PushSubscription>())).Returns(Task.CompletedTask);
            var controller = new PushController(userControllerStub.Object, hostingEnvironmentStub.Object, pushServiceMock.Object);
            var model      = new PushSubscriptionViewModel
            {
                Subscription = new Subscription
                {
                    Endpoint       = "https://db5p.notify.windows.com/w/?token=BQYAAACt1jdFc8Z7mH6fQOhqwzfh...",
                    ExpirationTime = 1551728506000,
                    Keys           = new Keys
                    {
                        Auth   = "_PhChqC4oDiArJ-DpkfNrQ",
                        P256Dh = "BNyBjPuc30Akf7lvT7OtZUimZOgI...",
                    },
                },
            };

            var result = await controller.Register(model);

            Assert.IsType <NoContentResult>(result);
            pushServiceMock.Verify(m => m.Register(It.IsAny <PushSubscription>()), Times.Once());
        }
コード例 #2
0
    public void PushTarget(Vector2 pushForce)
    {
        PushController closestTarget = GetClosestTarget();

        if (closestTarget != null)
        {
            closestTarget.GetPushed(pushForce, GetComponentInParent <Player>());
        }
    }
コード例 #3
0
 private void GetReferences()
 {
     controller         = GetComponent <AssignedController>();
     pushController     = GetComponentInChildren <PushController>();
     rotationController = GetComponent <RotationController>();
     player             = GetComponent <Player>();
     animator           = GetComponent <Animator>();
     rb2d        = GetComponent <Rigidbody2D>();
     playerAudio = GetComponent <PlayerAudio>();
 }
コード例 #4
0
ファイル: Player.cs プロジェクト: RobinVondrak/FranticFour
 private void GetReferences()
 {
     deathController         = GetComponent <DeathController>();
     movementController      = GetComponent <MovementController>();
     playerActionsController = GetComponent <PlayerActionsController>();
     respawnController       = GetComponent <RespawnController>();
     pushController          = GetComponentInChildren <PushController>();
     rotationController      = GetComponent <RotationController>();
     afterImageController    = GetComponent <AfterImageController>();
     animator = GetComponent <Animator>();
 }
コード例 #5
0
        public async Task UnitTest_PostAsync()
        {
            var setup = mockHttpPushService.Setup(h => h.SendAsync(It.IsAny <Message>()))
                        .ReturnsAsync(new Mock <Response>().Object);

            PushController controller = new PushController(mockHttpPushService.Object);


            var response = await controller.PostAsync(GetValidMessage());

            mockHttpPushService.Verify(x => x.SendAsync(It.IsAny <Message>()), Times.Once());

            Assert.NotNull(response);
        }
コード例 #6
0
ファイル: PushTests.cs プロジェクト: jy-base/carwash
        public void GetVapidPublicKey_ByDefault_ReturnsVapidPublicKey()
        {
            var          userControllerStub     = new Mock <IUsersController>();
            var          hostingEnvironmentStub = new Mock <IHostingEnvironment>();
            var          pushServiceMock        = new Mock <IPushService>();
            const string PUBLIC_KEY             = "test public key";

            pushServiceMock.Setup(m => m.GetVapidPublicKey()).Returns(PUBLIC_KEY);
            var controller = new PushController(userControllerStub.Object, hostingEnvironmentStub.Object, pushServiceMock.Object);

            var result = controller.GetVapidPublicKey();

            Assert.IsType <ActionResult <string> >(result);
            Assert.IsType <OkObjectResult>(result.Result);
            var ok = (OkObjectResult)result.Result;

            Assert.IsType <string>(ok.Value);
            var publicKey = (string)ok.Value;

            Assert.Equal(PUBLIC_KEY, publicKey);
            pushServiceMock.Verify(m => m.GetVapidPublicKey(), Times.Once());
        }
コード例 #7
0
ファイル: ParsePush.cs プロジェクト: longyunzhou/NFC
 /// <summary>
 /// Request a push to be sent. When this task completes, LeanCloud has successfully acknowledged a request
 /// to send push notifications but has not necessarily finished sending all notifications
 /// requested. The current status of recent push notifications can be seen in your Push Notifications
 /// console on http://parse.com
 /// </summary>
 /// <param name="cancellationToken">CancellationToken to cancel the current operation.</param>
 public Task SendAsync(CancellationToken cancellationToken)
 {
     return(PushController.SendPushNotificationAsync(state, cancellationToken));
 }
コード例 #8
0
 /// <summary>
 /// Request a push to be sent. When this task completes, LeanCloud has successfully acknowledged a request
 /// to send push notifications but has not necessarily finished sending all notifications
 /// requested. The current status of recent push notifications can be seen in your Push Notifications
 /// console on https://api.leancloud.cn
 /// </summary>
 /// <param name="cancellationToken">CancellationToken to cancel the current operation.</param>
 public Task SendAsync(CancellationToken cancellationToken)
 {
     return(PushController.SendPushNotificationAsync(state, AVUser.CurrentSessionToken, cancellationToken));
 }
コード例 #9
0
 private void doSave()
 {
     PushController.pushData();
 }