public OralConsultationController() : base() { oralConsultationService = new OralConsultationService(); residentService = new ResidentService(); issueService = new IssueService(); }
public async Task GetIssuesByExampleType() { //Arrange var searchSpecification = new SearchSpecificationDto(); var type = typeof(SearchIssuesWithoutClosed); var issueCount = new IssueCount { FilteredIssue = 2 }; var filteredIssueList = new FilteredIssueListDto { Count = issueCount, Issues = GetIssueList() }; var service = new IssueService(unitOfWork.Object, searchIssuesBox.Object, issueRepository.Object); searchIssuesBox.Setup(x => x.ConcreteSearch(It.IsAny <Type>(), searchSpecification)).Verifiable(); searchIssuesBox.Setup(x => x.Search(x => x.Id != 0, searchSpecification)).Returns(Task.FromResult(filteredIssueList)); unitOfWork.Setup(x => x.Mapper().Map <List <GetIssueListDto> >(filteredIssueList.Issues)).Returns(GetIssueListDto()); //Act var action = await service.GetIssues(searchSpecification); //Assert Assert.NotNull(action.Data); searchIssuesBox.Verify(x => x.ConcreteSearch(It.IsAny <Type>(), searchSpecification), Times.Once); }
public async Task <List <IssueClient> > GetIssues(int Pagina = 1) { IssueService service = new IssueService(_ctx, _issue); List <IssueClient> issues = await service.GetIssues(Pagina); return(issues); }
public IssueController(IssueService issueService, ProjectService projectService, EmployeeService employeeService, IMapper mapper) : base(mapper) { _logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); _issueService = issueService; _projectService = projectService; _employeeService = employeeService; }
public void GetByProjectCodeAndIssueNumberTest() { Mock<IProjectRepository> fakeProjectRepo = new Mock<IProjectRepository>(); Mock<IIssueRepository> fakeIssueRepo = new Mock<IIssueRepository>(); Mock<IStateWorkflowRepository> fakeStateWorkflowRepo = new Mock<IStateWorkflowRepository>(); Mock<ICommentRepository> fakeCommentRepo = new Mock<ICommentRepository>(); var issueService = new IssueService(fakeIssueRepo.Object, fakeCommentRepo.Object); var firstProject = new Project() { Code = "COD"}; var secodProject = new Project() { Code = "COP" }; var firstIssueId = Guid.NewGuid(); var secondIssueId = Guid.NewGuid(); var thirdIssueId = Guid.NewGuid(); var fourthIssueId = Guid.NewGuid(); var firstIssue = new Issue() { Active = true, CodeNumber = 1, Description = "firstIssue", Id = firstIssueId, Name = "first", Type = Entities.IssueType.Bug, Project = firstProject }; var secondIssue = new Issue() { Active = true, CodeNumber = 2, Description = "secondIssue", Id = firstIssueId, Name = "second", Type = Entities.IssueType.Task, Project = secodProject }; var thirdIssue = new Issue() { Active = true, CodeNumber = 3, Description = "thirdIssue", Id = firstIssueId, Name = "third", Type = Entities.IssueType.Question, Project = secodProject }; var fourthIssue = new Issue() { Active = true, CodeNumber = 4, Description = "fourthIssue", Id = firstIssueId, Name = "fourth", Type = Entities.IssueType.Bug, Project = secodProject }; List<Issue> issues = new List<Issue>() { firstIssue,secondIssue,thirdIssue,fourthIssue }; fakeIssueRepo.Setup(i => i.Fetch()).Returns(issues.AsQueryable()); var actual = issueService.GetByProjectCodeAndIssueNumber("COD", 1); var expected = firstIssue; Assert.AreEqual(expected, actual); }
public async Task TotalAsyncShould_ReturnsCorrectCountOf_AllApprovedAnd_CountOfAllNotApprovedIssues(bool takeApproved) { //Arrange var service = new IssueService(this.db); var user = this.CreateUser(); await this.db.AddAsync(user); var image = this.CreateImage(user.Id); await this.db.AddRangeAsync(image); var issue = this.CreateIssue(true, user.Id, null); var secondIssue = this.CreateIssue(true, user.Id, null); await this.db.AddRangeAsync(issue, secondIssue); var notApprovedIssue = this.CreateIssue(false, user.Id, null); var secondNotApprovedIssue = this.CreateIssue(true, user.Id, null); await this.db.AddRangeAsync(notApprovedIssue, secondNotApprovedIssue); await this.db.SaveChangesAsync(); //Act var resultCount = await service.TotalAsync(isApproved : takeApproved); var expectedCount = await this.db.UrbanIssues.Where(i => i.IsApproved == takeApproved).CountAsync(); //Assert resultCount.Should().Be(expectedCount); }
public void GetAllIssuesTest() { Mock<IProjectRepository> fakeProjectRepo = new Mock<IProjectRepository>(); Mock<IIssueRepository> fakeIssueRepo = new Mock<IIssueRepository>(); Mock<IStateWorkflowRepository> fakeStateWorkflowRepo = new Mock<IStateWorkflowRepository>(); Mock<ICommentRepository> fakeCommentRepo = new Mock<ICommentRepository>(); var issueService = new IssueService(fakeIssueRepo.Object, fakeCommentRepo.Object); var firstIssueId = Guid.NewGuid(); var secondIssueId = Guid.NewGuid(); var thirdIssueId = Guid.NewGuid(); var fourthIssueId = Guid.NewGuid(); var firstIssue = new Issue() { Active = true, CodeNumber = 1, Description = "firstIssue", Id = firstIssueId, Name = "first", Type = Entities.IssueType.Bug }; var secondIssue = new Issue() { Active = true, CodeNumber = 2, Description = "secondIssue", Id = firstIssueId, Name = "second", Type = Entities.IssueType.Task }; var thirdIssue = new Issue() { Active = true, CodeNumber = 3, Description = "thirdIssue", Id = firstIssueId, Name = "third", Type = Entities.IssueType.Question }; var fourthIssue = new Issue() { Active = true, CodeNumber = 4, Description = "fourthIssue", Id = firstIssueId, Name = "fourth", Type = Entities.IssueType.Bug }; List<Issue> issues = new List<Issue>() { firstIssue,secondIssue,thirdIssue,fourthIssue }; fakeIssueRepo.Setup(i => i.Fetch()).Returns(issues.AsQueryable()); var actual = issueService.GetAllIssues(); Assert.AreEqual(actual.Count, 4); }
public void IssueTest() { IIssueService issueService = new IssueService(new IssueDao(), new UserDao()); var Test_1Id = issueService.CreateIssue(new Issue() { Number = "Test_1", CreateTime = System.DateTime.Now, CreateUser = 3 }); var Test_2Id = issueService.CreateIssue(new Issue() { Number = "Test_2", CreateTime = System.DateTime.Now, CreateUser = 10 }); int effCount = 0; effCount = issueService.UpdateIssue(new Issue() { Id = Test_2Id, Number = "Test_2(M)", ModifyTime = System.DateTime.Now, ModifyUser = 13 }); var issuses = issueService.GetAllIssues(); Assert.Pass(); }
public async Task AllMapInfoDetailsAsync(bool isApprovedParam, RegionType regionParam) { //Arrange var service = new IssueService(this.db); var user = this.CreateUser(); await this.db.AddAsync(user); var image = this.CreateImage(user.Id); await this.db.AddRangeAsync(image); var issue = this.CreateIssue(true, user.Id, regionParam); var notApprovedIssue = this.CreateIssue(false, user.Id, regionParam); await this.db.AddRangeAsync(issue, notApprovedIssue); await this.db.SaveChangesAsync(); //Act var resultModel = await service.AllMapInfoDetailsAsync(isApprovedParam, regionParam); var expected = this.db.UrbanIssues .Where(i => i.IsApproved == isApprovedParam && i.Region == regionParam) .To <IssueMapInfoBoxDetailsServiceModel>(); //Assert resultModel.Should().AllBeOfType <IssueMapInfoBoxDetailsServiceModel>(); resultModel.Should().BeEquivalentTo(expected); }
private List <ActivityVM> GetTeamActivityVMs(int teamId, int size) { List <ActivityVM> activityVMList = new List <ActivityVM>(); try { var activityList = repo.GetTeamActivity(teamId).OrderByDescending(s => s.CreatedDate).Take(size).ToList(); var activityVM = new ActivityVM(); var issueService = new IssueService(repo, UserID, TeamID); issueService.SiteBaseURL = SiteBaseURL; var commentService = new CommentService(repo, SiteBaseURL); foreach (var item in activityList) { if (item.ObjectType == ActivityObjectType.Issue.ToString()) { // issueManager.GetActivityVM() activityVM = issueService.GetActivityVM(item); } else if (item.ObjectType == ActivityObjectType.IssueComment.ToString()) { activityVM = commentService.GetActivityVM(item); } activityVMList.Add(activityVM); } } catch (Exception ex) { log.Error(ex); } return(activityVMList); }
public async Task TotalAsyncShould_ReturnsCorrectCountOf_AllApprovedAnd_CountOfAllNotApprovedIssues(bool takeApproved) { //Arrange //TODO: rearrange test - now issueService has more parameters var service = new IssueService(this.Db, null); var user = UserCreator.Create(); await this.Db.AddAsync(user); var image = ImageInfoCreator.CreateWithFullData(user.Id); await this.Db.AddRangeAsync(image); var issue = CreateIssue(true, RegionType.Central, user.Id, image.Id); var secondIssue = CreateIssue(true, RegionType.Eastern, user.Id, image.Id); await this.Db.AddRangeAsync(issue, secondIssue); var notApprovedIssue = CreateIssue(false, RegionType.North, user.Id, image.Id); var secondNotApprovedIssue = CreateIssue(true, RegionType.North, user.Id, image.Id); await this.Db.AddRangeAsync(notApprovedIssue, secondNotApprovedIssue); await this.Db.SaveChangesAsync(); //Act var resultCount = await service.TotalAsync(isApproved : takeApproved); var expectedCount = await this.Db.UrbanIssues.Where(i => i.IsApproved == takeApproved).CountAsync(); //Assert resultCount.Should().Be(expectedCount); }
public JsonResult GetDashBoardItemSummary() { var issueService = new IssueService(repo, UserID, TeamID); var vm = issueService.GetDashboardSummaryVM(TeamID); return(Json(vm, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(int Id) { IssueService objIssueService = new IssueService(); IssueItem objIssueItem = new IssueItem(); objIssueItem = objIssueService.GetById(Id); CategoryService objCatServ = new CategoryService(); List <CategoryItem> lstCat = new List <CategoryItem>(); int cid = 0; if (Session["CompID"] != null) { cid = Convert.ToInt32(Session["CompID"].ToString()); } lstCat = objCatServ.GetALL(cid); objIssueItem.lstCategory = new List <CategoryItem>(); objIssueItem.lstCategory.AddRange(lstCat); ItemService objItemService = new ItemService(); List <AssestsItem> lstItem = new List <AssestsItem>(); lstItem = objItemService.GetALLItems(cid); objIssueItem.lstAllItem = new List <AssestsItem>(); objIssueItem.lstAllItem.AddRange(lstItem); List <IssueItem> lstIssue = new List <IssueItem>(); lstIssue = objIssueService.GetALL(); objIssueItem.lstIssueItem = new List <IssueItem>(); objIssueItem.lstIssueItem.AddRange(lstIssue); return(View(objIssueItem)); }
public void IssueTest2() { IIssueService issueService = new IssueService(new IssueDao(), new UserDao()); var x = issueService.GetIssueById(23); Assert.Pass(); }
public TypeConsultationController() : base() { typeConsultationService = new TypeConsultationService(); residentService = new ResidentService(); issueService = new IssueService(); companyService = new CompanyService(); }
public async Task AllAsyncShould_ReturnsIssueWithCorrectModel(bool isApproved, int rowsCount, int page, RegionType region, IssueType issueType, string sortType) { //Arrange var issue = CreateIssue(true, RegionType.Central, IssueType.DangerousTrees); var secondIssue = CreateIssue(true, RegionType.Central, IssueType.Sidewalks); var thirdIssue = CreateIssue(true, RegionType.Western, IssueType.DangerousBuildings); await this.Db.AddRangeAsync(issue, secondIssue, thirdIssue); var notApprovedIssue = CreateIssue(false, RegionType.Central, IssueType.DangerousBuildings); var secondNotApprovedIssue = CreateIssue(false, RegionType.Central, IssueType.DangerousBuildings); var thirdNotApprovedIssue = CreateIssue(false, RegionType.South, IssueType.DangerousBuildings); await this.Db.AddRangeAsync(notApprovedIssue, secondNotApprovedIssue, thirdNotApprovedIssue); await this.Db.SaveChangesAsync(); //TODO: rearrange test - now issueService has more parameters var service = new IssueService(this.Db, null); //Act (var pagesCount, var issues) = await service .AllAsync <IssuesListingModel>(isApproved, rowsCount, page, region.ToString(), issueType.ToString(), sortType); var result = issues.ToList(); var expectedCount = await this.Db.UrbanIssues.Where(i => i.IsApproved == isApproved && i.Region == region && i.Type == issueType) .Skip((page - 1) * IssuesOnRow * rowsCount) .Take(IssuesOnRow).CountAsync(); var dbIssues = this.Db.UrbanIssues.ToList(); //Assert result.Should().BeOfType <List <IssuesListingModel> >(); result.Should().HaveCount(expectedCount); result.Should().NotContain(i => i.IsApproved != isApproved); if (region != RegionType.All) { var issuesToNotContain = dbIssues.Where(x => x.Region != region); result.Should().NotContain(issuesToNotContain); } var issuesWithAnotherTypes = dbIssues.Where(x => x.Type != issueType).ToList(); result.Should().NotContain(issuesWithAnotherTypes); if (sortType == null || sortType == SortDesc) { result.Should().BeInDescendingOrder(i => i.PublishedOn); } else { result.Should().BeInAscendingOrder(i => i.PublishedOn); } }
public ActionResult Edit(IssueItem Model) { IssueItem objIssueItem = new IssueItem(); IssueService objIssueService = new IssueService(); int i = objIssueService.Update(Model); return(RedirectToAction("Create")); }
public void GetActiveIssues() { var service = new IssueService(MockConfiguration.ConnectionString, _factory); var issues = service.GetActiveIssues(); Assert.IsTrue(issues.Count() >= 0); Assert.IsTrue(issues.All(i => i.Publisher != null && i.Publisher.Id == i.PublisherId)); }
protected IssueServiceUnitTests() { Issues = new[] { new Issue { Id = 1, IssueDescription = "Test 1", DateAdded = DateTimeOffset.Now, }, new Issue { Id = 2, IssueDescription = "Test 2", DateAdded = DateTimeOffset.Now, }, new Issue { Id = 3, IssueDescription = "Test 3", DateAdded = DateTimeOffset.Now, } }; IssueDtos = new[] { new IssueDto { Id = 1, IssueDescription = "Test 1", DateAdded = DateTimeOffset.Now, }, new IssueDto { Id = 2, IssueDescription = "Test 2", DateAdded = DateTimeOffset.Now, }, new IssueDto { Id = 3, IssueDescription = "Test 3", DateAdded = DateTimeOffset.Now, } }; IssueToDeleteDto = new IssueForDeleteDto { Id = 1, IssueDescription = "Test 1 updated", DateCompleted = DateTimeOffset.Now, IsComplete = false, IsDeleted = false }; LoggerMock = LoggerUtils.LoggerMock <IssueService>(); RepositoryWrapperMock = new Mock <IRepositoryWrapper>(); ServiceUnderTest = new IssueService(RepositoryWrapperMock.Object, AutoMapperSingleton.Mapper, LoggerMock.Object); }
public async Task <ActionResult <Issue> > Put(int id, [FromBody] Issue issue) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = new IssueService(ConnectionString, _factory); return(await service.SaveIssueAsync(issue)); }
public FormIssue() { InitializeComponent(); _logService = new LogService(); _issueService = new IssueService(); _productService = new ProductService(); _issueDetailService = new IssueDetailService(); _inventoryService = new InventoryService(); _departmentService = new DepartmentService(); _weekReportService = new WeekReportService(); }
/// <summary> /// Verifies if the log message is valid for the current policy /// </summary> /// <param name="state">The state.</param> /// <returns></returns> private bool PreCommit_VerifyLogMessage(PendingCommitState state) { if (state.LogMessage == null) { return(true); // Skip checks } // And after checking whether the message is valid: Normalize the message the way the CLI would // * No whitespace at the end of lines // * Always a newline at the end StringBuilder sb = new StringBuilder(); foreach (string line in state.LogMessage.Replace("\r", "").Split('\n')) { sb.AppendLine(line.TrimEnd()); } string msg = sb.ToString(); // no need to check for issue id if issue tracker integration already did it. if (CommitSettings.WarnIfNoIssue && !state.SkipIssueVerify) { bool haveIssue = false; // Use the project commit settings class to add an issue number (if available) if (CommitSettings.ShowIssueBox && !string.IsNullOrEmpty(state.IssueText)) { haveIssue = true; } IEnumerable <TextMarker> markers; if (!haveIssue && !string.IsNullOrEmpty(state.LogMessage) && IssueService.TryGetIssues(state.LogMessage, out markers) && !EnumTools.IsEmpty(markers)) { haveIssue = true; } if (!haveIssue && state.MessageBox.Show(PccStrings.NoIssueNumber, "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return(false); } } msg = CommitSettings.BuildLogMessage(msg, state.IssueText); // And make sure the log message ends with a single newline state.LogMessage = msg.TrimEnd() + Environment.NewLine; return(true); // Logmessage always ok for now }
public async Task <ActionResult <Issue> > Get(int id) { var service = new IssueService(ConnectionString, _factory); var issue = await service.GetIssueAsync(id); if (issue == null) { return(NotFound()); } return(issue); }
public async Task <ActionResult <Issue> > Post([FromBody] Issue issue) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = new IssueService(ConnectionString, _factory); await service.SaveIssueAsync(issue); return(new CreatedAtActionResult(nameof(Get), "Issue", new { id = issue.Id }, issue)); }
public void GetResolvedIssuesTest() { Mock<IProjectRepository> fakeProjectRepo = new Mock<IProjectRepository>(); Mock<IIssueRepository> fakeIssueRepo = new Mock<IIssueRepository>(); Mock<IStateWorkflowRepository> fakeStateWorkflowRepo = new Mock<IStateWorkflowRepository>(); Mock<ICommentRepository> fakeCommentRepo = new Mock<ICommentRepository>(); var issueService = new IssueService(fakeIssueRepo.Object, fakeCommentRepo.Object); var firstProjectId = Guid.NewGuid(); var secondProjectId = Guid.NewGuid(); var firstProject = new Project() { Code = "COD", Id = firstProjectId }; var secodProject = new Project() { Code = "COP", Id = secondProjectId }; var newState = new State() { IsInitial = true }; var inProgress = new State() { IsInitial = false }; var firstIssueId = Guid.NewGuid(); var secondIssueId = Guid.NewGuid(); var thirdIssueId = Guid.NewGuid(); var fourthIssueId = Guid.NewGuid(); var firstIssue = new Issue() { Active = true, CodeNumber = 1, Description = "firstIssue", Id = firstIssueId, Name = "first", Type = Entities.IssueType.Bug, ProjectId = firstProjectId, State = newState, ResolvedAt = new DateTime(2015, 1, 22) }; var secondIssue = new Issue() { Active = true, CodeNumber = 2, Description = "secondIssue", Id = firstIssueId, Name = "second", Type = Entities.IssueType.Task, ProjectId = firstProjectId, State = inProgress, ResolvedAt = new DateTime(2015, 1, 28) }; var thirdIssue = new Issue() { Active = true, CodeNumber = 3, Description = "thirdIssue", Id = firstIssueId, Name = "third", Type = Entities.IssueType.Question, ProjectId = secondProjectId, State = inProgress, ResolvedAt = new DateTime(2015, 3, 22) }; var fourthIssue = new Issue() { Active = true, CodeNumber = 4, Description = "fourthIssue", Id = firstIssueId, Name = "fourth", Type = Entities.IssueType.Bug, ProjectId = secondProjectId, State = newState, ResolvedAt = new DateTime(2015, 1, 25) }; List<Issue> issues = new List<Issue>() { firstIssue,secondIssue,thirdIssue,fourthIssue }; fakeIssueRepo.Setup(i => i.FindBy(It.IsAny<Expression<Func<Issue, bool>>>())) .Returns((Expression<Func<Issue, bool>> expression) => issues.AsQueryable().Where(expression)); var actual = issueService.GetResolvedIssues(firstProjectId ,new DateTime(2015, 1, 12), new DateTime(2015, 1, 25)).Count; var expected = 1; Assert.AreEqual(expected, actual); actual = issueService.GetResolvedIssues(firstProjectId, 2015, 1).Count; expected = 2; Assert.AreEqual(expected, actual); actual = issueService.GetResolvedIssues(secondProjectId, 2015, 1, 2).Count; expected = 1; Assert.AreEqual(expected, actual); }
public IActionResult SendDeadlineReminder(int Id) { IssueModel Issue = Mapper.Map <IssueModel>(IssueService.GetIssue(Id)); string message = string.Format("Dear {0},<br /><br />" + "The Lead Editor of {1} sends you a reminder of the next deadline.<br />" + "Please keep in mind that every article of the next issue must be ready until {2} midnight.<br /><br />" + "Best regards,<br />" + "MakeYourJournal Administrator", "Annosz", Issue.Name, Issue.Deadline.ToShortDateString()); EmailSender.SendEmailAsync("*****@*****.**", "Deadline for issue", message); return(NoContent()); }
public ActionResult Create(IssueItem Model) { IssueItem objIssueItem = new IssueItem(); IssueService objIssueService = new IssueService(); int i = objIssueService.InsertIssueDetails(Model); StockItem objStockModel = new StockItem(); objStockModel.ItemId = Model.Item_id; objStockModel.IssueQty = Model.IssueQuantity; objStockModel.IssueDate = Model.IssueDate; int j = objIssueService.InsertIssueStock(objStockModel); return(RedirectToAction("Create")); }
private void button1_Click(object sender, EventArgs e) { IssueService service = new IssueService(); Issue issue = new Issue(); issue.StudentId = Convert.ToInt32(textBox1.Text); issue.BookId = Convert.ToInt32(textBox2.Text); issue.IssueDate = DateTime.Now; issue.DueDate = DateTime.Now.AddDays(7); issue.Status = "Issued"; issue.ModifiedDate = DateTime.Now; int rows = service.NewIssue(issue); MessageBox.Show(rows + "book issued"); }
public async Task AssignToIssueSuccess() { //Arrange var supportIssue = GetSupportIssue(); unitOfWork.Setup(x => x.Repository <SupportIssues>().Add(supportIssue)).Verifiable(); unitOfWork.Setup(x => x.SaveAllAsync()).Returns(Task.FromResult(true)); var service = new IssueService(unitOfWork.Object, searchIssuesBox.Object, issueRepository.Object); //Act var action = await service.AssignToIssue(1, "1"); //Assert Assert.True(action); }
public async Task <IActionResult> GetIssue(int Id) { string error = null; IssueService service = new IssueService(_ctx, _issue); IssueClient issue = null; (issue, error) = await service.GetIssue(Id); if (error == null) { return(Ok(issue)); } else { return(BadRequest(error)); } }