public void AddStyle_ExpectedParameters_Ok() { mockStyleBusinessLogic.Setup(b1 => b1.Add(style)); IHttpActionResult statusObtained = styleController.Post(styleModel); Assert.IsNotNull(statusObtained as OkNegotiatedContentResult <string>); }
public void IntegrationTest() { Guid token = Guid.NewGuid(); var requestMessage = new HttpRequestMessage(); requestMessage.Headers.Add("Token", token + ""); mockUserAuthorizationLogic.Setup(b1 => b1.IsAValidToken(token)).Returns(true); mockUserAuthorizationLogic.Setup(b1 => b1.IsAdmin(token)).Returns(true); IStyleDataAccess styleDA = new StyleDataAccess(); IStyleBusinessLogic styleBL = new StyleBusinessLogic(styleDA); StyleController styleController = new StyleController(styleBL, mockUserAuthorizationLogic.Object); styleController.Request = requestMessage; Style style = Utils.CreateStyleForTest(); styleController.Post(StyleModel.ToModel(style)); }