public async Task SaveChangesAsync_VerifyValidTVShowIsUpdated() { var mockTMDBapi = new Mock <ITMDBapi>(); Movie newMovie = CommonTestFunctions.GetSampleTVShow(true); List <GenreType> SelectGenres = new List <GenreType>(); SelectGenres.Add(GenreType.Romance); Context.Movie.Add(newMovie); Context.SaveChanges(); using (var newcontext = new MarksMoviesContext(Options)) { MovieDBAccess db = new MovieDBAccess(newcontext); var service = new EditService(db, mockTMDBapi.Object); var result = await service.SaveMovieAsync(newMovie, SelectGenres); Assert.IsTrue(result != 0); } using (var newcontext = new MarksMoviesContext(Options)) { var movie = await newcontext.Movie.Include(g => g.Genres).SingleAsync(); Assert.IsNotNull(movie); Assert.IsNotNull(movie.Genres); Assert.AreEqual(1, movie.Genres.Count); } }
public async Task <Service> EditService(EditService serviceForEdit) { var service = await _context.Services.FindAsync(serviceForEdit.Id); if (service == null) { return(null); } service.Name = serviceForEdit.Name; service.Recipient = serviceForEdit.Recipient; service.Description = serviceForEdit.Description; service.MileageReminder = serviceForEdit.MileageReminder; service.MileageRule = serviceForEdit.MileageRule; service.TimeReminder = serviceForEdit.TimeReminder; service.TimeReminderEntity = serviceForEdit.TimeReminderEntity; service.TimeRule = serviceForEdit.TimeRule; service.TimeRuleEntity = serviceForEdit.TimeRuleEntity; service.BasedOn = serviceForEdit.BasedOn; await _context.SaveChangesAsync(); await NextServiceCalculation.CalculateNextService(service.Id, _context); return(this._mapper.Map <Data.Models.Service, Service>(service)); }
public void EditServiceTest() { // Arrange _dataAccessService.Setup(a => a.EditService(TestData.EditServices[0])).ReturnsAsync(TestData.Services[0]); IServiceBusinessService svc = new ServiceBusinessService(_dataAccessService.Object); var editService = new EditService { BasedOn = 0, Description = "", MileageReminder = 0, MileageRule = 0, Name = "Car Wash", Recipient = "*****@*****.**", TimeReminder = 2, TimeReminderEntity = 1, TimeRule = 1, TimeRuleEntity = 2, }; // Act var actual = svc.EditService(editService); // Assert _dataAccessService.Verify(s => s.EditService(It.IsAny <DataAccessService.Models.EditService>()), Times.Once); }
public ProfileModal(StorageService storage, CookieService cookie, ProfileService profile, EditService edit) { storageService = storage; cookieService = cookie; profileService = profile; editService = edit; }
public async Task EditServiceTest() { // Arrange var serviceId = TestData.Services[0].Id; var serviceController = ConfigureController(); var editService = new EditService { BasedOn = 0, Description = "", MileageReminder = 0, MileageRule = 0, Name = "Car Wash", Recipient = "*****@*****.**", TimeReminder = 2, TimeReminderEntity = 1, TimeRule = 1, TimeRuleEntity = 2, }; //// Act var actual = await serviceController.EditService(serviceId, editService); //// Assert Xunit.Assert.NotNull(actual); _serviceBusinessService.Verify(s => s.EditService(It.IsAny <BusinessService.Models.EditService>()), Times.Once); }
public EventsController( ISearchService searchService, UserManager <User> userManager, EditService editService) { _searchService = searchService; _userManager = userManager; _editService = editService; }
public void DeleteDiaryTest001() { mockRepository.Setup(x => x.Delete(1)).Returns(true); var service = new EditService(mockRepository.Object); var result = service.DeleteDiary(1); Assert.True(result); }
public void DeleteDiaryTest002() { mockRepository.Setup(x => x.Delete(2)).Returns(false); var service = new EditService(mockRepository.Object); var result = service.DeleteDiary(2); Assert.False(result); }
public EditViewModel() { _mainViewModel = new MainViewModel(); GoBackCommand = new DelegateCommand <object>(GoBack); _model = new EditService(); _dishIng = new ObservableCollection <Ingredient>(); AddProductCommand = new DelegateCommand <object>(AddProduct); AddDishCommand = new DelegateCommand <object>(AddDish); ClearAllCommand = new DelegateCommand <object>(ClearAll); }
/// <summary> /// Implement dispose to remove references. /// </summary> public void Dispose() { if (!string.IsNullOrWhiteSpace(id)) { EditService.Unregister(id); id = string.Empty; } GC.SuppressFinalize(this); }
public StatUnitsController(NSCRegDbContext context, StatUnitAnalysisRules statUnitAnalysisRules, DbMandatoryFields mandatoryFields, ValidationSettings validationSettings) { _searchService = new SearchService(context); _viewService = new ViewService(context, mandatoryFields); _createService = new CreateService(context, statUnitAnalysisRules, mandatoryFields, validationSettings, StatUnitTypeOfSave.WebApplication); _editService = new EditService(context, statUnitAnalysisRules, mandatoryFields, validationSettings); _deleteService = new DeleteService(context); _historyService = new HistoryService(context); }
public void GetDiaryTest002() { var diaryList = new List <Diary>(); mockRepository.Setup(x => x.Read(1)).Returns(diaryList); var service = new EditService(mockRepository.Object); var result = service.GetDiary(1); Assert.Null(result); }
/// <summary> /// After rendering, hook up the interop. /// </summary> /// <param name="firstRender">A value indicating whether it is the first render.</param> /// <returns>The asynchronous task.</returns> protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { id = await EditService.RegisterTextAsync( Text, this); } await base.OnAfterRenderAsync(firstRender); }
private void btnEdit_Click_1(object sender, EventArgs e) { // gọi api lấy dữ liệu theo mã using (EditService edit = new EditService(Convert.ToInt32(txtService.Text))) { edit.ShowDialog(); } dgvDichVu.DataSource = GetAll(); BindingData(); }
public static DataSourcesQueueService CreateEmptyConfiguredDataSourceQueueService(NSCRegDbContext ctx) { var analysisRules = new StatUnitAnalysisRules(); var dbMandatoryFields = new DbMandatoryFields(); var validationSettings = new ValidationSettings(); var createSvc = new CreateService(ctx, analysisRules, dbMandatoryFields, validationSettings, StatUnitTypeOfSave.WebApplication); var editSvc = new EditService(ctx, analysisRules, dbMandatoryFields, validationSettings); var servicesConfig = new ServicesSettings(); return(new DataSourcesQueueService(ctx, createSvc, editSvc, servicesConfig, dbMandatoryFields)); }
private void AddScopedServices() { var dbContextHelper = new DbContextHelper(); var ctx = dbContextHelper.CreateDbContext(new string[] { }); _queueSvc = new QueueService(ctx); _analysisSvc = new AnalyzeService(ctx, _statUnitAnalysisRules, _dbMandatoryFields, _validationSettings); var createSvc = new CreateService(ctx, _statUnitAnalysisRules, _dbMandatoryFields, _validationSettings, StatUnitTypeOfSave.Service); var editSvc = new EditService(ctx, _statUnitAnalysisRules, _dbMandatoryFields, _validationSettings); _saveManager = new SaveManager(ctx, _queueSvc, createSvc, editSvc); }
public async Task SaveChangesAsync_VerifyNullMovieReturnsZero() { var mockTMDBapi = new Mock <ITMDBapi>(); Movie movie = null; List <GenreType> SelectGenres = new List <GenreType>(); var service = new EditService(DbAccess, mockTMDBapi.Object); var result = await service.SaveMovieAsync(movie, SelectGenres); Assert.AreEqual(0, result); }
public EventManagementController( ISearchService searchService, DeletionService deletionService, CreationService creationService, EditService editService, IHostingEnvironment hostingEnvironment) { _searchService = searchService; _deletionService = deletionService; _creationService = creationService; _editService = editService; _hostingEnvironment = hostingEnvironment; }
private void butEditService_Click(object sender, EventArgs e) { EditService edit = new EditService(); edit.id.Text = dataGridService.CurrentRow.Cells[0].Value.ToString(); edit.textBname.Text = dataGridService.CurrentRow.Cells[1].Value.ToString(); edit.maskedPrize.Text = dataGridService.CurrentRow.Cells[2].Value.ToString(); this.Hide(); edit.ShowDialog(); update(); this.Show(); }
/// <summary> /// /// </summary> /// <param name="expService"></param> /// <param name="editService"></param> /// <param name="deleteService"></param> /// <param name="createService"></param> /// <param name="detailService"></param> /// <param name="rankMoviesService"></param> public MediaController(ExportService expService, EditService editService, DeleteService deleteService, CreateService createService, DetailsService detailService, RankMoviesService rankMoviesService) { _expService = expService; _editService = editService; _deleteService = deleteService; _createService = createService; _detailService = detailService; _rankMoviesService = rankMoviesService; }
public DataSourcesQueueService(NSCRegDbContext ctx, CreateService createSvc, EditService editSvc, ServicesSettings config, DbMandatoryFields dbMandatoryFields) { _dbContext = ctx; _createSvc = createSvc; _editSvc = editSvc; _rootPath = config.RootPath; _uploadDir = config.UploadDir; _dbMandatoryFields = dbMandatoryFields; _statUnitDeleteService = new DeleteService(ctx); _elasticService = new ElasticService(ctx); }
public void UpdateDiaryTest002() { var diary = new Diary(2, "たいとる更新その2(てすと)", "ほんぶん更新その2(てすと)"); mockRepository.Setup(x => x.Update(It.Is <Diary>(x => x.id == 1))).Returns(false); var service = new EditService(mockRepository.Object); var editViewModel = new EditViewModel() { Id = "2", Title = "たいとる更新その2(てすと)", Content = "ほんぶん更新その2(てすと)" }; var result = service.UpdateDiary(editViewModel); Assert.False(result); }
public void GetDiaryTest001() { var diaryList = new List <Diary>(); diaryList.Add(new Diary(1, "たいとる(てすと)", "ほんぶん(てすと)")); mockRepository.Setup(x => x.Read(1)).Returns(diaryList); var service = new EditService(mockRepository.Object); var result = service.GetDiary(1); var model = Assert.IsType <EditViewModel>(result); Assert.Equal("1", result.Id); Assert.Equal("たいとる(てすと)", result.Title); Assert.Equal("ほんぶん(てすと)", result.Content); }
private bool HasTopic(EditService.AbsoluteTopicName[] topics, string name) { foreach (EditService.AbsoluteTopicName topic in topics) { if (topic.Name == name) { return true; } } return false; }
private bool HasNamespace(EditService.ContentBase[] bases, string name) { foreach (EditService.ContentBase contentBase in bases) { if (contentBase.Namespace == name) { return true; } } return false; }
public StorageViewModel() { _model = new EditService(); _mainViewModel = new MainViewModel(); GoBackCommand = new DelegateCommand <object>(GoBack); }
private void BtnEdit_Click(object sender, RoutedEventArgs e) { EditService editServiceWindow = new EditService(service); editServiceWindow.Show(); }
public async Task <Service> EditService(EditService serviceForEdit) { var editedService = await this._serviceDataAccessService.EditService(this._mapper.Map <DataAccessService.Models.EditService>(serviceForEdit)); return(_mapper.Map <Service>(editedService)); }
public async Task <IHttpActionResult> EditService([FromUri] string serviceId, [FromBody] EditService serviceForEdit) { if (!this.ModelState.IsValid) { return(this.BadRequest(this.ModelState)); } var service = await this._serviceBusinessService.GetById(serviceId); if (service == null) { return(this.BadRequest()); } var businessServiceForEdit = this._mapper.Map <BusinessService.Models.EditService>(serviceForEdit); var editedService = await this._serviceBusinessService.EditService(businessServiceForEdit); var apiService = this._mapper.Map <EditService>(editedService); return(this.Ok(apiService)); }
public AnalysisQueueService(NSCRegDbContext context, ViewService viewSvc, EditService editSvc) { _context = context; _viewSvc = viewSvc; _editSvc = editSvc; }
public EditController() { this.service = new EditService(); }