public void ConvertNullSDKToSDK()
        {
            sdkMessage1 = null;
            converter   = new MessageConverter(sdkMessage1);

            Assert.IsNull(converter.ToSDKMessage());
        }
        public void ConvertNullSDKToSDK()
        {
            sdkMessage1 = null;
            converter = new MessageConverter(sdkMessage1);

            Assert.IsNull(converter.ToSDKMessage());
        }
        public void ConvertSDKToSDK()
        {
            sdkMessage1 = CreateTypicalSDKMessage();
            sdkMessage2 = new MessageConverter(sdkMessage1).ToSDKMessage();

            Assert.IsNotNull(sdkMessage2);
            Assert.AreEqual(sdkMessage1, sdkMessage2);
        }
        public void ConvertSDKToSDK()
        {
            sdkMessage1 = CreateTypicalSDKMessage();
            sdkMessage2 = new MessageConverter(sdkMessage1).ToSDKMessage();

            Assert.IsNotNull(sdkMessage2);
            Assert.AreEqual(sdkMessage1, sdkMessage2);
        }
        public void ConvertSDKToAPI()
        {
            sdkMessage1 = CreateTypicalSDKMessage();
            apiMessage1 = new MessageConverter(sdkMessage1).ToAPIMessage();

            Assert.IsNotNull(apiMessage1);
            Assert.AreEqual(sdkMessage1.Content, apiMessage1.Content);
            Assert.AreEqual(sdkMessage1.Status.ToString(), apiMessage1.Status.ToString());
            Assert.AreEqual(sdkMessage1.Created, apiMessage1.Created);
            Assert.AreEqual(sdkMessage1.From.FirstName, apiMessage1.From.FirstName);
            Assert.AreEqual(sdkMessage1.From.LastName, apiMessage1.From.LastName);
            Assert.AreEqual(sdkMessage1.From.Id, apiMessage1.From.Id);
            Assert.AreEqual(sdkMessage1.From.Email, apiMessage1.From.Email);
            Assert.AreEqual(sdkMessage1.To["*****@*****.**"].FirstName, apiMessage1.To[0].FirstName);
            Assert.AreEqual(sdkMessage1.To["*****@*****.**"].LastName, apiMessage1.To[0].LastName);
            Assert.AreEqual(sdkMessage1.To["*****@*****.**"].Email, apiMessage1.To[0].Email);
        }
        public void ConvertAPIToSDK()
        {
            apiMessage1 = CreateTypicalAPIMessage();
            sdkMessage1 = new MessageConverter(apiMessage1).ToSDKMessage();

            Assert.IsNotNull(sdkMessage1);
            Assert.AreEqual(apiMessage1.Content, sdkMessage1.Content);
            Assert.AreEqual(apiMessage1.Status.ToString(), sdkMessage1.Status.ToString());
            Assert.AreEqual(apiMessage1.Created, sdkMessage1.Created);
            Assert.AreEqual(apiMessage1.From.FirstName, sdkMessage1.From.FirstName);
            Assert.AreEqual(apiMessage1.From.LastName, sdkMessage1.From.LastName);
            Assert.AreEqual(apiMessage1.From.Id, sdkMessage1.From.Id);
            Assert.AreEqual(apiMessage1.From.Email, sdkMessage1.From.Email);
            Assert.AreEqual(apiMessage1.To[0].FirstName, sdkMessage1.To["*****@*****.**"].FirstName);
            Assert.AreEqual(apiMessage1.To[0].LastName, sdkMessage1.To["*****@*****.**"].LastName);
            Assert.AreEqual(apiMessage1.To[0].Email, sdkMessage1.To["*****@*****.**"].Email);
        }
        private Silanis.ESL.SDK.Message CreateTypicalSDKMessage()
        {
            Silanis.ESL.SDK.Signer fromSigner = SignerBuilder.NewSignerWithEmail("*****@*****.**")
                                                .WithFirstName("John")
                                                .WithLastName("Smith")
                                                .WithCustomId("user1")
                                                .Build();

            Silanis.ESL.SDK.Message sdkMessage = new Silanis.ESL.SDK.Message(Silanis.ESL.SDK.MessageStatus.NEW, "decline reason", fromSigner);

            sdkMessage.Created = DateTime.Now;

            IDictionary <string, Silanis.ESL.SDK.Signer> toSigners = new Dictionary <string, Silanis.ESL.SDK.Signer>();

            Silanis.ESL.SDK.Signer toSigner = SignerBuilder.NewSignerWithEmail("*****@*****.**")
                                              .WithFirstName("Patty")
                                              .WithLastName("Galant")
                                              .WithCustomId("user2")
                                              .Build();
            toSigners.Add(toSigner.Email, toSigner);
            sdkMessage.AddTo(toSigner);

            return(sdkMessage);
        }
        private Silanis.ESL.SDK.Message CreateTypicalSDKMessage()
        {
            Silanis.ESL.SDK.Signer fromSigner = SignerBuilder.NewSignerWithEmail("*****@*****.**")
                .WithFirstName("John")
                .WithLastName("Smith")
                .WithCustomId("user1")
                .Build();

            Silanis.ESL.SDK.Message sdkMessage = new Silanis.ESL.SDK.Message(Silanis.ESL.SDK.MessageStatus.NEW, "decline reason", fromSigner);

            sdkMessage.Created = DateTime.Now;

            IDictionary<string, Silanis.ESL.SDK.Signer> toSigners = new Dictionary<string, Silanis.ESL.SDK.Signer>();
            Silanis.ESL.SDK.Signer toSigner = SignerBuilder.NewSignerWithEmail("*****@*****.**")
                .WithFirstName("Patty")
                .WithLastName("Galant")
                .WithCustomId("user2")
                .Build();
            toSigners.Add(toSigner.Email, toSigner);
            sdkMessage.AddTo(toSigner);

            return sdkMessage;
        }