예제 #1
0
        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));
        }
예제 #2
0
        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));
        }