public void TestGet() { _testScenarioSupport.LoadTestScenario("jacks-test-scenario"); var controller = new AllocationController(new AllocationDataGateway(new DatabaseTemplate(_dataSourceConfig)), new ProjectClient()); var result = controller.Get(55432); // todo... Assert.Equal(2, ((List <AllocationInfo>)((ObjectResult)result).Value).Count); }
public void TestGet() { _gateway.Setup(g => g.FindBy(55432)).Returns(new List <AllocationRecord> { new AllocationRecord(754, 55432, 4765, DateTime.Parse("2015-05-16"), DateTime.Parse("2015-05-17")), new AllocationRecord(755, 55432, 4766, DateTime.Parse("2015-05-17"), DateTime.Parse("2015-05-18")) }); _client.Setup(c => c.Get(55432)).Returns(Task.FromResult(new ProjectInfo(true))); var response = _controller.Get(55432); var body = (List <AllocationInfo>)((ObjectResult)response).Value; Assert.IsType <OkObjectResult>(response); Assert.Equal(2, body.Count); Assert.Equal(754L, body[0].Id); Assert.Equal(55432L, body[0].ProjectId); Assert.Equal(4765L, body[0].UserId); Assert.Equal(16, body[0].FirstDay.Day); Assert.Equal(5, body[0].FirstDay.Month); Assert.Equal(2015, body[0].FirstDay.Year); Assert.Equal(17, body[0].LastDay.Day); Assert.Equal(5, body[0].FirstDay.Month); Assert.Equal(2015, body[0].FirstDay.Year); Assert.Equal("allocation info", body[0].Info); Assert.Equal(755L, body[1].Id); Assert.Equal(55432L, body[1].ProjectId); Assert.Equal(4766L, body[1].UserId); Assert.Equal(17, body[1].FirstDay.Day); Assert.Equal(5, body[1].FirstDay.Month); Assert.Equal(2015, body[1].FirstDay.Year); Assert.Equal(18, body[1].LastDay.Day); Assert.Equal(5, body[1].FirstDay.Month); Assert.Equal(2015, body[1].FirstDay.Year); Assert.Equal("allocation info", body[1].Info); }