Esempio n. 1
0
        public void GivenMockedStructure_WhenGettingMetaData_ReturnsExpectedResult()
        {
            var apiController = new StructureApiController(GetMockedStructure());

            var result = apiController.GetData();

            Assert.That(result, Is.Not.Null);
            Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.OK));
        }
Esempio n. 2
0
        public void GivenMockedStructureThrowsError_WhenGettingData_ThenDoesNotReturnNullResult()
        {
            var mockedStructure = new Mock <IStructure>();

            mockedStructure.Setup(s => s.GetStructureData()).Throws(new NotImplementedException());
            var apiController = new StructureApiController(mockedStructure.Object);

            var result = apiController.GetData();

            Assert.That(result, Is.Not.Null);
            Assert.That(result.StatusCode, Is.Not.Null);
            Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.FailedDependency));
        }