Beispiel #1
0
        public void GetFile_ShouldReturnNotFound()
        {
            var controller = new GoatsController();

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

            var response = controller.GetFile("no_file.json");

            Assert.IsNotNull(response);
            Assert.AreEqual(response.StatusCode, HttpStatusCode.NotFound);
        }
Beispiel #2
0
        public void GetFile_ShouldReturnFileContent()
        {
            var controller = new GoatsController();

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

            var response = controller.GetFile("dotnet-api-goat.Tests.dll.config");

            Assert.IsNotNull(response);
            Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
            string fileContent;

            Assert.IsTrue(response.TryGetContentValue <String>(out fileContent));
            Assert.IsTrue(fileContent.Contains("configuration"));
        }