public void GivenMockedStructure_WhenGettingRooms_ReturnsExpectedResult() { var apiController = new StructureApiController(GetMockedStructure()); var result = apiController.GetRooms(); Assert.That(result, Is.Not.Null); Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.OK)); }
public void GivenMockedStructureThrowsError_WhenGettingRooms_ThenDoesNotReturnNullResult() { var mockedStructure = new Mock <IStructure>(); mockedStructure.Setup(s => s.GetStructureRooms()).Throws(new NotImplementedException()); var apiController = new StructureApiController(mockedStructure.Object); var result = apiController.GetRooms(); Assert.That(result, Is.Not.Null); Assert.That(result.StatusCode, Is.Not.Null); Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.FailedDependency)); }