Exemplo n.º 1
0
        public async Task <ActionResult> Create(FormCollection collection)
        {
            try
            {
                string            userObjId  = System.Security.Claims.ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value;
                SessionTokenCache tokenCache = new SessionTokenCache(userObjId, HttpContext);

                string     tenantId    = System.Security.Claims.ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/tenantid").Value;
                string     authority   = "common";
                AuthHelper authHelper  = new AuthHelper(authority, ConfigurationManager.AppSettings["ida:AppId"], ConfigurationManager.AppSettings["ida:AppSecret"], tokenCache);
                string     accessToken = await authHelper.GetUserAccessToken(Url.Action("Index", "Home", null, Request.Url.Scheme));

                await RESTAPIHelper.CreateToDoItem(
                    accessToken,
                    collection["Title"],
                    collection["PriorityDD"],
                    collection["StatusDD"],
                    collection["PercentComplete"],
                    collection["StartDate"],
                    collection["EndDate"],
                    collection["Notes"]);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        //
        // GET: ToDoList
        public async Task <ActionResult> Index()
        {
            string accessToken = await GetAccessToken();

            await RESTAPIHelper.LoadWorkbook(accessToken);

            return(View(await RESTAPIHelper.GetToDoItems(accessToken)));
        }
Exemplo n.º 3
0
        public void ThenIGetAPIResponseInJsonFormat()
        {
            var expected = "something";
            var response = RESTAPIHelper.GetResponse();

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                Assert.That(response.Content, Is.EqualTo(expected), "Error Message");
            }
        }
Exemplo n.º 4
0
        public async Task <FileResult> GetChart()
        {
            string            userObjId  = System.Security.Claims.ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value;
            SessionTokenCache tokenCache = new SessionTokenCache(userObjId, HttpContext);

            string     tenantId    = System.Security.Claims.ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/tenantid").Value;
            string     authority   = "common";
            AuthHelper authHelper  = new AuthHelper(authority, ConfigurationManager.AppSettings["ida:AppId"], ConfigurationManager.AppSettings["ida:AppSecret"], tokenCache);
            string     accessToken = await authHelper.GetUserAccessToken(Url.Action("Index", "Home", null, Request.Url.Scheme));


            return(await RESTAPIHelper.getChartImage(accessToken));
        }
        public async Task <ActionResult> Create(FormCollection collection)
        {
            try
            {
                string accessToken = await GetAccessToken();

                await RESTAPIHelper.CreateToDoItem(
                    accessToken,
                    collection["Title"],
                    collection["PriorityDD"],
                    collection["StatusDD"],
                    collection["PercentComplete"],
                    collection["StartDate"],
                    collection["EndDate"],
                    collection["Notes"]);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 6
0
        public void ThenUserWillBeRegisteredSuccessfully()
        {
            var response = RESTAPIHelper.GetResponse();

            Assert.That(response.StatusCode, Is.EqualTo(201), "User is not registered");
        }
Exemplo n.º 7
0
 public void WhenICallAPostMethodToRegisterAUser()
 {
     RESTAPIHelper.CreatePostRequest();
 }
Exemplo n.º 8
0
 public void ThenIAmAbleToGetUserAccountInformation()
 {
     var response = RESTAPIHelper.GetResponse();
 }
Exemplo n.º 9
0
 public void WhenICallGetMethodForUserAccountInformationUsingAnd(string userid, long accountNumber)
 {
     RESTAPIHelper.CreateRequest2(userid, accountNumber);
 }
Exemplo n.º 10
0
 public void ThenIGetUserInformation()
 {
     var response = RESTAPIHelper.GetResponse();
 }
Exemplo n.º 11
0
 public void WhenICallGetMethodToGetUserInformationUsing(string userid)
 {
     RESTAPIHelper.CreateRequest1(userid);
 }
Exemplo n.º 12
0
 public void WhenICallGetMethodOfAPI()
 {
     RESTAPIHelper.CreateRequest();
 }
Exemplo n.º 13
0
 public void GivenIHaveAnEndpoint()
 {
     RESTAPIHelper.SetURL();
 }