public DeviceController(GatewayService gatewayService) { gatewayMonitor_ = gatewayService.gatewayMonitor_; _serviceDownToken = gatewayService.serviceDownToken; gatewayId = gatewayService.myInfo.Id.InstanceId; context = gatewayService.Context; }
private void ConfigureData() { gateway = new Domain.Gateway() { Id = 1, SerialNumber = "G1", IPV4Address = "12.12.1.2", Name = "G1" }; gatewayDto = new GatewayDto() { Id = 1, SerialNumber = "G1", IPV4Address = "12.12.1.2", Name = "G1" }; gatewayDetailsDto = new GatewayDetailsDto() { Id = 1, SerialNumber = "G1", IPV4Address = "12.12.1.2", Name = "G1", Devices = new List <DeviceDto>() }; mapper = new MapperConfiguration(c => c.AddProfile <AutoMapping>()).CreateMapper(); gatewayRepositoryMock.Get(gateway.Id).Returns(Task <Domain.Gateway> .FromResult(gateway)); gatewayRepositoryMock.Insert(gateway).Returns(Task <Domain.Gateway> .FromResult(gateway)); gatewayRepositoryMock.Delete(gateway).Returns(Task <Domain.Gateway> .FromResult(gateway)); service = new GatewayService(this.gatewayRepositoryMock, mapper); }
public MainForm() { InitializeComponent(); _gatewayService = new GatewayService(); _synchroniseService = new SynchroniseService(); _gateways = new List <Gateway>(); }
protected override void DoSetUp() { // this one is in DMZ pricedeskInputQueue = "test.pricedesk.input"; pricedesk = CreateBus(pricedeskInputQueue, new HandlerActivatorForTesting()); // and this one is inside ordersystemInputQueue = "test.ordersystem.input"; orderSystemHandlerActivator = new HandlerActivatorForTesting(); ordersystem = CreateBus(ordersystemInputQueue, orderSystemHandlerActivator); // so we set up a one-way gateway service on each side: gatewayInDmz = new GatewayService { ListenQueue = "test.rebus.dmz.gateway", DestinationUri = "http://localhost:18080", }; gatewayInside = new GatewayService { ListenUri = "http://+:18080", DestinationQueue = ordersystemInputQueue }; gatewayInDmz.Start(); gatewayInside.Start(); pricedesk.Start(1); ordersystem.Start(1); }
public void TestDeviceAdapter( ) { try { GatewayService service = PrepareGatewayService( ); DeviceAdapterLoader dataIntakeLoader = new DeviceAdapterLoader(Loader.GetSources( ), Loader.GetEndpoints( ), _logger); _totalMessagesToSend += 5; dataIntakeLoader.StartAll(service.Enqueue, DataArrived); _completed.WaitOne( ); dataIntakeLoader.StopAll( ); _batchSenderThread.Stop(STOP_TIMEOUT_MS); } catch (Exception ex) { _logger.LogError("exception caught: " + ex.StackTrace); } finally { _batchSenderThread.Stop(STOP_TIMEOUT_MS); _sender.Close( ); } }
private void InitializeObject() { _gatewayService = new GatewayService(); _sensorBgWService = new SensorBgWService(); _gatewayRepository = new GatewayRepository(); _emailService = new EmailService(); }
public async Task <string> Insert(Payment valPayment) { string vResult = string.Empty; try { ResponseGateway vProccessPayGateway = await InsertPaymentGateway(valPayment); GatewayService vGatewayService = new GatewayService(); if (vProccessPayGateway != null && vProccessPayGateway.transactionResponse.state == "APPROVED") { valPayment.IdTransaction = vProccessPayGateway.transactionResponse.transactionId; valPayment.GatewayJsonData = JsonConvert.SerializeObject(vProccessPayGateway); SQLToolsLibrary vSqlTools = new SQLToolsLibrary(); List <SqlParameter> vParameterList = new List <SqlParameter> { new SqlParameter("@Id", valPayment.Id), new SqlParameter("@IdTransaction", !(valPayment.IdTransaction == Guid.Empty) ? valPayment.IdTransaction : Guid.Empty), new SqlParameter("@GatewayJsonGata", !string.IsNullOrEmpty(valPayment.GatewayJsonData) ? valPayment.GatewayJsonData : "{}"), new SqlParameter("@IdUser", valPayment.IdUser != Guid.Empty ? valPayment.IdUser : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@IdActivity", valPayment.IdActivity != Guid.Empty ? valPayment.IdActivity : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@Mount", valPayment.Mount), new SqlParameter("@IdCurrency", valPayment.IdCurrency != Guid.Empty ? valPayment.IdCurrency : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@FirstName", !string.IsNullOrEmpty(valPayment.FirstName) ? valPayment.FirstName : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@LastName", !string.IsNullOrEmpty(valPayment.LastName) ? valPayment.LastName : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@TypeNumberDocument", !string.IsNullOrEmpty(valPayment.TypeNumberDocument) ? valPayment.TypeNumberDocument : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@NumberDocument", !string.IsNullOrEmpty(valPayment.NumberDocument) ? valPayment.NumberDocument : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@Email", !string.IsNullOrEmpty(valPayment.Email) ? valPayment.Email : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@Phone", !string.IsNullOrEmpty(valPayment.Phone) ? valPayment.Phone : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@Persons", valPayment.Persons), new SqlParameter("@DateReserve", valPayment.DateReserve), new SqlParameter("@State", valPayment.State), new SqlParameter("@UserCreate", !string.IsNullOrEmpty(valPayment.UserCreate) ? valPayment.UserCreate : string.Empty), new SqlParameter("@DateCreate", valPayment.DateCreate) }; bool vInsert = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Insert_Payment", vConnection); if (vInsert) { SenderMail vSenderMail = new SenderMail(); await vSenderMail.SendEmailWithPayment(valPayment); await vSenderMail.SendEmailToCompanies(valPayment); vResult = "1"; vResult = "1"; } else { vResult = "3"; } } else { vResult = GatewayUtils.ProccessingResponseGateway(vProccessPayGateway.transactionResponse.state); } } catch (Exception vEx) { string vMessage = vEx.Message; vResult = "4"; } return(vResult); }
public void should_get_sermons_by_series() { ICollection <Sermon> _results = new List <Sermon>(); Exception _ex = new Exception(); ManualResetEvent done = new ManualResetEvent(false); string SeriesId = string.Empty; IGatewayService sut = new GatewayService(); sut.GetSeries((Series, ex) => { foreach (var s in Series) { SeriesId = s.Id; break; } sut.GetSermonBySeries(SeriesId, (results, ex2) => { _ex = ex2; _results = results; done.Set(); }); }); done.WaitOne(); Assert.IsNull(_ex); Assert.IsTrue(_results.Count > 0); }
public void Initilize() { _gatewayService = A.Fake <GatewayService>(); //TODO: should validate produced xml against scheme before submitting to process // XmlSchemaSet schemaSet = new XmlSchemaSet(); //schemaSet.Add("http://www.govtalk.gov.uk/CM/envelope", "envelope-v2-0-HMRC.xsd"); }
/// <summary> /// Constructs the Freshbooks API authentication and wrapper class /// </summary> /// <param name="accountName">The account name for which you are trying to access</param> /// <param name="consumerKey">The developer's freshbooks account name</param> /// <param name="oauthSecret">The developer's oauth-secret provided by freshbooks</param> public FreshbooksApi(string accountName, string consumerKey, string oauthSecret) { _accountName = accountName; _consumerKey = consumerKey; _oauthSecret = oauthSecret ?? String.Empty; _baseUri = new UriBuilder { Scheme = "https", Host = accountName + ".freshbooks.com" }.Uri; _serviceUri = new Uri(_baseUri, "/api/2.1/xml-in"); Clear(); UserAgent = String.Format("{0}/{1} ({2})", GetType().Name, GetType().Assembly.GetName().Version.ToString(2), GetType().Assembly.FullName); Callback = new CallbackService(new ServiceProxy(this, "callback")); Category = new CategoryService(new ServiceProxy(this, "category")); Client = new ClientService(new ServiceProxy(this, "client")); Estimate = new EstimateService(new ServiceProxy(this, "estimate")); Expense = new ExpenseService(new ServiceProxy(this, "expense")); Gateway = new GatewayService(new ServiceProxy(this, "gateway")); Invoice = new InvoiceService(new ServiceProxy(this, "invoice")); Item = new ItemService(new ServiceProxy(this, "item")); Language = new LanguageService(new ServiceProxy(this, "language")); Payment = new PaymentService(new ServiceProxy(this, "payment")); Project = new ProjectService(new ServiceProxy(this, "project")); Recurring = new RecurringService(new ServiceProxy(this, "recurring")); System = new SystemService(new ServiceProxy(this, "system")); Staff = new StaffService(new ServiceProxy(this, "staff")); Task = new TaskService(new ServiceProxy(this, "task")); Tax = new TaxService(new ServiceProxy(this, "tax")); TimeEntry = new TimeEntryService(new ServiceProxy(this, "time_entry")); }
public object GetConditions(string ElementId, Guid ProcessId) { using (GatewayService gatewayService = new GatewayService()) { sysBpmsGateway sysBpmsGateway = gatewayService.GetInfo(ElementId, ProcessId); using (SequenceFlowService sequenceFlowService = new SequenceFlowService()) { using (ElementService elementService = new ElementService()) { using (ConditionService conditionService = new ConditionService()) { List <sysBpmsSequenceFlow> SequenceFlows = sequenceFlowService.GetList(ProcessId, "", ElementId, ""); List <sysBpmsElement> Elements = elementService.GetList(SequenceFlows.Select(c => c.TargetElementID).ToArray(), ProcessId); using (ProcessService processService = new ProcessService()) return new { SequenceFlows = SequenceFlows.Select(c => new { c.ID, Elements.FirstOrDefault(d => d.ID == c.TargetElementID).Name, }).ToList(), AllowEdit = processService.GetInfo(ProcessId).AllowEdit(), GatewayID = sysBpmsGateway.ID, GetList = conditionService.GetList(sysBpmsGateway.ID, null, null).Select(c => new ConditionDTO(c)).ToList(), }; } } } } }
public void Setup() { var config = new MapperConfiguration(opts => { opts.AddProfile(new ModelToResourceProfile()); opts.AddProfile(new ResourceToModelProfile()); }); var _mapper = config.CreateMapper(); // Use this mapper to instantiate your class var optionsBuilder = new DbContextOptionsBuilder <AppDbContext>(); optionsBuilder.UseInMemoryDatabase("data-in-memory"); var _dbcontext = new AppDbContext(optionsBuilder.Options); var _deviceRepo = new DeviceRepo(_dbcontext); var _gatewayRepo = new GatewayRepo(_dbcontext); var _gatewayService = new GatewayService(_gatewayRepo); var _deviceSerivce = new DeviceService(_deviceRepo, _gatewayRepo); _deviceController = new DevicesController(_deviceSerivce, _mapper); _gatewayController = new GatewaysController(_gatewayService, _mapper); var g1 = new Gateway() { Id = Guid.NewGuid(), IPAddress = new System.Net.IPAddress(new byte[] { 192, 168, 0, 1 }), Name = "Gateway 1" }; var g2 = new Gateway() { Id = Guid.NewGuid(), IPAddress = new System.Net.IPAddress(new byte[] { 192, 168, 0, 2 }), Name = "Gateway 2" }; _dbcontext.Gateways.AddRange(g1, g2); var d11 = new Device() { Id = 101, Vendor = "Cisco", Status = DeviceStatus.OnLine, GatewayId = g1.Id }; var d12 = new Device() { Id = 102, Vendor = "Dell", Status = DeviceStatus.OffLine, GatewayId = g1.Id }; var d13 = new Device() { Id = 103, Vendor = "HP", Status = DeviceStatus.OffLine, GatewayId = g1.Id }; var d21 = new Device() { Id = 201, Vendor = "Huawei", Status = DeviceStatus.OffLine, GatewayId = g2.Id }; var d22 = new Device() { Id = 202, Vendor = "Fujitsu", Status = DeviceStatus.OnLine, GatewayId = g2.Id }; _dbcontext.Devices.AddRange(d11, d12, d13, d21, d22); _dbcontext.SaveChanges(); }
public void IdentifiedRoute_ShouldReturnMatchingRouteWithEndpointIncluded() { var result = new GatewayService(_mockClientFactory.Object) .WithEndpoints(_serviceEndpoints) .Configure(); result.IdentifiedRoute.Should().BeEquivalentTo(_serviceEndpoints[0].Route.Url); }
public void Setup() { _connectionModel = new ConnectionModel { ApiUrl = WebConstant.URL_UNITTEST_TRANSACTION, Username = "******", Password = "******" }; _gatewayService = new GatewayService(_connectionModel); }
public void UnregisterGateway_Should_Not_Allow_To_Unregister_Not_Existing_Gateway() { //arrange var serialNumber = "1234567891234561"; var dataService = new Mock <IDataService>(); dataService.Setup(m => m.Gateways).Returns(new List <Gateway>()); var gatewayService = new GatewayService(dataService.Object); //assert Assert.Throws <GatewayNotFoundException>(() => gatewayService.UnregisterGateway(serialNumber)); }
private GatewayService PrepareGatewayService( ) { _batchSenderThread.Start( ); GatewayService service = new GatewayService(_gatewayQueue, _batchSenderThread, m => DataTransforms.QueuedItemFromSensorDataContract( DataTransforms.AddTimeCreated(DataTransforms.SensorDataContractFromString(m, _logger)), _logger)); service.Logger = _logger; service.OnDataInQueue += DataInQueue; return(service); }
public CloudAdapter(IotHubSenderSettings settings) { _gatewayQueue = new GatewayQueue <QueuedItem>(); _sender = new IotHubSender <QueuedItem>(settings, _logger); _batchSenderThread = new BatchSenderThread <QueuedItem>( _gatewayQueue, _sender, serializedData: m => (m == null) ? null : m.JsonData, logger: _logger); _gatewayTransform = ((deviceId, json) => new QueuedItem(deviceId, json)); service = PrepareGatewayService(); }
public void TestRecieveMessagesFromSocketDevice( ) { const int MESSAGES_TO_SEND_BY_SOCKET = 5; try { IList <string> sources = Loader.GetSources( ) .Where(m => m.Contains("Socket")).ToList( ); IList <SensorEndpoint> endpoints = Loader.GetEndpoints( ) .Where(m => m.Name.Contains("Socket")).ToList( ); if (endpoints.Count == 0) { throw new Exception("Need to specify local ip host for Socket interations " + "and name of endpoint should contain \"Socket\""); } GatewayService service = PrepareGatewayService( ); SensorEndpoint endpoint = endpoints.First( ); SocketClientTestDevice device = new SocketClientTestDevice(_logger); device.Start(endpoint, MESSAGES_TO_SEND_BY_SOCKET); DeviceAdapterLoader dataIntakeLoader = new DeviceAdapterLoader( sources, endpoints, _logger); _totalMessagesToSend += MESSAGES_TO_SEND_BY_SOCKET; dataIntakeLoader.StartAll(service.Enqueue, DataArrived); _completed.WaitOne( ); dataIntakeLoader.StopAll( ); _batchSenderThread.Stop(STOP_TIMEOUT_MS); } catch (Exception ex) { _logger.LogError("exception caught: " + ex.StackTrace); } finally { _batchSenderThread.Stop(STOP_TIMEOUT_MS); _sender.Close( ); } }
public async Task <string> CancelAndRefund(Payment valPayment) { string vResult = string.Empty; try { ResponseGatewayRefund vProccessPayGateway = await Refund(valPayment); GatewayService vGatewayService = new GatewayService(); // if (vProccessPayGateway != null && vProccessPayGateway.transactionResponse.state == "PENDING" && vProccessPayGateway.code != "ERROR") { valPayment.GatewayJsonData = JsonConvert.SerializeObject(vProccessPayGateway); SQLToolsLibrary vSqlTools = new SQLToolsLibrary(); List <SqlParameter> vParameterList = new List <SqlParameter> { new SqlParameter("@Id", valPayment.Id), new SqlParameter("@GatewayJsonData", !string.IsNullOrEmpty(valPayment.GatewayJsonData) ? valPayment.GatewayJsonData : "{}"), new SqlParameter("@UserUpdate", valPayment.UserUpdate), new SqlParameter("@DateUpdate", valPayment.DateUpdate) }; bool vUpdate = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Cancel_Payment", vConnection); if (vUpdate) { SenderMail vSenderMail = new SenderMail(); Payment vPaymenNew = SelectById(valPayment.Id, valPayment.IdLanguage); vPaymenNew.LanguageInitials = valPayment.LanguageInitials; await vSenderMail.SendEmailClientWithCancelAndRefund(vPaymenNew); ICompanyData vCompanyData = new CompanyData(); Company vCompany = vCompanyData.SelectCompanyByPayment(valPayment.Id); vPaymenNew.EmailCompany1 = vCompany.Email1; vPaymenNew.EmailCompany2 = vCompany.Email2; await vSenderMail.SendEmailCompaniesWithCancelAndRefund(vPaymenNew); vResult = "1"; } else { vResult = "3"; } //} else { // vResult = GatewayUtils.ProccessingResponseGateway(vProccessPayGateway.transactionResponse.state); //} } catch (Exception vEx) { string vMessage = vEx.Message; vResult = "4"; } return(vResult); }
public void RegisterGateway_Should_Only_Allow_To_Register_Only_16_Long_Serial_Number() { //arrange var serialNumber = "123456"; var dataService = new Mock <IDataService>(); dataService.Setup(m => m.Gateways).Returns(new List <Gateway>()); dataService.Setup(m => m.Users).Returns(new List <User>() { new User() }); var gatewayService = new GatewayService(dataService.Object); //assert Assert.Throws <IllegallSerialNumberException>(() => gatewayService.RegisterGateway(serialNumber)); }
private async Task <ResponseGatewayRefund> Refund(Payment valPayment) { ResponseGatewayRefund vResult = new ResponseGatewayRefund(); try { GatewayRefund vPaymentGateway = InstanceClassRefound(); GatewayService vGatewayService = new GatewayService(); ICurrencyData vCurrency = new CurrencyData(); ResponseGateway vInfoPayment = JsonConvert.DeserializeObject <ResponseGateway>(valPayment.GatewayJsonData); vPaymentGateway.transaction.order.id = vInfoPayment.transactionResponse.orderId; vPaymentGateway.transaction.parentTransactionId = valPayment.IdTransaction.ToString(); vResult = await vGatewayService.Refund(vPaymentGateway); } catch (Exception) { } return(vResult); }
public async Task GetServiceDescriptor_Integration() { // Arrange var expectedId = 1; var mockRepo = new Mock <IGatewayRepository>(); var service = new GatewayService(new PostsService()); var controller = new GatewayController(service, mockRepo.Object); // Act var actual = await controller.GetServiceDescriptor(expectedId); // Assert Assert.NotNull(actual); Assert.Equal(expectedId, actual.Id); }
public void TestRealTimeData( ) { const int INITIAL_MESSAGES_BOUND = 5; const int STOP_TIMEOUT_MS = 5000; // ms try { ////IList<string> sources = Loader.GetSources( ).Where( //// m => !m.Contains( "Mock" ) //// && ( m.Contains( "Socket" ) || m.Contains( "SerialPort" ) ) //// ).ToList( ); ////IList<SensorEndpoint> endpoints = Loader.GetEndpoints( ); ////if( !endpoints.Any( m => m.Name.Contains( "Socket" ) ) ) ////{ //// Console.Out.WriteLine( "Need to specify local ip host for Socket interations " + //// "and name of endpoint should contain \"Socket\"" ); ////} GatewayService service = PrepareGatewayService( ); ////DeviceAdapterLoader dataIntakeLoader = new DeviceAdapterLoader( //// sources, //// endpoints, //// _logger ); _totalMessagesToSend += INITIAL_MESSAGES_BOUND; ////dataIntakeLoader.StartAll( service.Enqueue, DataArrived ); _completed.WaitOne( ); ////dataIntakeLoader.StopAll( ); _batchSenderThread.Stop(STOP_TIMEOUT_MS); } catch (Exception ex) { _logger.LogError("exception caught: " + ex.StackTrace); } finally { _batchSenderThread.Stop(STOP_TIMEOUT_MS); _sender.Close( ); } }
private GatewayService PrepareGatewayService() { _batchSenderThread.Start(); GatewayService service = new GatewayService( _gatewayQueue, _batchSenderThread, _gatewayTransform ); service.Logger = _logger; service.OnDataInQueue += DataInQueue; _batchSenderThread.OnEventsBatchProcessed += EventBatchProcessed; return(service); }
public void UnregisterGateway_Should_Not_Allow_To_Unregister_Unregistered_Gateway() { //arrange var serialNumber = "1234567891234561"; var dataService = new Mock <IDataService>(); dataService.Setup(m => m.Gateways).Returns(new List <Gateway>() { new Gateway() { SerialNumber = serialNumber, User = new User(), Status = GatewayStatus.Unregistered } }); var gatewayService = new GatewayService(dataService.Object); //assert Assert.Throws <AlreadyUnregisteredGatewayException>(() => gatewayService.UnregisterGateway(serialNumber)); }
public void RegisterGateway_Should_Connect_User_To_Gateway() { //arrange var serialNumber = "1234567891234567"; var dataService = new Mock <IDataService>(); dataService.Setup(m => m.Gateways).Returns(new List <Gateway>()); dataService.Setup(m => m.Users).Returns(new List <User>() { new User() }); var gatewayService = new GatewayService(dataService.Object); //act var current = gatewayService.RegisterGateway(serialNumber); //assert Assert.IsNotNull(current.User); }
protected override void DoSetUp() { RebusLoggerFactory.Current = new ConsoleLoggerFactory(false) { MinLevel = LogLevel.Info }; // this one is in DMZ priceDeskInputQueue = "test.pricedesk.input"; priceDeskHandlerActivator = new HandlerActivatorForTesting(); priceDesk = CreateBus(priceDeskInputQueue, priceDeskHandlerActivator); // and this one is inside orderSystemInputQueue = "test.ordersystem.input"; orderSystemHandlerActivator = new HandlerActivatorForTesting(); orderSystem = CreateBus(orderSystemInputQueue, orderSystemHandlerActivator); priceDeskGatewayInputQueue = "test.rebus.pricedesk.gateway"; MsmqUtil.PurgeQueue(priceDeskGatewayInputQueue); orderSystemGatewayInputQueue = "test.rebus.ordersystem.gateway"; MsmqUtil.PurgeQueue(orderSystemGatewayInputQueue); // so we set up a one-way gateway service on each side: // - the outbound is on the DMZ side priceDeskGatewayService = new GatewayService { ListenQueue = priceDeskGatewayInputQueue, DestinationUri = "http://localhost:" + TestCategories.AvailableHttpPort, }; // and the inbound is on the network domain side orderSystemGatewayService = new GatewayService { ListenUri = "http://+:" + TestCategories.AvailableHttpPort, DestinationQueue = orderSystemInputQueue, }; priceDeskGatewayService.Start(); orderSystemGatewayService.Start(); priceDesk.Start(1); orderSystem.Start(1); }
private static GatewayService CreateGateway(AMQPConfig amqpConfig) { try { var _gatewayQueue = new GatewayQueue <QueuedItem>(); var _AMPQSender = new AMQPSender <string>( amqpConfig.AMQPSAddress, amqpConfig.EventHubName, amqpConfig.EventHubMessageSubject, amqpConfig.EventHubDeviceId, amqpConfig.EventHubDeviceDisplayName, _Logger ); var _batchSenderThread = new BatchSenderThread <QueuedItem, string>( _gatewayQueue, _AMPQSender, null, m => m.JsonData, _Logger); _batchSenderThread.Start(); GatewayService service = new GatewayService( _gatewayQueue, _batchSenderThread ) { Logger = _Logger }; service.OnDataInQueue += (data) => _batchSenderThread.Process(); _Logger.Flush(); return(service); } catch (Exception ex) { _Logger.LogError("Exception on creating Gateway: " + ex.Message); } return(null); }
public Form1() { InitializeComponent(); var model = new MemberInfo { ClientId = "ef3350f9-ace2-4900-9da0-bba80402535a", ClientSecret = "FA1s0QmZFxXh44QUkVOcEj19hvhjWTsfl1sslwGO", ConfigurationPath = @"C:\Box24\Project Execution\config.json", UriString = "http://18.138.61.187", Version = "v1" }; var gatewayService = new GatewayService(model); if (gatewayService.TokenResponse.StatusCode == 200) { textBox1.Text = "By .Net framework 4.7.2, logging is executed."; } }
public void should_get_latest_sermons() { ICollection <Sermon> _results = new List <Sermon>(); Exception _ex = new Exception(); ManualResetEvent done = new ManualResetEvent(false); IGatewayService sut = new GatewayService(); sut.GetLastestSermons((results, ex) => { _ex = ex; _results = results; done.Set(); }); done.WaitOne(); Assert.IsNull(_ex); Assert.IsTrue(_results.Count > 0); }
public void RegisterGateway_Should_Set_Status_To_Registered() { //arrange var serialNumber = "1234567891234567"; var expected = GatewayStatus.Registered; var dataService = new Mock <IDataService>(); dataService.Setup(m => m.Gateways).Returns(new List <Gateway>()); dataService.Setup(m => m.Users).Returns(new List <User>() { new User() }); var gatewayService = new GatewayService(dataService.Object); //act var current = gatewayService.RegisterGateway(serialNumber); //assert Assert.AreEqual(current.Status, expected); }