Example #1
0
        public void Response401()
        {
            SilaApi failApi = new SilaApi(DefaultConfig.environment,
                                          "3a1076bf45ab87712ad64ccb3b10217737f7faacbf2872e88fdd9a537d8fe266",
                                          DefaultConfig.appHandle);
            var response = failApi.CheckHandle(DefaultConfig.FirstUser.UserHandle);

            Assert.AreEqual(401, response.StatusCode, "Bad app signature should fail - CheckHandle");
        }
Example #2
0
        public void Response200Failure()
        {
            var firstHandle   = DefaultConfig.FirstUser.UserHandle;
            var firstResponse = api.CheckHandle(firstHandle);

            Assert.AreEqual(200, firstResponse.StatusCode);
            Assert.AreEqual("FAILURE", ((BaseResponse)firstResponse.Data).Status, $"{firstHandle} should not be available");

            var secondHandle   = DefaultConfig.SecondUser.UserHandle;
            var secondResponse = api.CheckHandle(secondHandle);

            Assert.AreEqual(200, secondResponse.StatusCode);
            Assert.AreEqual("FAILURE", ((BaseResponse)secondResponse.Data).Status, $"{secondHandle} should not be available");

            var thirdHandle   = DefaultConfig.ThirdUser.UserHandle;
            var thirdResponse = api.CheckHandle(thirdHandle);

            Assert.AreEqual(200, thirdResponse.StatusCode);
            Assert.AreEqual("FAILURE", ((BaseResponse)thirdResponse.Data).Status, $"{thirdHandle} should not be available");
        }
Example #3
0
        public void Response200Success()
        {
            var firstResponse = api.CheckHandle(DefaultConfig.FirstUser.UserHandle);


            Assert.AreEqual(200, firstResponse.StatusCode, $"{DefaultConfig.FirstUser.UserHandle} should be available");
            Assert.AreEqual("SUCCESS", ((BaseResponse)firstResponse.Data).Status, $"{DefaultConfig.FirstUser.UserHandle} should be available");

            var secondResponse = api.CheckHandle(DefaultConfig.SecondUser.UserHandle);

            Assert.AreEqual(200, secondResponse.StatusCode, $"{DefaultConfig.SecondUser.UserHandle} should be available");
            Assert.AreEqual("SUCCESS", ((BaseResponse)secondResponse.Data).Status, $"{DefaultConfig.SecondUser.UserHandle} should be available");

            var thirdResponse = api.CheckHandle(DefaultConfig.ThirdUser.UserHandle);

            Assert.AreEqual(200, thirdResponse.StatusCode, $"{DefaultConfig.ThirdUser.UserHandle} should be available");
            Assert.AreEqual("SUCCESS", ((BaseResponse)thirdResponse.Data).Status, $"{DefaultConfig.ThirdUser.UserHandle} should be available");

            var fourthResponse = api.CheckHandle(DefaultConfig.FourthUser.UserHandle);

            Assert.AreEqual(200, fourthResponse.StatusCode, $"{DefaultConfig.FourthUser.UserHandle} should be available");
            Assert.AreEqual("SUCCESS", ((BaseResponse)fourthResponse.Data).Status, $"{DefaultConfig.FourthUser.UserHandle} should be available");
        }