public CompanyFacade(IServiceProvider serviceProvider, DealTrackingDbContext dbContext) { this.DbContext = dbContext; this.DbSet = this.DbContext.Set <Company>(); this.IdentityService = serviceProvider.GetService <IdentityService>(); this.CompanyLogic = serviceProvider.GetService <CompanyLogic>(); }
public void EditCompany_ShouldEditRecord() { // Arrange var context = this.GetDbContext(); this.PopulateData(context); // Act var service = new CompanyLogic(context, mapper); var newCompany = new CompanyDTO { Id = 5, Name = "Lidivo3 Edited", Description = "Grocery store3", Headquarters = "Sofia3", Employees = new List <EmployeeDTO>() }; service.EditCompany(newCompany); var company = context.Companies.Find(5); // Assert Assert.NotNull(company); Assert.Equal("Lidivo3 Edited", company.Name); }
public void DeleteEntityTestCase() { Company company = new Company(); var companyLogic = new CompanyLogic(new StubICompanyDao()); companyLogic.Delete(company); }
public void TryToDeleteAlreadyDeletedEntity() { Company company = new Company() { Excluded = true }; var companyLogic = new CompanyLogic(new StubICompanyDao()); companyLogic.Delete(company); }
public Service1() { _userLogic = new UserLogic(); _companyLogic = new CompanyLogic(); _keyRatioLogic = new KeyRatioLogic(); _saveFileLogic = new SaveFileLogic(); }
public ReallyPaidModel(CarServiceDbContext context, IEmailSender emailSender) { _workSheetLogic = new WorkSheetLogic(context); _emailLogic = new EmailLogic(context, emailSender); _userLogic = new UserLogic(context); _companyLogic = new CompanyLogic(context); }
public void TryToSaveNullEntity() { Company company = null; var companyLogic = new CompanyLogic(new StubICompanyDao()); companyLogic.Save(company); }
public ProfileController() { userLogic = new UtilisateurLogic(); companyLogic = new CompanyLogic(); roleLogic = new RoleLogic(); passwordResetTokenLogic = new PasswordResetTokenLogic(); notificationLogic = new NotificationLogic(); }
public UtilisateurController() { userLogic = new UtilisateurLogic(); companyLogic = new CompanyLogic(); roleLogic = new RoleLogic(); notifLogic = new NotificationLogic(); mailLogic = new MailLogic(); }
public void ErrorWhileTryToUpdateNewEntity() { Company company = new Company(); var target = new CompanyLogic(new StubICompanyDao() { UpdateCompany = (x) => { throw new DatabaseOperationException(); } }); target.Update(company); }
public void ErrorWhileTryToSaveEntityTest() { Company company = new Company(); var companyLogic = new CompanyLogic(new StubICompanyDao() { SaveCompany = (x) => { throw new DatabaseOperationException(); } }); companyLogic.Save(company); }
public void ErrorWhileTryToDeleteEntity() { Company company = new Company(); var companyLogic = new CompanyLogic(new StubICompanyDao() { UpdateCompany = (x) => { throw new DatabaseOperationException(); } }); companyLogic.Delete(company); }
public void TryToSaveAlreadySavedEntity() { Company company = new Company(); var companyLogic = new CompanyLogic(new StubICompanyDao() { VerifyIfAlreadyRegistredCompany = (x) => company }); companyLogic.Save(company); }
public void SaveEntityTestCase() { Company company = null; var target = new CompanyLogic(new StubICompanyDao() { SaveCompany = x => company = x }); target.Save(new Company()); Assert.IsNotNull(company, "O metodo salvar nao executou a operacao de salvar do repositorio."); Assert.AreEqual(company, new Company(), "O metodo salvar nao salvou a mesma entidade informada."); }
public ActionResult DeleteConfirmed(Guid id) { //CompanyProfilePoco companyProfilePoco = companyLogic.GetJobDescription(id); //CompanyDescriptionPoco companyDescriptionPoco = new CompanyDescriptionPoco(); //compProfilePoco[0] = companyProfilePoco; //companyProfileLogic.Delete(compProfilePoco); CompanyLogic companyLogic = new CompanyLogic(); companyLogic.DeleteJobDescription(id); return(RedirectToAction("Index")); }
public void UpdateEntityTestCase() { Company company = new Company(); var target = new CompanyLogic(new StubICompanyDao() { UpdateCompany = (x) => { company = x; } } ); target.Update(new Company()); Assert.IsNotNull(company, "O método salvar não executou a operacao de atualizar entidade no repositorio."); }
public void GetCompany_ShouldReturnCorrectRecord_WhenNotExistingIdIsPassed() { // Arrange var context = this.GetDbContext(); this.PopulateData(context); // Act var service = new CompanyLogic(context, mapper); var company = service.GetCompany(10); // Assert Assert.Null(company); }
private void LoadCompanys() { var companyData = new CompanyLogic().GetCompanys().Select(n => new Company() { Id = n.Id, Name = n.Name }); companies.AddRange(companyData); companySelect.DataSource = companies; companySelect.ValueMember = "Id"; companySelect.DisplayMember = "Name"; line_Company.DataSource = companies; line_Company.ValueMember = "Id"; line_Company.DisplayMember = "Name"; }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Service = await CompanyLogic.GetServiceByIdAsync(id.Value); if (Service == null) { return(NotFound()); } return(Page()); }
public CarController() { companyLogic = new CompanyLogic(); carLogic = new CarLogic(); carModelLogic = new CarModelLogic(); carMakeLogic = new CarMakeLogic(); bookingLogic = new BookingLogic(); requestBookingLogic = new RequestBookingLogic(); eventLogic = new EventLogic(); addressLogic = new AdressLogic(); utilisateurLogic = new UtilisateurLogic(); statusLogic = new StatusLogic(); stopOverLogic = new StopOverLogic(); stopOverAddressLogic = new StopOverAddressLogic(); notificationLogic = new NotificationLogic(); }
private void Save_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(CompanyName.Text) || string.IsNullOrEmpty(Phone.Text)) { errM.Message = "All Feilds mark with asterisk(*) Are Required"; errM.Show(); } else { var id = new CompanyLogic().GetCompanyInfo().Id; CompanyLogic.UpdateCompanyInfo(CompanyName.Text, Phone.Text, Address.Text, Terms.Text, id.ToString()); sm.Message = "Company Details saved successfully"; sm.Show(); Hide(); } }
public void DeleteCompany_ShouldDeleteRecord_WhenExistingIdIsPassed() { // Arrange var context = this.GetDbContext(); this.PopulateData(context); // Act var service = new CompanyLogic(context, mapper); var oldCompany = context.Companies.Find(5); service.DeleteCompany(oldCompany.Id); var company = context.Companies.Find(5); // Assert Assert.NotNull(oldCompany); Assert.False(oldCompany.IsActive); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } WorkerUser workerUser = await UserLogic.GetWorkerUserAsync(User); Service = await CompanyLogic.GetServiceByIdAsync(Service.Id); foreach (var work in Service.Works) { work.StateId = 6; await WorkSheetLogic.ModifyWorkAsync(work); } await _emailLogic.SendStatusChangeEmailAsync(Service); return(RedirectToPage("./Index")); }
public void DeleteCompany_ShouldDeleteRecord_WhenNotExistingIdIsPassed() { // Arrange var context = this.GetDbContext(); this.PopulateData(context); Exception exception = null; // Act var service = new CompanyLogic(context, mapper); var oldCompany = context.Companies.Find(50); try { service.DeleteCompany(oldCompany.Id); } catch (Exception ex) { exception = ex; } // Assert Assert.NotNull(exception); }
public IndexModel(CarServiceDbContext context) { _userLogic = new UserLogic(context); _companyLogic = new CompanyLogic(context); }
public void TryToUpdateNullEntity() { var target = new CompanyLogic(new StubICompanyDao()); target.Update(null); }
public async Task OnGetAsync() { var userId = await UserLogic.GetCompanyUserAsync(User); Services = await CompanyLogic.GetServicesByCompanyIdAsync(userId); }
private void Set_Load(object sender, EventArgs e) { companyLogic = new CompanyLogic(); iniExistCompanyNames(); }
public void TryToDeleteNullEntity() { Company company = null; var companyLogic = new CompanyLogic(new StubICompanyDao()); companyLogic.Delete(company); }
public TestController(CompanyLogic logic, IWebHostEnvironment env, IConfiguration configuration) { _logic = logic; _env = env; _configuration = configuration; }
public CompanyController(IRepository <int, CatalogsDTO, bool> repository) { companyLogic = new CompanyLogic(repository); }