public GherkinCard Download(MingleConfiguration mingleConfiguration, GherkinCardConfiguration gherkinCardConfiguration) { MingleServerConfiguration serverConfig = mingleConfiguration.Server; MingleProjectConfiguration projectConfig = mingleConfiguration.Project; var credential = new MingleCredential(); if (credential.Exists()) { credential.Load(); } else { credential.Prompt(); } while (true) { IMingleServer server = new MingleServer(serverConfig.HostUrl, credential.Username, credential.SecurePassword); MingleProject project = server.GetProject(projectConfig.Id); try { MingleCard card = project.GetCard(gherkinCardConfiguration.Number); var uri = new Uri(new Uri(serverConfig.HostUrl), "/projects/" + project.ProjectId + Path.ChangeExtension(card.Url, "")); return new GherkinCard(card.Name, card.Description, uri.ToString()); } catch (MingleWebException e) { if (e.IsHttpUnauthorized() && !credential.Prompt()) { throw; } throw; } } }
public static void MyClassInitialize(TestContext testContext) { _mingle = new MingleServer(MingleHost, MINGLEUSER, MINGLEPASSWORD); _project = _mingle.GetProject("apitest"); }