public void TestChorusInstrumentModels() { var accounts = new[] { new ChorusAccount("https://chorusproject.org", "*****@*****.**", "pwd"), }; ChorusSession chorusSession = new ChorusSession(); var instrumentModels = new HashSet <string>(); foreach (var account in accounts) { ChorusContents chorusContents = chorusSession.FetchContents(account, new Uri(account.ServerUrl + "/skyline/api/contents/my/files")); Assert.IsNotNull(chorusContents); foreach (var file in ListAllFiles(chorusContents)) { instrumentModels.Add(file.instrumentModel); } } Assert.AreNotEqual(0, instrumentModels.Count); var unknownInstrumentModels = new List <string>(); foreach (var instrumentModel in instrumentModels) { if (null == ChorusSession.GetFileTypeFromInstrumentModel(instrumentModel)) { unknownInstrumentModels.Add(instrumentModel); } } Assert.AreEqual(0, unknownInstrumentModels.Count, "Unknown instrument models {0}", string.Join(",", unknownInstrumentModels)); }
/// <summary> /// Tests that all instrument models are identified as something by ChorusSession.GetFileTypeFromInstrumentModel /// </summary> // Disabled 20170123 because Skyline Chorus API is offline //[TestMethod] public void TestChorusInstrumentModels() { var accounts = new[] { new ChorusAccount("https://chorusproject.org", "*****@*****.**", "pwd"), }; ChorusSession chorusSession = new ChorusSession(TEST_ACCOUNT); var instrumentModels = new HashSet <string>(); foreach (var account in accounts) { ChorusContents chorusContents; for (int retry = 4;; retry--) { try { chorusContents = chorusSession.FetchContents( new Uri(account.ServerUrl + "/skyline/api/contents/my/files")); break; } catch (WebException webException) { if (retry == 0 || webException.Status != WebExceptionStatus.Timeout) { throw; } } } Assert.IsNotNull(chorusContents); foreach (var file in ListAllFiles(chorusContents)) { instrumentModels.Add(file.instrumentModel); } } Assert.AreNotEqual(0, instrumentModels.Count); var unknownInstrumentModels = new List <string>(); foreach (var instrumentModel in instrumentModels) { if (null == ChorusSession.GetFileTypeFromInstrumentModel(instrumentModel)) { unknownInstrumentModels.Add(instrumentModel); } } if (0 != unknownInstrumentModels.Count) { String message = string.Format("Unknown instrument models {0}", string.Join(",", unknownInstrumentModels)); try { TestContext.WriteLine(message); } catch (Exception) { Console.Error.WriteLine(message); } } }