Ejemplo n.º 1
0
        public void CreateTest()
        {
            var expected = new FileTransfer(); // TODO: Initialize to an appropriate value
            var actual   = TransferFactory.Create();

            Assert.AreSame(expected.GetType(), actual.GetType());
        }
Ejemplo n.º 2
0
        public void AddNewMethodTest()
        {
            TransferFactory.AddNewMethod <FileTransfer>("test");
            IFileTransfer expected = new FileTransfer();
            var           actual   = TransferFactory.Create("test");

            Assert.AreSame(expected.GetType(), actual.GetType());
        }
Ejemplo n.º 3
0
 private IFileTransfer CreateFileTransferInstance(ActivityContext context)
 {
     if (TransferMethod.Get <string>(context).ContainsCharacters())
     {
         return(TransferFactory.Create(TransferMethod.Get <string>(context)));
     }
     return(TransferFactory.Create(TransferMethods.Http));
 }
Ejemplo n.º 4
0
        public void CreateFtpReadTest1()
        {
            var type     = "Ftp";
            var expected = typeof(FtpTrasfer);
            var actual   = TransferFactory.Create(type)
                           .SetServerRootUrl("127.0.0.1")
                           //.SetUserNameAndPassword(GetUserName(), GetPassword())
                           .SetFileName("/test/test.txt");
            var file = actual.Read();

            Assert.IsInstanceOfType(actual, expected);
            Assert.IsTrue(file.Length > 0);
        }
Ejemplo n.º 5
0
 public void CreateCustomMethodTest()
 {
     try
     {
         TransferFactory.Create(TransferMethods.Custom);
         Assert.Fail();
     }
     catch
     {
         TransferFactory.BindCustomMethod <FileTransfer>();
         var custom = TransferFactory.Create(TransferMethods.Custom);
         Assert.IsInstanceOfType(custom, typeof(FileTransfer));
     }
 }
Ejemplo n.º 6
0
        //[TestMethod()]
        public void CreateHttpReadTest()
        {
            var type     = TransferMethods.Http;
            var expected = typeof(HttpFileTrasfer);
            var actual   = TransferFactory.Create(type)
                           .SetServerRootUrl(@"http://pdv-devwintfs1")
                           .SetFileName("/Shared%20Documents/Test.txt")
                           .SetUserNameAndPassword(GetHttpUserName(), GetPassword());
            var file = actual.Read();
            var data = EncodingFactory.Check(file, file.Length).GetString(file);

            Assert.IsInstanceOfType(actual, expected);
            Assert.AreEqual("Dette er en test", data);
        }
Ejemplo n.º 7
0
        public void CreateFtpReadTest()
        {
            var type     = TransferMethods.Ftp;
            var expected = typeof(FtpTrasfer);
            var actual   = TransferFactory.Create(type)
                           .SetServerRootUrl("127.0.0.1")
                           .SetFileName("/test/test.txt").SetUserNameAndPassword(GetUserName(), GetPassword());
            var file     = actual.Read();
            var encoding = EncodingFactory.Check(file, file.Length);
            var data     = encoding.GetString(file);

            Assert.IsInstanceOfType(actual, expected);
            Assert.IsTrue("Dette er en test".Equals(data));
        }
Ejemplo n.º 8
0
 public static IFileTransfer GetProvider(this TransferMethods type)
 {
     return(TransferFactory.Create(type));
 }