コード例 #1
0
        public void GetEngineNotFound()
        {
            // Set up Prerequisites
            var controller = new EnginesController();

            // Act
            var actionResult = controller.GetEngine(4);

            // Assert
            Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult));
        }
コード例 #2
0
        public void GetAll()
        {
            // Set up Prerequisites
            var controller = new EnginesController();

            // Act on Test
            var response      = controller.GetEngine();
            var contentResult = response as OkNegotiatedContentResult <IQueryable <Engine> >;

            // Assert the result

            Assert.AreEqual(3, response.Count());
        }
コード例 #3
0
        public void GetByEngineId()
        {
            // Set up Prerequisites
            var controller = new EnginesController();

            // Act on Test
            var response      = controller.GetEngine(1);
            var contentResult = response as OkNegotiatedContentResult <Engine>;

            // Assert the result
            Assert.IsNotNull(contentResult);
            Assert.IsNotNull(contentResult.Content);
            Assert.AreEqual(1, contentResult.Content.id);
            Assert.AreEqual("Petrol", contentResult.Content.typeEngine);
        }