private void dependency_OnChange(object sender, SqlNotificationEventArgs e)
 {
     if (e.Type == SqlNotificationType.Change)
     {
         TestHub.SendMessages();
     }
 }
        public async Task PostAsync([FromBody] Input value)
        {
            //values.Add(value.Value);

            await TestHub.SendValueAsync(JsonConvert.SerializeObject(new
            {
                action = "echo",
                data   = value
            }), _hubClients);

            return;
        }
        public async Task <IEnumerable <WeatherForecast> > Get()
        {
            try {
                hub = new TestHub();

                await hub?.SendMessage("test");
            }
            catch (Exception ex) {
                return(new List <WeatherForecast>());
            }

            var rng = new Random();

            return(Enumerable.Range(1, 5).Select(index => new WeatherForecast
            {
                Date = DateTime.Now.AddDays(index),
                TemperatureC = rng.Next(-20, 55),
                Summary = Summaries[rng.Next(Summaries.Length)]
            })
                   .ToArray());
        }
Beispiel #4
0
 /// <summary>
 /// Deletes a model from the repository by the given id
 /// </summary>
 /// <param name="id"></param>
 // DELETE api/<controller>/5
 public void Delete(int id)
 {
     _repo.DeleteModel(id);
     TestHub.RemoveTestModel(id);
 }
Beispiel #5
0
 /// <summary>
 /// Saves the given model in the repository
 /// </summary>
 /// <param name="model"></param>
 // POST api/<controller>
 public void Post([FromBody] TestModel model)
 {
     _repo.InsertModel(model);
     TestHub.AddTestModel(ProtoSerializer.Serialize(model));
 }
 public void SetUp()
 {
     _fixture       = new Fixture();
     _hub           = new TestHub();
     _sentryOptions = new SentryOptions();
 }
 public UpdateRandomNumber(TestHub testHub)
 {
     this.TestHub = testHub;
 }
Beispiel #8
0
 public TestController(ITestService testService)
 {
     this.testService    = testService;
     this.cancelTokenSrc = new CancellationTokenSource();
     this.testHub        = new TestHub();
 }