Ejemplo n.º 1
0
        public async Task GivenTyreController_WhenGetAllTyresIsCalled_ThenReturnListOfTyres()
        {
            //Arrange
            var expected        = new List <Tyre>();
            var mockTyreService = new Mock <ITyreService>();

            mockTyreService.Setup(x => x.GetAllTyres()).ReturnsAsync(expected);
            var sut = new TyreController(mockTyreService.Object);

            //Act
            var result = await sut.GetAllTyres();

            //Assert
            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 2
0
        public void GetAllTtyres_ShouldReturnNotNullResult()
        {
            //Arrange
            var mockTyreService      = new Mock <ITyreService>();
            IEnumerable <Tyre> tyres = new List <Tyre>();

            mockTyreService.Setup(x => x.GetAllTyres()).ReturnsAsync(tyres);
            var controller = new TyreController(mockTyreService.Object);

            //Act
            var result = controller.GetAllTyres().Result;

            //Assert
            Assert.IsNotNull(result);
        }