Esempio n. 1
0
        private static void Main(string[] args)
        {
            var password = "******";
            var salt     = "rz8LuOtFBXphj9WQfvFh"; // Generated at https://www.random.org/strings
            var tokenKey = TokenFactory.CreateTokenKeyWithPassword(password, salt);

            /*
             * on client ui
             * -salt is stored on clear text
             * -password is entered and token key is created from that using the salt and the resulting key is stored on client
             * -username is entered and that is the token id and its stored
             * -claims is an extra thing***no need to discuss
             * -when request is to be made TOKENID AND TOKENKEY IS READY. CLAIMS AND SERVER ARE EASY STUFF
             */

            var templateService = new RESTEmailTemplateService();
            var _templateName   = Guid.NewGuid().ToString();
            var requestData     = GetRequestMergeData();
            var t1          = templateService.CreateTemplateAsync(_templateName).Result;
            var t2          = templateService.UpdateTemplateAsync(_templateName, Template).Result;
            var t3          = templateService.PublishTemplateAsync(_templateName).Result;
            var finalResult = templateService.SendEmailAsync(_templateName, requestData, _senderParams);

            var templates      = templateService.GetAllTemplatesAsync().Result;
            var firstTemplate  = templates.Response?.First(x => x.Name == _templateName);
            var loadedTemplate = templateService.GetTemplateAsync(_templateName);

            //Assert.IsTrue(finalResult.Response.IsSuccessfull);
            //Assert.AreEqual(Template, loadedTemplate.Response.Content);
            //Assert.AreEqual(1, templates.Response.Where(x => x.Name == _templateName).ToList().Count);
            //Assert.AreEqual(_templateName, firstTemplate.Name);
            //Assert.AreEqual(Template, firstTemplate.Content);
            Console.ReadLine();
        }