/// <summary> /// 给审核人发送一条消息 /// </summary> /// <param name="audit"></param> public static void SendToDoToSMSAuditor(SMS.Model.SMSMessage sms) { try { string urlSMSEdit = SMSHost + "/Platform/SendSMSAudit"; SystemToDoList std = new SystemToDoList(); std.CreateTime = DateTime.Now; std.Id = System.Guid.NewGuid().ToString(); std.IsDealed = false; std.PageId = "SMSSendSMSAudit" + Util.CommercialSuffix; std.PageTitle = Util.SMSProductName + "审核"; std.Title = "您的" + Util.SMSProductName + "审核中有新的【" + Util.SMSProductName + "审核】申请,请及时审核!"; std.Url = "/Home/Transfer?url=" + urlSMSEdit + "&urlParam=/Common/GetBaseParam"; std.ProjectId = Util.SMSProductId; std.TableName = ""; std.RowId = sms.ID; std.ToDoType = "SMSSendSMSAudit" + Util.CommercialSuffix; string Param = JsonSerialize.Serialize <SystemToDoList>(std); string url = Util.ISMPHost + "/CallBack/SendToDoToOneGroupByPermission"; IDictionary <string, string> pdic = new Dictionary <string, string>(); pdic.Add("Param", Param); pdic.Add("Identifier", std.ToDoType); Post(url, pdic); } catch (Exception ex) { } }
static void StartSimulator() { // Dependencies to inject into the Bulk Device Tester var logger = new TraceLogger(); var configProvider = new ConfigurationProvider(); var telemetryFactory = new CoolerTelemetryFactory(logger); var serializer = new JsonSerialize(); var transportFactory = new IotHubTransportFactory(serializer, logger, configProvider); IVirtualDeviceStorage deviceStorage = null; var useConfigforDeviceList = Convert.ToBoolean(configProvider.GetConfigurationSettingValueOrDefault("UseConfigForDeviceList", "False")); if (useConfigforDeviceList) { deviceStorage = new AppConfigRepository(configProvider, logger); } else { deviceStorage = new VirtualDeviceTableStorage(configProvider); } IDeviceFactory deviceFactory = new CoolerDeviceFactory(); // Start Simulator Trace.TraceInformation("Starting Simulator"); var tester = new BulkDeviceTester(transportFactory, logger, configProvider, telemetryFactory, deviceFactory, deviceStorage); Task.Run(() => tester.ProcessDevicesAsync(cancellationTokenSource.Token), cancellationTokenSource.Token); }
public HttpResponseMessage Inserir([FromBody] InventarioViewModel inventarioViewModel) { var formatter = new JsonMediaTypeFormatter(); string retorno = null; try { if (ModelState.IsValid) { var inventarioDomain = Mapper.Map <InventarioViewModel, Inventario>(inventarioViewModel); _inventarioAppServiceBase.Add(inventarioDomain); retorno = "Código de barras " + inventarioDomain.InvCodigo + "inserido com sucesso."; } var jsonSerialize = new JsonSerialize(); jsonSerialize.SerializarJson(formatter); } catch (Exception ex) { retorno = "Houve um erro interno:" + ex; } return(Request.CreateResponse(System.Net.HttpStatusCode.OK, retorno, formatter)); }
/// <summary> /// Authorize Verify /// </summary> /// <param name="verifyRequest">verify request</param> /// <returns></returns> public static async Task <AuthorizeVerifyResult> AuthorizeVerifyAsync(AuthorizeVerifyRequest verifyRequest) { if (verifyRequest == null) { return(AuthorizeVerifyResult.ForbidResult()); } if (!authorizeConfig.RemoteAuthorizeVerify) { if (AuthorizeVerifyProcessAsync == null) { throw new ArgumentNullException(nameof(AuthorizeVerifyProcessAsync)); } return((await AuthorizeVerifyProcessAsync(verifyRequest).ConfigureAwait(false)) ?? AuthorizeVerifyResult.ForbidResult()); } string server = authorizeConfig.GetRandomServer(); if (server.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(authorizeConfig.Servers)); } var result = await HttpUtil.HttpPostJsonAsync(server, verifyRequest).ConfigureAwait(false); var stringValue = await result.Content.ReadAsStringAsync().ConfigureAwait(false); AuthorizeVerifyResult verifyResult = JsonSerialize.JsonToObject <AuthorizeVerifyResult>(stringValue); return(verifyResult ?? AuthorizeVerifyResult.ForbidResult()); }
public IActionResult PostAjaxHandlerAddBanks(string[] claimsJSON) { Guid id; if (claimsJSON[0] != string.Empty) { JsonSerialize jsonS = new JsonSerialize(); var banksVM = jsonS.JsonDeserializeObject <List <Selected2VM> >(claimsJSON[0]); IList <Bank> banks = new List <Bank>(); foreach (var item in banksVM) { banks.Add(new Bank() { Name = item.text, BankCode = Convert.ToInt32(item.id) }); } _bankAppService.AddRange(banks); return(Json(new { OK = "ok" })); } else { return(Json(new { OK = "Without user" })); } }
public void ProcessRequest(HttpContext context) { using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { Ctop cp = new Ctop(); using (DataTable _dt = cn.ExecQuery("select top 10 * from T0004 ORDER BY C00016 DESC")) { Topdata[] TD = new Topdata[_dt.Rows.Count]; for (int i = 0; i < _dt.Rows.Count; i++) { Topdata tdrow = new Topdata(); tdrow.authors = Coding.ToUnicode(_dt.Rows[i]["C00025"].ToString()); tdrow.cover = _dt.Rows[i]["C00024"].ToString(); tdrow.id = _dt.Rows[i]["C00016"].ToString(); tdrow.last_update_chapter_name = Coding.ToUnicode(_dt.Rows[i]["C00022"].ToString()); tdrow.sum_chapters = "100"; tdrow.sum_source = "101"; tdrow.title = Coding.ToUnicode(_dt.Rows[i]["C00017"].ToString()); tdrow.types = Coding.ToUnicode(_dt.Rows[i]["C00019"].ToString()); TD[i] = tdrow; } cp.month = TD; cp.total = TD; cp.week = TD; } context.Response.Write(JsonSerialize.jSerialize(cp)); } }
public HttpResponseMessage Inserir([FromBody] VendaViewModel vendaViewModel) { var formatter = new JsonMediaTypeFormatter(); string retorno = null; try { if (ModelState.IsValid) { var vendaDomain = Mapper.Map <VendaViewModel, Venda>(vendaViewModel); _vendaAppServiceBase.Add(vendaDomain); retorno = "Venda " + vendaDomain.VenId + "inserida com sucesso."; } var jsonSerialize = new JsonSerialize(); jsonSerialize.SerializarJson(formatter); } catch (Exception ex) { retorno = "Houve um erro interno:" + ex; } return(Request.CreateResponse(System.Net.HttpStatusCode.OK, retorno, formatter)); }
/// <summary> /// upload file /// </summary> /// <param name="url">url</param> /// <param name="files">files</param> /// <param name="parameters">parameters</param> /// <returns>upload result</returns> public static UploadResult Upload(string url, Dictionary <string, byte[]> files, Dictionary <string, string> parameters = null) { #region verify args if (url.IsNullOrEmpty()) { return(new UploadResult() { Success = false, ErrorMsg = "url is null or empty" }); } if (files == null || files.Count <= 0) { return(new UploadResult() { Success = false, ErrorMsg = "not set any files to upload" }); } #endregion string responseVal = HttpCall(url, parameters, files); return(JsonSerialize.JsonToObject <UploadResult>(responseVal)); }
private async Task RunAsync(CancellationToken cancellationToken) { var startTime = DateTime.Now; // Dependencies to inject into the Bulk Device Tester var logger = new TraceLogger(); var configProvider = new ConfigurationProvider(); var telemetryFactory = new CoolerTelemetryFactory(logger); var serializer = new JsonSerialize(); var transportFactory = new IotHubTransportFactory(serializer, logger, configProvider); IVirtualDeviceStorage deviceStorage = null; var useConfigforDeviceList = Convert.ToBoolean(configProvider.GetConfigurationSettingValueOrDefault("UseConfigForDeviceList", "False")); if (useConfigforDeviceList) { deviceStorage = new AppConfigRepository(configProvider, logger); } else { deviceStorage = new VirtualDeviceTableStorage(configProvider); } IDeviceFactory deviceFactory = new CoolerDeviceFactory(); var tester = new BulkDeviceTester(transportFactory, logger, configProvider, telemetryFactory, deviceFactory, deviceStorage); await tester.ProcessDevicesAsync(cancellationToken); Trace.TraceInformation(""); Trace.TraceInformation("*********************************************************************************************************************"); Trace.TraceInformation("ELAPSED TIME: {0}ms", (DateTime.Now - startTime).TotalMilliseconds); Trace.TraceInformation("*********************************************************************************************************************"); Trace.TraceInformation(""); }
public HttpResponseMessage Inserir([FromBody] CupomViewModel cupomViewModel) { var formatter = new JsonMediaTypeFormatter(); string retorno = null; try { if (ModelState.IsValid) { var cupomDomain = Mapper.Map <CupomViewModel, Cupom>(cupomViewModel); _cupomAppServiceBase.Add(cupomDomain); retorno = "Cupom " + cupomDomain.CupCodigo + "inserido com sucesso."; } var jsonSerialize = new JsonSerialize(); jsonSerialize.SerializarJson(formatter); } catch (Exception ex) { retorno = "Houve um erro interno:" + ex; } return(Request.CreateResponse(System.Net.HttpStatusCode.OK, retorno, formatter)); }
/// <summary> /// 根据登陆账号身份编号获取session /// </summary> /// <param name="subject">身份编号</param> /// <returns></returns> public static async Task <AuthSession> GetSessionBySubjectAsync(string subject) { if (subject == null) { return(null); } var sessionResponse = await CacheManager.StringGetAsync(new StringGetRequest() { CacheObject = GetCacheObject(), Keys = new List <string>() { subject } }).ConfigureAwait(false); if (!(sessionResponse?.Success ?? false) || sessionResponse.Values.IsNullOrEmpty()) { return(null); } var sessionValue = sessionResponse.Values.First()?.Value.ToString() ?? string.Empty; var session = JsonSerialize.JsonToObject <AuthSession>(sessionValue); if (!(session?.AllowUse() ?? false)) { session = null; } return(session); }
/// <summary> /// 从Json配置文件中初始化显示 /// </summary> /// <param name="jsonData">JSON数据</param> public static void InitFromJsonData(string jsonData) { if (string.IsNullOrWhiteSpace(jsonData)) { return; } DisplayCollection displayCollection = JsonSerialize.JsonToObject <DisplayCollection>(jsonData); if (displayCollection == null || displayCollection.Types == null) { return; } foreach (var type in displayCollection.Types) { if (type == null || string.IsNullOrWhiteSpace(type.TypeFullName) || type.Propertys == null) { continue; } Type modelType = Type.GetType(type.TypeFullName); if (modelType == null) { continue; } foreach (var propertyDisplay in type.Propertys) { if (propertyDisplay == null || string.IsNullOrWhiteSpace(propertyDisplay.Name) || propertyDisplay.Display == null) { continue; } DisplayManager.Add(modelType, propertyDisplay.Name, propertyDisplay.Display.DisplayName); } } }
public HttpResponseMessage ConsultaClsCab() { var formatter = new JsonMediaTypeFormatter(); List <ClsCab> retorno = null; string erro = null; try { if (ModelState.IsValid) { //retorno = _vFunUadCabAppServiceBase.GetAll().Select(item => new VFunUadCab).ToList(); retorno = _clsCabAppServiceBase.GetAll().Select(item => new ClsCab { Cod = item.Cod, Des = item.Des }).ToList(); } var jsonSerialize = new JsonSerialize(); jsonSerialize.SerializarJson(formatter); } catch (Exception ex) { erro = "Houve um erro interno:" + ex; } return(Request.CreateResponse(System.Net.HttpStatusCode.OK, new { retorno, erro }, formatter)); }
public async Task User_UpdateAsync_Return_OK() { // Arrange Authenticate(); var newUser = _userBuilder.CreateUser(); newUser.Username = "******"; newUser.Email = "*****@*****.**"; StringContent postContentString = JsonSerialize.GenerateStringContent(newUser); var postResponse = await _client.PostAsync("api/user/", postContentString); var user = await postResponse.Content.ReadAsAsync <UserDTO>(); user.username = "******"; StringContent putContentString = JsonSerialize.GenerateStringContent(user); // Act var response = await _client.PutAsync($"api/user/{ user.id }/", putContentString); // Assert response.StatusCode.Should().Be(HttpStatusCode.OK); var returnedUser = await response.Content.ReadAsAsync <UserDTO>(); returnedUser.username.Should().Be("theos_sistemas"); }
public HttpResponseMessage Excluir(int id) { var formatter = new JsonMediaTypeFormatter(); string retorno = null; try { if (ModelState.IsValid) { var prdCabDomain = _prdCabAppServiceBase.GetById(id); _prdCabAppServiceBase.Remove(prdCabDomain); retorno = "Produto " + prdCabDomain.Des + "excluído com sucesso."; } var jsonSerialize = new JsonSerialize(); jsonSerialize.SerializarJson(formatter); } catch (Exception ex) { retorno = "Houve um erro interno:" + ex; } return(Request.CreateResponse(System.Net.HttpStatusCode.OK, retorno, formatter)); }
/// <summary> /// 动漫app由9miao社团研发,如有问题请登陆http://www.9miao.com/官网 /// </summary> /// public void ProcessRequest(HttpContext context) { comicsearchhots chots = new comicsearchhots(); chots.result = 1; chots.msg = "OK"; try { using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { using (DataTable _dt = cn.ExecQuery(@"SELECT top 20 * FROM T0003 ORDER BY C00010 DESC")) { comicsearchhotData[] comDataList = new comicsearchhotData[_dt.Rows.Count]; for (int i = 0; i < _dt.Rows.Count; i++) { comicsearchhotData cData = new comicsearchhotData(); cData.id = _dt.Rows[i]["C00010"].ToString(); cData.name = Coding.ToUnicode(_dt.Rows[i]["C00011"].ToString()); comDataList[i] = cData; } chots.data = comDataList; } } } catch { } context.Response.ContentType = "text/plain"; context.Response.Write(JsonSerialize.jSerialize(chots)); }
public HttpResponseMessage BuscarPorNome(string nome) { List <Produto> retorno = null; var formatter = new JsonMediaTypeFormatter(); string mensagem = null; try { if (ModelState.IsValid) { retorno = _produtoAppServiceBase.GetByFilter(p => p.ProNome == nome).ToList(); if (retorno.Count == 0) { mensagem = "Produto não encontrado."; } } var jsonSerialize = new JsonSerialize(); jsonSerialize.SerializarJson(formatter); } catch (Exception ex) { mensagem = "Houve um erro interno:" + ex; } return(Request.CreateResponse(System.Net.HttpStatusCode.OK, new { retorno, mensagem }, formatter)); }
static void StartSimulator() { // Dependencies to inject into the Bulk Device Tester var logger = new TraceLogger(); var configProvider = new ConfigurationProvider(); var telemetryFactory = new EngineTelemetryFactory(logger, configProvider); var serializer = new JsonSerialize(); var transportFactory = new IotHubTransportFactory(serializer, logger, configProvider); IVirtualDeviceStorage deviceStorage = null; var useConfigforDeviceList = Convert.ToBoolean(configProvider.GetConfigurationSettingValueOrDefault("UseConfigForDeviceList", "False"), CultureInfo.InvariantCulture); if (useConfigforDeviceList) { deviceStorage = new AppConfigRepository(configProvider, logger); } else { deviceStorage = new VirtualDeviceTableStorage(configProvider); } IDeviceFactory deviceFactory = new EngineDeviceFactory(); // Start Simulator Trace.TraceInformation("Starting Simulator"); var tester = new BulkDeviceTester(transportFactory, logger, configProvider, telemetryFactory, deviceFactory, deviceStorage); Task.Run(() => tester.ProcessDevicesAsync(cancellationTokenSource.Token), cancellationTokenSource.Token); }
public HttpResponseMessage Inserir([FromBody] ProdutoViewModel produtoViewModel) { var formatter = new JsonMediaTypeFormatter(); string retorno = null; try { if (ModelState.IsValid) { var produtoDomain = Mapper.Map <ProdutoViewModel, Produto>(produtoViewModel); _produtoAppServiceBase.Add(produtoDomain); retorno = "Produto " + produtoDomain.ProNome + "inserido com sucesso."; } var jsonSerialize = new JsonSerialize(); jsonSerialize.SerializarJson(formatter); } catch (Exception ex) { retorno = "Houve um erro interno:" + ex; } return(Request.CreateResponse(System.Net.HttpStatusCode.OK, retorno, formatter)); }
public HttpResponseMessage BuscarPorId(int id) { Inventario retorno = null; var formatter = new JsonMediaTypeFormatter(); string mensagem = null; try { if (ModelState.IsValid) { retorno = _inventarioAppServiceBase.GetById(id); if (retorno == null) { mensagem = "Produto por Id não encontrado."; } } var jsonSerialize = new JsonSerialize(); jsonSerialize.SerializarJson(formatter); } catch (Exception ex) { mensagem = "Houve um erro interno:" + ex; } return(Request.CreateResponse(System.Net.HttpStatusCode.OK, new { retorno, mensagem }, formatter)); }
public HttpResponseMessage BuscarPorCodigo(string codigo) { List <Inventario> retorno = null; var formatter = new JsonMediaTypeFormatter(); string mensagem = null; try { if (ModelState.IsValid) { retorno = _inventarioAppServiceBase.GetByFilter(p => p.InvCodigo == codigo).ToList(); if (retorno.Count == 0) { mensagem = "Código de barras não encontrado."; } } var jsonSerialize = new JsonSerialize(); jsonSerialize.SerializarJson(formatter); } catch (Exception ex) { mensagem = "Houve um erro interno:" + ex; } return(Request.CreateResponse(System.Net.HttpStatusCode.OK, new { retorno, mensagem }, formatter)); }
public void Emit(T objeto, string cola = "default", string ruta = "default", bool duradero = false, bool exclusivo = false, bool autoBorrado = false, IDictionary <string, object> argumentos = null) { ConnectionFactory conn = new ConnectionFactory(); conn.Uri = new Uri(_URI_CONEXION); using (IConnection cn = conn.CreateConnection()) { using (IModel ch = cn.CreateModel()) { JsonSerialize <T> jser = new JsonSerialize <T>(); byte[] datos = jser.GetJsonStr(objeto); //Enviamos ch.QueueDeclare(queue: cola, durable: duradero, exclusive: exclusivo, autoDelete: autoBorrado, arguments: argumentos); ch.BasicPublish(exchange: "", routingKey: ruta, basicProperties: null, body: datos); } } }
public void Receive(EventHandler <T> handler, string cola = "default", string ruta = "default", bool duradero = false, bool exclusivo = false, bool autoBorrado = false, IDictionary <string, object> argumentos = null) { IConnectionFactory cf = new ConnectionFactory(); cf.Uri = new Uri(_URI_CONEXION); using (IConnection cn = cf.CreateConnection()) { using (IModel ch = cn.CreateModel()) { ch.QueueDeclare(queue: cola, durable: duradero, exclusive: exclusivo, autoDelete: autoBorrado, arguments: argumentos); var consumidor = new EventingBasicConsumer(ch); consumidor.Received += (model, ea) => { byte[] datos = ea.Body.ToArray(); JsonSerialize <T> js = new JsonSerialize <T>(); T valor; valor = js.GetObjectByt(datos); handler(this, valor); }; } } }
/// <summary> /// execute api /// </summary> /// <typeparam name="T">return data type</typeparam> /// <param name="apiObjectName">api object name </param> /// <param name="endpointName">endpoint</param> /// <param name="request">request</param> /// <returns></returns> public static async Task <T> PostAsync <T>(string apiObjectName, string endpointName, ApiRequest request) { var apiObject = GetApiObject(apiObjectName); if (apiObject == null) { throw new Exception(string.Format("didn't config api {0}", apiObjectName)); } var apiServer = apiObject.GetServer(); if (apiServer == null) { throw new Exception(string.Format("set up at least one server info for api {0}", apiObjectName)); } var endpoint = GetApiEndpoint(apiObjectName, endpointName); if (endpoint == null) { throw new Exception(string.Format("didn't set endpoint for {0}", endpointName)); } var response = await HttpUtil.HttpPostJsonAsync(apiServer.GetEndpointPath(endpoint.Path), request).ConfigureAwait(false); string stringValue = await response.Content.ReadAsStringAsync().ConfigureAwait(false); return(JsonSerialize.JsonToObject <T>(stringValue)); }
public void ProcessRequest(HttpContext context) { string comic_id = context.Request["comic_id"]; //漫画id string chap_id = context.Request["chap_id"]; //章节 using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { ChapInforMation chapIn = new ChapInforMation(); using (DataTable _dt = cn.ExecQuery(@"select * from T0005 where C00029=? and C00030=?" , new OleDbParameter[] { new OleDbParameter("@C00029", chap_id), new OleDbParameter("@C00030", comic_id) })) { if (_dt.Rows.Count > 0) { DataRow dr = _dt.Rows[0]; chapIn.chapter_name = Coding.ToUnicode(dr["C00031"].ToString()); chapIn.chapter_order = dr["C00032"].ToString(); chapIn.comic_id = dr["C00030"].ToString(); } } string h_id = chap_id; //上一张 using (DataTable _dt = cn.ExecQuery(@"select top 1 C00029 from T0005 where C00030=" + comic_id + " and C00029 < " + chap_id + " order by C00029 desc")) { if (_dt.Rows.Count > 0) { h_id = _dt.Rows[0]["C00029"].ToString(); chapIn.id = h_id; //根据话id 查找 using (DataTable _dts = cn.ExecQuery(@"Select * from T0006 WHERE C00035=? order by C00034 asc" , new OleDbParameter[] { new OleDbParameter("@C00035", h_id) })) { string[] pages = new string[_dts.Rows.Count]; for (int i = 0; i < _dts.Rows.Count; i++) { pages[i] = _dts.Rows[i]["C00036"].ToString(); } chapIn.page = pages; } } } context.Response.ContentType = "text/plain"; context.Response.Write(JsonSerialize.jSerialize(chapIn)); } }
internal WeatherShieldDeviceFactory() { this._logger = new TraceLogger(); this._configProvider = new ConfigurationProvider(); var serializer = new JsonSerialize(); this._transportFactory = new IotHubTransportFactory(serializer, this._logger, this._configProvider); }
public IActionResult GetPartialViewNotifications(string notifications) { JsonSerialize jsonS = new JsonSerialize(); var lista = jsonS.JsonDeserializeObject <List <Notification> >(notifications); ViewData["Notifications"] = lista; return(PartialView("~/Views/Modals/_ViewPartialNotifications.cshtml")); }
public static string ConvertToJson(ICollection <ParentTree> parentTrees) { JsonSerialize jsonS = new JsonSerialize(); var defaultData = InsertNodes(parentTrees); var jsonNodeTree = jsonS.JsonSerializer <DefaultData>(defaultData); return(jsonNodeTree); }
/// <summary> /// object deep clone /// </summary> /// <typeparam name="T">data type</typeparam> /// <param name="sourceObj">object</param> /// <returns>new object</returns> public static T DeepClone <T>(this T sourceObj) { if (sourceObj == null) { return(default(T)); } var objectString = JsonSerialize.ObjectToJson <T>(sourceObj); return(JsonSerialize.JsonToObject <T>(objectString)); }
public async Task Book_Remove_Without_Authentication_Return_Unauthorized() { // Arrange StringContent contentString = JsonSerialize.GenerateStringContent(_bookBuilder.CreateValidBook()); // Act var response = await _client.DeleteAsync("api/book/0"); // Assert response.StatusCode.Should().Be(HttpStatusCode.Unauthorized); }
/// <summary> /// 请求Json数据 /// </summary> /// <param name="url">请求地址</param> /// <param name="data">请求数据</param> /// <returns></returns> public static async Task <HttpResponseMessage> HttpPostJsonAsync(string url, object data = null) { string jsonData = string.Empty; if (data != null) { jsonData = JsonSerialize.ObjectToJson(data); } return(await HttpPostJsonAsync(url, jsonData).ConfigureAwait(false)); }
public async Task User_Update_Without_Authentication_Return_Unauthorized() { // Arrange StringContent contentString = JsonSerialize.GenerateStringContent(_userBuilder.CreateUser()); // Act var response = await _client.PutAsync("api/user/1/", contentString); // Assert response.StatusCode.Should().Be(HttpStatusCode.Unauthorized); }
public DeviceManager(ILogger logger, CancellationToken token) { _logger = logger; _token = token; _mutex = new Mutex(true, mutexId); _cancellationTokens = new Dictionary<string, CancellationTokenSource>(); _devices = new Dictionary<string, IDevice >(); // Sensors = new SensorsCollection<AbstractSensor>(); //We may need leave only one sensor collection _configProvider = new ConfigurationProvider(); _deviceConfiguration = new DeviceConfigTableStorage(_configProvider); var serializer = new JsonSerialize(); _transportFactory = new IotHubTransportFactory(serializer, _logger, _configProvider); _telemetryFactory = new WeatherShieldTelemetryFactory(_logger); RunReadSensorsThread(); }