public async Task Can_Add_Assignment(OrganizationRole role) { //Arrange var login = await HttpApi.GetCookieAsync(role); var description = A <string>(); var name = A <string>(); var note = A <string>(); var statusPercentage = A <int>() % 100; var timeEstimate = A <int>(); var startDate = A <DateTime>().Date; var endDate = startDate.AddDays(10); //Act - perform the action with the actual role var result = await ItProjectHelper.AddAssignmentAsync(OrganizationId, _project.Id, description, name, note, statusPercentage, timeEstimate, startDate, endDate, login); //Assert Assert.Equal(_project.Id, result.AssociatedItProjectId.GetValueOrDefault()); Assert.Equal(description, result.Description); Assert.Equal(name, result.Name); Assert.Equal(note, result.Note); Assert.Equal(statusPercentage, result.StatusProcentage); Assert.Equal(timeEstimate, result.TimeEstimate); Assert.Equal(startDate, result.StartDate); Assert.Equal(endDate, result.EndDate); }
public async Task Put_Removes_Obsoleted_And_Removes_Usages_In_Projects() { //Arrange await PrepareForDetailedTest(); var project = await ItProjectHelper.CreateProject(A <string>(), TestEnvironment.DefaultOrganizationId); //Add some task refs to a project and save the expected keys (keys not removed) MutateDatabase(context => { using (var taskRefs = new GenericRepository <TaskRef>(context)) using (var projects = new GenericRepository <ItProject>(context)) { var itProject = projects.GetByKey(project.Id); var toKeep = taskRefs.AsQueryable().Take(2).ToList(); toKeep.ForEach(itProject.TaskRefs.Add); projects.Save(); } }); var expectedTaskRefs = GetProjectTaskRefKeys(project.Id); Assert.Equal(2, expectedTaskRefs.Count); //Add the task refs subject to removal MutateDatabase(db => { using (var projects = new GenericRepository <ItProject>(db)) using (var taskRefs = new GenericRepository <TaskRef>(db)) { var other = taskRefs.AsQueryable().First(); var objectOwnerId = other.ObjectOwnerId; var organizationUnitId = other.OwnedByOrganizationUnitId; var taskRef1 = taskRefs.Insert(CreateTaskRef(objectOwnerId, organizationUnitId)); var taskRef2 = taskRefs.Insert(CreateTaskRef(objectOwnerId, organizationUnitId)); taskRefs.Save(); //Add usages which we expect to be removed var itProject = projects.GetByKey(project.Id); itProject.TaskRefs.Add(taskRef1); itProject.TaskRefs.Add(taskRef2); projects.Save(); } }); //Act await PutKle(); //Assert var actualTaskRefs = GetProjectTaskRefKeys(project.Id); VerifyTaskRefUsageKeys(expectedTaskRefs, actualTaskRefs); }
public async Task Cannot_Add_Communication(OrganizationRole role) { //Arrange var login = await HttpApi.GetCookieAsync(role); //Act - perform the action with the actual role using (var result = await ItProjectHelper.SendAddCommunicationRequestAsync(OrganizationId, _project.Id, A <string>(), A <string>(), A <string>(), TestEnvironment.DefaultUserId, A <string>(), A <DateTime>().Date, login)) { //Assert Assert.Equal(HttpStatusCode.Forbidden, result.StatusCode); } }
public async Task Can_Delete_Project_With_HandoverTrial() { //Arrange var handoverId = _project.Id; //NOTE: handoverId == project id await ItProjectHelper.AddHandoverResponsibleAsync(handoverId, TestEnvironment.DefaultUserId); //Act using (var responseMessage = await ItProjectHelper.SendDeleteProjectAsync(_project.Id)) { //Assert Assert.Equal(HttpStatusCode.OK, responseMessage.StatusCode); } }
public async Task Can_Create_Reference_In_ItProject() { //Arrange var project = await ItProjectHelper.CreateProject(A <string>(), TestEnvironment.DefaultOrganizationId); //Act - create two similar references... we expect the first one to be the master var expectedMasterReference = await ReferencesHelper.CreateReferenceAsync(_title, _externalReferenceId, _referenceUrl, _display, dto => dto.ItProject_Id = project.Id); await ReferencesHelper.CreateReferenceAsync(_title, _externalReferenceId, _referenceUrl, _display, dto => dto.ItProject_Id = project.Id); //Assert AssertCreatedReference(_title, expectedMasterReference, _externalReferenceId, _referenceUrl, _display); project = await ItProjectHelper.GetProjectAsync(project.Id); Assert.Equal(2, project.ExternalReferences.Count); Assert.Equal(expectedMasterReference.Id, project.ReferenceId.GetValueOrDefault(-1)); //First reference must be marked as "the reference" }
public async Task Cannot_Add_MileStone(OrganizationRole role) { //Arrange var login = await HttpApi.GetCookieAsync(role); var description = A <string>(); var name = A <string>(); var note = A <string>(); var timeEstimate = A <int>(); var humanReadableId = A <string>(); var date = A <DateTime>().Date; //Act - perform the action with the actual role using (var result = await ItProjectHelper.SendAddMileStoneRequestAsync(OrganizationId, _project.Id, description, name, note, humanReadableId, timeEstimate, date, login)) { //Assert Assert.Equal(HttpStatusCode.Forbidden, result.StatusCode); } }
public async Task Cannot_Add_Stakeholder(OrganizationRole role) { //Arrange var login = await HttpApi.GetCookieAsync(role); var howToHandle = A <string>(); var name = A <string>(); var roleName = A <string>(); var downsides = howToHandle; var benefits = howToHandle; var significance = A <int>() % 5; //Act - perform the action with the actual role using (var result = await ItProjectHelper.SendAddStakeholderRequestAsync(OrganizationId, _project.Id, name, roleName, downsides, benefits, howToHandle, significance, login)) { //Assert Assert.Equal(HttpStatusCode.Forbidden, result.StatusCode); } }
public async Task Cannot_Add_Goal(OrganizationRole role) { //Arrange var login = await HttpApi.GetCookieAsync(role); var humanReadableId = A <string>(); var measurable = A <bool>(); var name = A <string>(); var description = A <string>(); var goalDate1 = A <DateTime>().Date; var goalDate2 = A <DateTime>().Date; var goalDate3 = A <DateTime>().Date; //Act - perform the action with the actual role using (var result = await ItProjectHelper.SendAddGoalRequestAsync(OrganizationId, _project.Id, humanReadableId, measurable, name, description, goalDate1, goalDate2, goalDate3, login)) { //Assert Assert.Equal(HttpStatusCode.Forbidden, result.StatusCode); } }
public async Task Cannot_Add_Assignment(OrganizationRole role) { //Arrange var login = await HttpApi.GetCookieAsync(role); var description = A <string>(); var name = A <string>(); var note = A <string>(); var statusPercentage = A <int>() % 100; var timeEstimate = A <int>(); var startDate = A <DateTime>().Date; var endDate = startDate.AddDays(10); //Act - perform the action with the actual role using (var result = await ItProjectHelper.SendAddAssignmentRequestAsync(OrganizationId, _project.Id, description, name, note, statusPercentage, timeEstimate, startDate, endDate, login)) { //Assert Assert.Equal(HttpStatusCode.Forbidden, result.StatusCode); } }
public async Task Can_Add_Goal(OrganizationRole role) { //Arrange var login = await HttpApi.GetCookieAsync(role); var humanReadableId = A <string>(); var measurable = A <bool>(); var name = A <string>(); var description = A <string>(); var goalDate1 = A <DateTime>().Date; var goalDate2 = A <DateTime>().Date; var goalDate3 = A <DateTime>().Date; //Act - perform the action with the actual role var result = await ItProjectHelper.AddGoalAsync(OrganizationId, _project.Id, humanReadableId, measurable, name, description, goalDate1, goalDate2, goalDate3, login); //Assert Assert.Equal(_project.Id, result.GoalStatusId); Assert.Equal(description, result.Description); Assert.Equal(name, result.Name); Assert.Equal(humanReadableId, result.HumanReadableId); }
public async Task Can_Add_Risk(OrganizationRole role) { //Arrange var login = await HttpApi.GetCookieAsync(role); var name = A <string>(); var action = A <string>(); var consequence = A <int>() % 5; var probability = A <int>() % 5; var responsibleUserId = TestEnvironment.DefaultUserId; //Act - perform the action with the actual role var result = await ItProjectHelper.AddRiskAsync(OrganizationId, _project.Id, name, action, consequence, probability, responsibleUserId, login); //Assert Assert.Equal(_project.Id, result.ItProjectId); Assert.Equal(name, result.Name); Assert.Equal(action, result.Action); Assert.Equal(consequence, result.Consequence); Assert.Equal(probability, result.Probability); Assert.Equal(responsibleUserId, result.ResponsibleUserId.GetValueOrDefault()); }
public async Task Can_Add_Communication(OrganizationRole role) { //Arrange var login = await HttpApi.GetCookieAsync(role); var media = A <string>(); var message = A <string>(); var purpose = A <string>(); var targetAudience = A <string>(); var date = A <DateTime>().Date; var responsibleUserId = TestEnvironment.DefaultUserId; //Act - perform the action with the actual role var result = await ItProjectHelper.AddCommunicationAsync(OrganizationId, _project.Id, media, message, purpose, responsibleUserId, targetAudience, date, login); //Assert Assert.Equal(_project.Id, result.ItProjectId); Assert.Equal(media, result.Media); Assert.Equal(message, result.Message); Assert.Equal(purpose, result.Purpose); Assert.Equal(targetAudience, result.TargetAudiance); Assert.Equal(date, result.DueDate.GetValueOrDefault()); Assert.Equal(responsibleUserId, result.ResponsibleUserId.GetValueOrDefault()); }
public async Task Can_Add_MileStone(OrganizationRole role) { //Arrange var login = await HttpApi.GetCookieAsync(role); var description = A <string>(); var name = A <string>(); var note = A <string>(); var timeEstimate = A <int>(); var humanReadableId = A <string>(); var date = A <DateTime>().Date; //Act - perform the action with the actual role var result = await ItProjectHelper.AddMileStoneAsync(OrganizationId, _project.Id, description, name, note, humanReadableId, timeEstimate, date, login); //Assert Assert.Equal(_project.Id, result.AssociatedItProjectId.GetValueOrDefault()); Assert.Equal(description, result.Description); Assert.Equal(name, result.Name); Assert.Equal(note, result.Note); Assert.Equal(timeEstimate, result.TimeEstimate); Assert.Equal(date, result.Date.Value); Assert.Equal(humanReadableId, result.HumanReadableId); }
public async Task Can_Add_Stakeholder(OrganizationRole role) { //Arrange var login = await HttpApi.GetCookieAsync(role); var howToHandle = A <string>(); var name = A <string>(); var roleName = A <string>(); var downsides = howToHandle; var benefits = howToHandle; var significance = A <int>() % 5; //Act - perform the action with the actual role var result = await ItProjectHelper.AddStakeholderAsync(OrganizationId, _project.Id, name, roleName, downsides, benefits, howToHandle, significance, login); //Assert Assert.Equal(_project.Id, result.ItProjectId); Assert.Equal(name, result.Name); Assert.Equal(roleName, result.Role); Assert.Equal(downsides, result.Downsides); Assert.Equal(benefits, result.Benefits); Assert.Equal(howToHandle, result.HowToHandle); Assert.Equal(significance, result.Significance); }
public async Task InitializeAsync() { _root = await ItProjectHelper.CreateProject(A <string>(), OrganizationId); }
private static async Task <ItProjectDTO> CreateProjectAsync(int organizationId = TestEnvironment.DefaultOrganizationId) { return(await ItProjectHelper.CreateProject(CreateName(), organizationId)); }
private static async Task <ItSystemUsageDTO> AddProjectSystemBindingAsync(ItProjectDTO project, ItSystemUsageDTO systemUsage, int organizationId = TestEnvironment.DefaultOrganizationId) { return(await ItProjectHelper.AddSystemBinding(project.Id, systemUsage.Id, organizationId)); }