Beispiel #1
0
        public void GetReturnsNotFound()
        {
            // Arrange
            LandTypesController controller = new LandTypesController();

            // Act
            IHttpActionResult actionResult = controller.Get(-1);

            // Assert
            Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult));
        }
Beispiel #2
0
        public void GetTest()
        {
            // arrange
            LandTypesController controller = new LandTypesController();

            // act
            var result = controller.Get();

            // assert
            Assert.IsInstanceOfType(result, typeof(IEnumerable <LandTypeViewModel>));
            Assert.IsTrue(result.Count() >= 0);
        }
Beispiel #3
0
        public void GetByIdTest()
        {
            // arrange
            LandTypesController controller = new LandTypesController();

            // Act
            IHttpActionResult actionResult = controller.Get(newId);
            var contentResult = actionResult as OkNegotiatedContentResult <LandTypeViewModel>;

            // Assert
            Assert.IsNotNull(contentResult);
            Assert.IsNotNull(contentResult.Content);
            Assert.AreEqual(newId, contentResult.Content.Id);
            Assert.IsNotNull(newId, contentResult.Content.TimestampString);
            testItem.TimestampString = contentResult.Content.TimestampString;
        }