public void DifferentFileVersions() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { IList <WebDAV.Version> versions = WebDAV.GetVersions(SVN_ROOT, SVN_UNAME, SVN_UPSW).ToList(); WebDAV.Version v1530 = versions.First(v => v.Name == "1530"); WebDAV.Version v1531 = versions.First(v => v.Name == "1531"); var client1530 = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW, version: v1530); var client1531 = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW, version: v1531); WebDAV.Directory root1530 = client1530.Root; WebDAV.Directory root1531 = client1531.Root; WebDAV.File file1530 = root1530.NavigatePath("trunk/Source/NFX.Web/IO/FileSystem/SVN/WebDAV.cs") as WebDAV.File; WebDAV.File file1531 = root1531.NavigatePath("trunk/Source/NFX.Web/IO/FileSystem/SVN/WebDAV.cs") as WebDAV.File; using (MemoryStream ms1530 = new MemoryStream()) { using (MemoryStream ms1531 = new MemoryStream()) { file1530.GetContent(ms1530); file1531.GetContent(ms1531); Assert.AreNotEqual(ms1530.Length, ms1531.Length); } } } }
public void NavigateChildDir() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { var fs = FS.Instances["NFX-SVN"]; using (var session = fs.StartSession()) { { var dir = session["trunk"] as FileSystemDirectory; Assert.IsNotNull(dir); Assert.AreEqual("/trunk", dir.Path); Assert.AreEqual("/", dir.ParentPath); } { var dir = session["trunk/Source"] as FileSystemDirectory; Assert.IsNotNull(dir); Assert.AreEqual("/trunk/Source", dir.Path); Assert.AreEqual("/trunk", dir.ParentPath); } } } }
public void CreateWriteReadFile_1() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { var fs = FS.FileSystem.Instances[NFX_S3]; using (var session = fs.StartSession()) { var dir = session[S3_ROOT_FS] as FileSystemDirectory; using (var file = dir.CreateFile(FN2_FS)) { var str = file.FileStream; var wri = new BinaryWriter(str); wri.Write("Hello!"); wri.Write(true); wri.Write(27.4d); wri.Close(); } using (var file = session[fs.CombinePaths(S3_ROOT_FS, FN2_FS)] as FileSystemFile) { var str = file.FileStream; var rdr = new BinaryReader(str); Assert.AreEqual("Hello!", rdr.ReadString()); Assert.AreEqual(true, rdr.ReadBoolean()); Assert.AreEqual(27.4d, rdr.ReadDouble()); } } } }
public void CreateDeleteFile() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { var fs = FS.FileSystem.Instances[NFX_S3]; using (var session = fs.StartSession()) { var dir = session[S3_ROOT_FS] as FileSystemDirectory; var file = dir.CreateFile(S3_FN1, 1500); Assert.AreEqual(S3_FN1, file.Name); IDictionary <string, string> headersFN1 = S3V4.GetItemMetadata(file.Path, S3_ACCESSKEY, S3_SECRETKEY, S3_BUCKET, S3_REGION, 0); Assert.AreEqual(1500, headersFN1["Content-Length"].AsInt()); Assert.AreEqual(1500, file.FileStream.Length); Assert.AreEqual(1500, file.Size); var file2 = session[fs.CombinePaths(S3_ROOT_FS, S3_FN1)]; Assert.IsNotNull(file2); Assert.IsTrue(file2 is FileSystemFile); Assert.AreEqual(S3_FN1, ((FileSystemFile)file2).Name); file.Dispose(); file2.Delete(); Assert.IsFalse(fileExists((FileSystemFile)file2)); } } }
public void CreateWriteReadFile_3_Async() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { var fs = FS.FileSystem.Instances[NFX_S3]; using (var session = fs.StartSession()) { var dirTask = session.GetItemAsync(S3_ROOT_FS); dirTask.ContinueWith(t => { var dir = t.Result as FileSystemDirectory; var createFileTask = dir.CreateFileAsync(FN4_FS); createFileTask.ContinueWith(t1 => { using (var file = t1.Result) { var writeTask1 = file.WriteAllTextAsync("Hello,"); writeTask1.Wait(); var writeTask2 = file.WriteAllTextAsync("this will overwrite"); writeTask2.ContinueWith(t2 => { var readTask = getFileText(session, fs.CombinePaths(S3_ROOT_FS, FN4_FS)); Assert.AreEqual("this will overwrite", readTask.Result); }); } }); }); } } }
public void TaxRegistry_01() { using (new ServiceBaseApplication(new string[] { }, LACONF.AsLaconicConfig())) { Assert.IsNotNull(TaxCalculator.Instances["NOPCalculator"]); } }
public void GetVersionedFiles() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { IList <WebDAV.Version> versions = WebDAV.GetVersions(SVN_ROOT, SVN_UNAME, SVN_UPSW).ToList(); WebDAV.Version v1530 = versions.First(v => v.Name == "1530"); WebDAV.Version v1531 = versions.First(v => v.Name == "1531"); using (var fs = new SVNFileSystem("NFX-SVN")) { var session = fs.StartSession(CONN_PARAMS); session.Version = v1530; var file1530 = session["trunk/Source/NFX.Web/IO/FileSystem/SVN/WebDAV.cs"] as FileSystemFile; string content1530 = file1530.ReadAllText(); session.Version = v1531; var file1531 = session["trunk/Source/NFX.Web/IO/FileSystem/SVN/WebDAV.cs"] as FileSystemFile; string content1531 = file1531.ReadAllText(); Assert.AreNotEqual(content1530, content1531); } } }
public void CreateDeleteDir() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { var fs = FS.FileSystem.Instances[NFX_S3]; using (var session = fs.StartSession()) { var dir = session[S3_ROOT_FS] as FileSystemDirectory; var dir2 = dir[DIR_1] as FileSystemDirectory; Assert.IsNull(dir2); dir2 = dir.CreateDirectory(DIR_1); Assert.AreEqual(DIR_1, ((FileSystemDirectory)dir[DIR_1]).Name); Assert.AreEqual(DIR_1, ((FileSystemDirectory)dir2[""]).Name); Assert.IsTrue(folderExists(dir2)); Assert.AreEqual(DIR_1, dir2.Name); dir2.Delete(); Assert.IsFalse(folderExists(dir2)); } } }
public void Parallel_CreateWriteReadFile() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { var fs = FS.FileSystem.Instances[NFX_S3]; System.Threading.Tasks.Parallel.For(PARALLEL_FROM, PARALLEL_TO, (i) => { var fn = FN_PARALLEL_MASK.Args(i); using (var session = fs.StartSession()) { var dir = session[S3_ROOT_FS] as FileSystemDirectory; using (var file = dir.CreateFile(fn)) { file.WriteAllText("Hello, {0}".Args(i)); } using (var file = session[fs.CombinePaths(S3_ROOT_FS, fn)] as FileSystemFile) { Assert.AreEqual("Hello, {0}".Args(i), file.ReadAllText()); file.Delete(); } Assert.IsNull(session[fs.CombinePaths(S3_ROOT_FS, fn)]); } });//Parallel.For } }
public void GetAuthTokenTest() { var conf = LACONF.AsLaconicConfig(); var paySystem = getPaySystem(); using (var app = new ServiceBaseApplication(null, conf)) using (var session = paySystem.StartSession()) { Assert.IsNotNull(session); Assert.IsInstanceOf <PayPalSession>(session); Assert.IsNotNull(session.User); Assert.AreEqual(session.User.AuthenticationType, PayPalSystem.PAYPAL_REALM); Assert.IsNotNull(session.User.Credentials); Assert.IsInstanceOf <PayPalCredentials>(session.User.Credentials); Assert.IsNotNull(session.User.AuthToken.Data); Assert.IsInstanceOf <PayPalOAuthToken>(session.User.AuthToken.Data); var token = session.User.AuthToken.Data as PayPalOAuthToken; Assert.IsTrue(token.ObtainTime > App.TimeSource.Now.AddMinutes(-1)); Assert.IsTrue(token.ObtainTime < App.TimeSource.Now); Assert.AreEqual(3600, token.ExpirationMargin); Assert.IsNotNullOrEmpty(token.ApplicationID); Assert.IsTrue(token.ExpiresInSeconds > 0); Assert.IsNotNullOrEmpty(token.AccessToken); Assert.IsNotNullOrEmpty(token.Scope); Assert.IsNotNullOrEmpty(token.Nonce); } }
private PaySystem getPaySystem() { var paymentSection = LACONF.AsLaconicConfig()[WebSettings.CONFIG_WEBSETTINGS_SECTION][PaySystem.CONFIG_PAYMENT_PROCESSING_SECTION]; var ppSection = paymentSection.Children.First(p => p.AttrByName("name").Value == "PayPal"); var ps = PaySystem.Make <PayPalSystem>(null, ppSection); return(ps); }
public void Tax21_TaxJarRegistry() { using (new ServiceBaseApplication(new string[] { }, LACONF.AsLaconicConfig())) { var tj = TaxCalculator.Instances["TaxJar"]; Assert.IsNotNull(tj); Assert.IsNotNull(tj.DefaultSesssionConnectParamsCfg); } }
public void Tax01_NOPRegistry() { using (new ServiceBaseApplication(new string[] { }, LACONF.AsLaconicConfig())) { var nop = TaxCalculator.Instances["NOPCalculator"]; Assert.IsNotNull(nop); Assert.IsNotNull(nop.DefaultSesssionConnectParamsCfg); } }
public void GetHeadRootVersion() { using (new AzosApplication(null, LACONF.AsLaconicConfig())) { var client = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW); WebDAV.Version lastVersion = client.GetHeadRootVersion(); Aver.IsNotNull(lastVersion); } }
private void psAutostarted(string name) { using (new ServiceBaseApplication(new string[] { }, LACONF.AsLaconicConfig())) { var ps = PaySystem.Instances[name]; Assert.IsNotNull(ps, name + " wasn't created"); Assert.AreEqual(name, ps.Name); } }
public void GetHeadRootVersion() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { var client = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW); WebDAV.Version lastVersion = client.GetHeadRootVersion(); Assert.IsNotNull(lastVersion); } }
private void psAutostarted(string name) { using (new ServiceBaseApplication(new string[] { }, LACONF.AsLaconicConfig())) { var sn = SocialNetwork.Instances[name]; Aver.IsNotNull(sn, name + " wasn't created"); Aver.AreEqual(name, sn.Name); } }
public void Tax02_NOPSession() { using (new ServiceBaseApplication(new string[] { }, LACONF.AsLaconicConfig())) { var nop = TaxCalculator.Instances["NOPCalculator"]; using (var sess = nop.StartSession()) { Assert.AreEqual("*****@*****.**", sess.User.Name); } } }
public void FailedFastTimeout() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { var fs = FS.Instances["NFX-SVN"]; using (var session = fs.StartSession(CONN_PARAMS_TIMEOUT)) { var dir = session[string.Empty] as FileSystemDirectory; } } }
private void initialize() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { using (Stream s = new FileStream(FN2_FS_FULLPATH, FileMode.Create, FileAccess.Write)) { s.Write(CONTENT2_BYTES, 0, CONTENT2_BYTES.Length); } S3V4.PutFolder(S3_ROOT_FS, S3_ACCESSKEY, S3_SECRETKEY, S3_BUCKET, S3_REGION, 0); } }
public void RefundFullTwoParts() { var conf = LACONF.AsLaconicConfig(); using (new ServiceBaseApplication(null, conf)) { var ps = PaySystem.Instances["stripe"]; using (var pss = ps.StartSession()) { PayTestCommon.RefundFullTwoParts(pss); } } }
public void TransferToCardWithBillingAddressInfo() { var conf = LACONF.AsLaconicConfig(); using (new ServiceBaseApplication(null, conf)) { var ps = PaySystem.Instances["mock"]; using (var pss = ps.StartSession()) { PayTestCommon.TransferToCardWithBillingAddressInfo(pss); } } }
public void GetFileContent() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { var fs = FS.Instances["NFX-SVN"]; using (var session = fs.StartSession()) { var file = session["/trunk/Source/NFX/LICENSE.txt"] as FileSystemFile; Assert.IsTrue(file.ReadAllText().IsNotNullOrEmpty()); } } }
public void PayoutWithUngegisteredPPUserTest() { var conf = LACONF.AsLaconicConfig(); var paySystem = getPaySystem(); using (var app = new ServiceBaseApplication(null, conf)) using (var session = paySystem.StartSession() as PayPalSession) { var to = new Account("user", 212, 3000011); var amount = new Amount("USD", 1.0m); session.Transfer(null, Account.EmptyInstance, to, amount); } }
public void CapturePartial() { var conf = LACONF.AsLaconicConfig(); using (new ServiceBaseApplication(null, conf)) { var ps = PaySystem.Instances["mock"]; using (var pss = ps.StartSession()) { PayTestCommon.CapturePartial(pss); } } }
public void PayoutLimitExceedPayoutTest() { var conf = LACONF.AsLaconicConfig(); var paySystem = getPaySystem(); using (var app = new ServiceBaseApplication(null, conf)) using (var session = paySystem.StartSession() as PayPalSession) { var to = new Account("user", 211, 3000001); var amount = new Amount("USD", 100000.0m); // paypal payout limit is $10k var transaction = session.Transfer(null, Account.EmptyInstance, to, amount); } }
public void Tax03_NOPCalc_ILCATX() { using (new ServiceBaseApplication(new string[] { }, LACONF.AsLaconicConfig())) { var nop = TaxCalculator.Instances["NOPCalculator"]; using (var sess = nop.StartSession()) { var result = sess.Calc(IL_ADDRESS, new [] { "IL" }, CA_ADDRESS, new [] { "CA" }, new string[] {}, TX_ADDRESS, new Amount("usd", 30M), new Amount("usd", 50M), new Amount("usd", 0M)); Assert.NotNull(result); Assert.IsTrue(result.IsNone); } } }
public void TransferToBank() { var conf = LACONF.AsLaconicConfig(); using (new ServiceBaseApplication(null, conf)) { var ps = PaySystem.Instances["stripe"]; using (var pss = ps.StartSession()) { PayTestCommon.TransferToBank(pss); } } }
public void RefundDifferentCurrency() { var conf = LACONF.AsLaconicConfig(); using (new ServiceBaseApplication(null, conf)) { var ps = PaySystem.Instances["mock"]; using (var pss = ps.StartSession()) { PayTestCommon.RefundDifferentCurrency(pss); } } }
public void EscapeFile() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { var client = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW); var f = client.Root.NavigatePath("trunk/Source/Testing/NUnit/NFX.NUnit.Integration/IO/FileSystem/SVN/Esc Folder+/Escape.txt") as WebDAV.File; var ms = new MemoryStream(); f.GetContent(ms); var s = Encoding.UTF8.GetString(ms.GetBuffer(), 0, (int)ms.Length); Console.WriteLine(s); Assert.AreEqual("Escape file+content", s); } }