예제 #1
0
        public void sample_api_controller_returns_httpStatus_ok()
        {
            var api_controller = new SampleApiController(_sampleService);

            api_controller.Request       = new HttpRequestMessage();
            api_controller.Configuration = new HttpConfiguration();

            A.CallTo(() => _sampleService.SampleData).Returns(new string[] { "test data 1", "test data 2" });

            var result = api_controller.GetSampleData();

            Assert.Equal(result.StatusCode, HttpStatusCode.OK);
        }
예제 #2
0
        public void sample_api_controller_returns_sample_data()
        {
            var api_controller = new SampleApiController(_sampleService);

            api_controller.Request       = new HttpRequestMessage();
            api_controller.Configuration = new HttpConfiguration();

            A.CallTo(() => _sampleService.SampleData).Returns(new string[] { "test data 1", "test data 2" });

            var result = api_controller.GetSampleData();

            string[] httpContent;
            Assert.Equal(result.TryGetContentValue <string[]>(out httpContent), true);
            Assert.Equal(httpContent, new[] { "test data 1", "test data 2" });
        }