示例#1
0
        public async Task ShouldReturnsImageWithGoodIdIfItExists()
        {
            var result = (await _controller.Get("MTgwODA3MA")).Result;

            Assert.That(result, Is.TypeOf <OkObjectResult>());
            Assert.That((result as OkObjectResult).Value, Is.EqualTo("http://24.media.tumblr.com/tumblr_m82woaL5AD1rro1o5o1_1280.jpg"));
        }
示例#2
0
        public async Task GetImage_NotFound()
        {
            // Arrange
            // None

            // Act
            HttpResponseMessage response = await controller.Get("3617ebac-a459-xxxx-bb15-9be01b06cc48");

            // Assert
            Assert.AreEqual(response.StatusCode, HttpStatusCode.NotFound);
        }
        public void GetAllWithEmptyCollection()
        {
            var mock       = new Mock <IRepository <ImageEntity> >();
            var controller = new ImagesController(mock.Object);
            var images     = controller.Get();

            Assert.True(images.Count() == 0);
        }
        public void GetNonexistent(int id)
        {
            var mock       = new Mock <IRepository <ImageEntity> >();
            var controller = new ImagesController(mock.Object);
            var image      = controller.Get(id);

            Assert.Null(image);
        }
        public void GetAllShouldReturnZeroImagesWhenEmpty()
        {
            var data = new FakeTouristSitesData();
            var controller = new ImagesController(data);

            var result = controller.Get();

            var okResult = result as OkNegotiatedContentResult<List<ImageResponseModel>>;

            Assert.IsNotNull(okResult);
            Assert.AreEqual(0, okResult.Content.Count);
        }
示例#6
0
        public void ReturnsNotFoundWhenIdIsMissing()
        {
            var result = _controller.Get(Guid.Empty);

            result.Should().BeOfType <NotFoundObjectResult>();
        }