Пример #1
0
        public void DELETE_WhenDeleteItem_ThenServiceReturnNoContent()
        {
            //Arrange
            var id = Guid.NewGuid();

            var fakeService = A.Fake <IAeroplaneTypeService>();

            var controller = new AeroplaneTypesController(fakeService);

            //Act
            var response = controller.Delete(id) as NoContentResult;

            //Assert
            Assert.AreEqual((int)HttpStatusCode.NoContent, response.StatusCode);
        }
Пример #2
0
        public void GET_WhenGetItem_ThenServiceReturnOkAndThisObject()
        {
            //Arrange
            var id = Guid.NewGuid();

            var fakeService = A.Fake <IAeroplaneTypeService>();

            A.CallTo(() => fakeService.Get(id)).Returns(new AeroplaneTypeDto());

            var controller = new AeroplaneTypesController(fakeService);

            //Act
            var response = controller.Get(id) as ObjectResult;

            //Assert
            Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode);
            Assert.IsInstanceOf(typeof(AeroplaneTypeDto), response.Value);
        }
Пример #3
0
        public void PUT_WhenPuttNewItem_ThenServiceReturnOkAndThisObject()
        {
            //Arrange
            var AeroplaneType = new AeroplaneTypeDto
            {
                Id       = Guid.NewGuid(),
                Model    = "Model",
                Carrying = 100000,
                Places   = 50
            };

            var fakeService = A.Fake <IAeroplaneTypeService>();

            A.CallTo(() => fakeService.Update(AeroplaneType.Id, AeroplaneType)).Returns(AeroplaneType);

            var controller = new AeroplaneTypesController(fakeService);

            //Act
            var response = controller.Post(AeroplaneType) as ObjectResult;

            //Assert
            Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode);
            Assert.IsInstanceOf(typeof(AeroplaneTypeDto), response.Value);
        }