public VisualizerForm(Settings settings) { m_Settings = settings; InitializeComponent(); InitBinding(); InitTypeConverters(); IClientService client = new Client(m_Settings); client.Options.LegacyFieldFlagEncoding = false; client.MessageReceived += ClientOnMessageReceived; client.MetaMessageReceived += ClientOnMessageReceived; BlockingCollection <Publisher> publisherQueue = new BlockingCollection <Publisher>(); m_PublisherBindings = new ConcurrentDictionary <string, ConcurrentDictionary <ushort, BindingSource> >(); BlockingCollection <DataPointCollection> valueQueue = new BlockingCollection <DataPointCollection>(); Parser parser = new Parser(publisherQueue, valueQueue, this, m_PublisherBindings); client.MessageReceived += parser.OnMessageDecoded; client.MetaMessageReceived += parser.OnMessageDecoded; client.FileReceived += parser.ClientOnFileReceived; m_UpdatePublisher = new UpdatePublisher(publisherQueue, m_PublisherBindingSource, this); m_UpdateValues = new UpdateValues(valueQueue, m_PublisherBindings, this); // there was a decoding standard violation in a part of the meta frame // which has been fixed and we enable it here to use this fix client.Options.LegacyFieldFlagEncoding = false; if (m_Settings.Client.UseTls) { // with TLS for use e.g. with MQTT-Broker as MDSP simulation // Broker CA certificate if (SettingManager.TryGetCertificateAsArray(m_Settings.Client.BrokerCACert, out byte[] brokerCaCert))
public async Task <SharedLookUpResponse> UpdatePublisherAsync(UpdatePublisher updatePublisher) { var publishers = await iMSDbContext.Publishers.Where(x => x.Id != updatePublisher.Id).ToListAsync(); var isDuplicated = publishers.Any(x => x.Name.ToLowerInvariant() == updatePublisher.Name.ToLowerInvariant() && x.Email.ToLowerInvariant() == updatePublisher.Email.ToLowerInvariant()); if (isDuplicated) { return new SharedLookUpResponse() { HasError = true, ErrorType = SharedLookUpResponseType.Code, Message = "Duplicate Name and Email of Publisher, please use unique code" } } ; else { var publisher = await iMSDbContext.Publishers.FirstAsync(x => x.Id == updatePublisher.Id); publisher.Name = updatePublisher.Name; publisher.Email = updatePublisher.Email; publisher.Address = updatePublisher.Address; publisher.Contract = updatePublisher.Contract; iMSDbContext.Publishers.Update(publisher); await iMSDbContext.SaveChangesAsync(); return(new SharedLookUpResponse() { HasError = false, Message = "Publisher updated successfully" }); } }
public void TaskFailTest() { var task = new UpdatePublisher(EmptyDbContext, new FormattingService()); var result = task.DoTask(null); Assert.IsFalse(result.Success); Assert.IsNotNull(result.Exception); }
private void btnPublisherUpdate_Click(object sender, EventArgs e) { try { publisherTable.Rows[publisherTable.CurrentRow.Index].Cells[0].Value.ToString(); } catch { MessageBox.Show("수정할 출판사를 선택해주세요."); return; } UpdatePublisher updatePublisher = new UpdatePublisher(this, publisherTable.Rows[publisherTable.CurrentRow.Index].Cells[0].Value.ToString()); updatePublisher.Show(); }
public void TaskSuccessTest() { var testPublisher = TestsModel.Publisher; var addPublisherTask = new AddPublisher(DbContext, new FormattingService()); var addPublisherResult = addPublisherTask.DoTask(testPublisher); Assert.IsTrue(addPublisherResult.Success); Assert.IsNull(addPublisherResult.Exception); var task = new UpdatePublisher(DbContext, new FormattingService()); UpdatePublisherModel(testPublisher); var result = task.DoTask(testPublisher); Assert.IsTrue(result.Success); Assert.IsNull(result.Exception); Assert.IsNull(result.Data); var getPublisherTask = new GetPublisher(DbContext); var publisher = getPublisherTask.DoTask(testPublisher.Id)?.Data; var formattingService = new FormattingService(); Assert.IsNotNull(publisher); Assert.AreEqual(testPublisher.Name, publisher.Name); Assert.AreEqual(formattingService.FormatTaxId(testPublisher.TaxId), publisher.TaxId); Assert.AreEqual(testPublisher.Email, publisher.Email); Assert.AreEqual(formattingService.FormatPhoneNumber(testPublisher.Phone), publisher.Phone); Assert.AreEqual(testPublisher.Address.Street, publisher.Address.Street); Assert.AreEqual(testPublisher.Address.City, publisher.Address.City); Assert.AreEqual(testPublisher.Address.Region, publisher.Address.Region); Assert.AreEqual(testPublisher.Address.PostalCode, publisher.Address.PostalCode); Assert.AreEqual(testPublisher.Address.Country.Name, publisher.Address.Country.Name); var removePublisherTask = new RemovePublisher(DbContext); var removePublisherResult = removePublisherTask.DoTask(publisher); Assert.IsTrue(removePublisherResult.Success); Assert.IsNull(removePublisherResult.Exception); }
private void btnPublisherUpdate_Click(object sender, EventArgs e) { UpdatePublisher updatePublisher = new UpdatePublisher(this, publisherTable.Rows[publisherTable.CurrentRow.Index].Cells[0].Value.ToString()); updatePublisher.Show(); }
public IPublisherModel Any(UpdatePublisher request) { return(workflow.Update(request)); }