コード例 #1
0
        public void TestRefreshToken()
        {
            string expiredToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTEyNzIzNzMsImV4cCI6MTU1MTI3MjM3M30.lqMpYLekfiCA9niarNFDW35evHoBzhmNEYgLrmNvsxU";

            //arrange
            CreateUser();
            sdk.injectThisToken(new dejamobile_takehome_sdk.Models.UserModel(testUser, testUserPassword), expiredToken);

            sdk.init();

            //act
            Task <TaskResult> temp   = sdk.AddCard(new dejamobile_takehome_sdk.Models.CardModel("nicolas debeaupte", "4143869183957495", "01/25", "123"));
            TaskResult        result = temp.Result;

            Assert.IsTrue(result.result);
        }
コード例 #2
0
        public void AddCard()
        {
            init();

            //act
            Task <TaskResult> temp   = sdk.AddCard(new dejamobile_takehome_sdk.Models.CardModel("nicolas debeaupte", "4143869183957495", "01/25", "123"));
            TaskResult        result = temp.Result;

            //ASSERTS
            //ensure result if true
            Assert.IsTrue(result.result);
            //ensure payload is CardModel typed
            Assert.IsTrue(result.payload.GetType() == typeof(dejamobile_takehome_sdk.Models.CardModel));
            //ensure card ownername is not empty
            Assert.IsTrue(((dejamobile_takehome_sdk.Models.CardModel)result.payload).ownerName.Length > 0);
            //ensure crypto is contains 3 digits
            Assert.IsTrue(((dejamobile_takehome_sdk.Models.CardModel)result.payload).crypto.Length == 3);
            //ensure cardnumber contains 16 digits
            Assert.IsTrue(((dejamobile_takehome_sdk.Models.CardModel)result.payload).cardNumber.Length == 16);
            //ensure expirationdate contains 5 digits and that a '/' is on pos 2 of the string
            Assert.IsTrue(((dejamobile_takehome_sdk.Models.CardModel)result.payload).expirationDate.Length == 5 && ((dejamobile_takehome_sdk.Models.CardModel)result.payload).expirationDate.Substring(2, 1) == "/");
        }