public HttpResponseMessage Get(HttpRequestMessage request, int workItemId) { WorkItem workItem = null; using (var impersonator = HttpContextImpersonator.Begin()) { workItem = new WorkItem(); workItem = workItem.Get(workItemId); } return request.CreateResponse(HttpStatusCode.OK, workItem); }
public void WhenGet_ShouldNotBeNull() { var tfsProvider = new Mock<ITFSProvider>(); tfsProvider.Setup(d => d.GetTFSItem(It.Is<int>(i => i == 1))).Returns(new WorkItem() { ID = 1, Title = "TFS Work Item", Description = "TFS Work Item Description", AssignedTo = "Somebody" }); WorkItem workItem = new WorkItem(tfsProvider.Object); var subject = workItem.Get(1); subject.Should().NotBeNull(); }
public HttpResponseMessage ImportFromTFSID(HttpRequestMessage request, int tfsWorkItem, int areaID) { WorkItem workItem = new WorkItem(); var tfsItem = new List<WorkItem>() { workItem.Get(tfsWorkItem) }; var result = new Card().Add(tfsItem, areaID); if (result != null) { return request.CreateResponse(HttpStatusCode.Accepted, result); } return request.CreateResponse(HttpStatusCode.InternalServerError); }
public HttpResponseMessage ImportFromSavedTFSQuery(HttpRequestMessage request, string queryName, int areaID) { WorkItem workItem = new WorkItem(); Card card = new Card(); var tfsItems = workItem.Get(queryName); List<Card> result = card.Add(tfsItems, areaID); if (result != null) { return request.CreateResponse(HttpStatusCode.Accepted, result); } return request.CreateResponse(HttpStatusCode.InternalServerError); }
private Card createCardFromWorkItem(int areaID, WorkItem workItem, DateTime dateNow, string currentUser) { return new Card() { CreatedUser = currentUser, CreatedDate = dateNow, ModifiedUser = currentUser, ModifiedDate = dateNow, Name = workItem.Title, Description = workItem.Description, AreaID = areaID, AssignedTo = workItem.AssignedTo, TfsID = workItem.ID }; }
public void WhenGet_ShouldCountBeOne() { var tfsProvider = new Mock<ITFSProvider>(); tfsProvider. Setup(d => d.GetTFSItems(It.IsAny<string>())) .Returns(() => { return new List<WorkItem>() { new WorkItem() { ID = 1, Title = "TFS Work Item", Description = "TFS Work Item Description", AssignedTo = "Somebody" } }; }); WorkItem workItem = new WorkItem(tfsProvider.Object); var subject = workItem.Get("query"); subject.Count.Should().Be(1); }
public void WhenInitialize_ShouldTitleBeNull() { WorkItem workItem = new WorkItem(); workItem.Title.Should().BeNull(); }
public void WhenInitialize_ShouldNotBeNull() { WorkItem workItem = new WorkItem(); workItem.Should().NotBeNull(); }
public void WhenInitialize_ShouldIDBeZero() { WorkItem workItem = new WorkItem(); workItem.ID.Should().Be(0); }
public void WhenInitialize_ShouldDescriptionBeNull() { WorkItem workItem = new WorkItem(); workItem.Description.Should().BeNull(); }
public void WhenInitialize_ShouldAssignedToBeNull() { WorkItem workItem = new WorkItem(); workItem.AssignedTo.Should().BeNull(); }