public Format Get(Guid id) { if (Exists(id)) { return(FormatDataAccess.Get(id)); } else { throw new ArgumentException("Format doesn't exist " + id); } }
public void Delete(Guid id) { if (Exists(id)) { FormatDataAccess.Delete(id); } else { throw new ArgumentException("Format doesn't exist " + id); } }
public void Add(Format format) { if (!FormatIsNull(format)) { if (!Exists(format.Id)) { FormatDataAccess.Add(format); } else { throw new DuplicateWaitObjectException(format.Id + " already exists"); } } else { throw new ArgumentNullException("Null references"); } }
public void Modify(Format format) { if (!FormatIsNull(format)) { if (Exists(format.Id)) { FormatDataAccess.Modify(format); } else { throw new ArgumentException("Format doesn't exist " + format.Id); } } else { throw new ArgumentNullException("Null references"); } }
public void AddStyle(Guid formatId, StyleClass styleClass) { if (Exists(formatId)) { if (StyleClassBusinessLogic.Exists(styleClass.Id)) { Format format = FormatDataAccess.Get(formatId); format.AddStyleClass(styleClass); FormatDataAccess.Modify(format); } else { throw new ArgumentException("StyleClass doesn't exist styleClass.Name"); } } else { throw new ArgumentException("StyleClass doesn't exist styleClass.Name"); } }
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; }
public IList <Format> Get() { return(FormatDataAccess.Get()); }