Exemple #1
0
        public void TestEmptyFactory()
        {
            //var import = ImportFactory.GetImportFrom(string.Empty);
            Exception ex = Assert.Throws <Exception>(() => ImportFactory.GetImportFrom(string.Empty));

            Assert.Equal("Unknown file type: !", ex.Message);
        }
        public async Task <IActionResult> Connect([Bind("ID, Credential, Issues")] Project project)
        {
            if (ModelState.IsValid)
            {
                importService = ImportFactory.GetImportFrom("jira");
                //importService.Connect(new Credential()
                //{
                //    Uri = "https://queryexport.atlassian.net",
                //    Username = "******",
                //    Password = "******"
                //});
                //if (project.ID == 0)
                //{
                //    _context.Add(project);
                //    await _context.SaveChangesAsync();
                //}
                importService.Connect(new Credential()
                {
                    Uri      = project.Credential.Uri,
                    Username = project.Credential.Username,
                    Password = project.Credential.Password
                });

                var res = await importService.GetIssuesForProject();

                project.Issues = res;

                _context.Add(project);
                await _context.SaveChangesAsync();
            }
            return(RedirectToAction("Index"));
        }
Exemple #3
0
        public void TestFactory()
        {
            var jiraImport = ImportFactory.GetImportFrom("jira");

            Assert.True(jiraImport.GetType() == typeof(JiraImport));
        }