public void AddFormat_ExpectedParameters_Ok() { mockFormatsBusinessLogic.Setup(b1 => b1.Add(format)); IHttpActionResult statusObtained = formatController.Post(formatModel); 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); IStyleClassDataAccess styleClassDA = new StyleClassDataAccess(); IStyleClassBusinessLogic styleClassBL = new StyleClassBusinessLogic(styleClassDA, styleBL); IFormatDataAccess formatDA = new FormatDataAccess(); IFormatBusinessLogic formatBL = new FormatBusinessLogic(formatDA, styleClassBL); FormatController formatC = new FormatController(formatBL, mockUserAuthorizationLogic.Object); formatC.Request = requestMessage; Format formatA = Utils.CreateFormatForTest(); FormatModel formatModelA = FormatModel.ToModel(formatA); formatC.Post(formatModelA); }
public void integration() { var requestMessage = new HttpRequestMessage(); IUserDataAccess da = new UserDataAccess(); IUserBusinessLogic userBL = new UserBusinessLogic(new UserDataAccess()); IAuthorizationBusinessLogic auth = new AuthorizationBusinessLogic(da); IStyleDataAccess styleDA = new StyleDataAccess(); IStyleBusinessLogic styleBL = new StyleBusinessLogic(styleDA); IStyleClassDataAccess styleClassDA = new StyleClassDataAccess(); IStyleClassBusinessLogic styleClassBL = new StyleClassBusinessLogic(styleClassDA, styleBL); IFormatDataAccess formatDA = new FormatDataAccess(); IFormatBusinessLogic formatBL = new FormatBusinessLogic(formatDA, styleClassBL); FormatController formatC = new FormatController(formatBL, auth); formatC.Request = requestMessage; StyleClass styleClassA = Utils.CreateStyleClassInDataBaseForTest(); Format formatA = Utils.CreateFormatForTest(); FormatModel formatModelA = FormatModel.ToModel(formatA); formatC.Post(formatModelA); formatC.AddStyleClassToFormat(formatA.Id, StyleClassModel.ToModel(styleClassA)); IHttpActionResult statusObtained = formatC.Get(formatA.Id); int a = 2; }