Exemplo n.º 1
0
 public void ConvertNullAPIToSDK()
 {
     apiHandover1 = null;
     converter    = new HandoverConverter(apiHandover1);
     Assert.IsNull(converter.ToAPIHandover());
     Assert.IsNull(converter.ToSDKHandover("ko"));
 }
Exemplo n.º 2
0
 private OneSpanSign.API.Handover CreateTypicalAPILink()
 {
     OneSpanSign.API.Handover apiHandover = new OneSpanSign.API.Handover();
     apiHandover.Href  = "apiHref";
     apiHandover.Title = "apiTitle";
     apiHandover.Text  = "apiText";
     return(apiHandover);
 }
Exemplo n.º 3
0
        public void ConvertSDKToAPI()
        {
            sdkHandover1 = CreateTypicalSDKHandover();
            apiHandover1 = new HandoverConverter(sdkHandover1).ToAPIHandover();

            Assert.IsNotNull(apiHandover1);
            Assert.AreEqual(apiHandover1.Href, sdkHandover1.Href);
            Assert.AreEqual(apiHandover1.Text, sdkHandover1.Text);
            Assert.AreEqual(apiHandover1.Title, sdkHandover1.Title);
        }
Exemplo n.º 4
0
        public void ConvertAPIToAPI()
        {
            apiHandover1 = CreateTypicalAPILink();
            apiHandover2 = new HandoverConverter(apiHandover1).ToAPIHandover();

            Assert.IsNotNull(apiHandover2);
            Assert.AreEqual(apiHandover2.Href, apiHandover1.Href);
            Assert.AreEqual(apiHandover2.Text, apiHandover1.Text);
            Assert.AreEqual(apiHandover2.Title, apiHandover1.Title);
        }
Exemplo n.º 5
0
        public void ConvertAPIToSDK()
        {
            apiHandover1 = CreateTypicalAPILink();
            sdkHandover1 = new HandoverConverter(apiHandover1).ToSDKHandover(lang);

            Assert.IsNotNull(sdkHandover1);
            Assert.AreEqual(sdkHandover1.Language, lang);
            Assert.AreEqual(sdkHandover1.Href, apiHandover1.Href);
            Assert.AreEqual(sdkHandover1.Text, apiHandover1.Text);
            Assert.AreEqual(sdkHandover1.Title, apiHandover1.Title);
        }
Exemplo n.º 6
0
        internal OneSpanSign.API.Handover ToAPIHandover()
        {
            if (sdkHandover == null)
            {
                return(apiHandover);
            }

            OneSpanSign.API.Handover result = new OneSpanSign.API.Handover();
            result.Href  = sdkHandover.Href;
            result.Text  = sdkHandover.Text;
            result.Title = sdkHandover.Title;

            return(result);
        }
Exemplo n.º 7
0
        public OneSpanSign.API.Handover GetHandoverUrl(string language)
        {
            string path = template.UrlFor(UrlTemplate.HANDOVER_URL_PATH)
                          .Replace("{language}", language)
                          .Build();

            try
            {
                string stringResponse = restClient.Get(path);
                OneSpanSign.API.Handover apiResponse = JsonConvert.DeserializeObject <OneSpanSign.API.Handover>(stringResponse, jsonSettings);
                return(apiResponse);
            }
            catch (OssServerException e)
            {
                throw new OssServerException("Could not get handover url.", e);
            }
            catch (Exception e)
            {
                throw new OssException("Could not get handover url.", e);
            }
        }
Exemplo n.º 8
0
 public Handover GetHandoverUrl(string language)
 {
     OneSpanSign.API.Handover apiHandover = apiClient.GetHandoverUrl(language);
     return(new HandoverConverter(apiHandover).ToSDKHandover(language));
 }
Exemplo n.º 9
0
 internal HandoverConverter(OneSpanSign.API.Handover apiHandover)
 {
     this.apiHandover = apiHandover;
 }