public SomeResult DoSomething <T>(T numericValue)
    {
        Type valueType = typeof(T);

        if (!_map.Contains(valueType))
        {
            throw new NotSupportedException(
                      string.Format(
                          "Does not support Type [{0}].", valueType.Name));
        }
        SomeResult result = _map[valueType] (numericValue);

        return(result);
    }
Esempio n. 2
0
        public void SetUp()
        {
            result = new SomeResult();

            context = new ActionExecutedContext
            {
                Controller = new SomeController {
                    ViewData = new ViewDataDictionary()
                },
                Result = result
            };

            requestInfo = new Mock <IRequestInfoFinder>().Object;
        }
Esempio n. 3
0
        public async Task <IActionResult> Index()
        {
            Console.Write(JsonConvert.SerializeObject(new
            {
                Method = $"{GetType().Name}.Index",
                Thread.CurrentThread.ManagedThreadId,
            }, Formatting.Indented));

            //send a message based on your incoming arguments to one of the actors you created earlier
            //and await the result by sending the message to `Ask`
            SomeRequest someRequest = new SomeRequest(DateTime.Now, Guid.NewGuid().ToString());
            SomeMessage someMessage = new SomeMessage(someRequest.Date, someRequest.Guid);
            SomeResult  result      = await Program.MyActor.Ask <SomeResult>(someMessage);

            return(View(result));
        }
Esempio n. 4
0
 protected override void OnReceive(object message)
 {
     Console.Write(JsonConvert.SerializeObject(new
     {
         Method = $"{GetType().Name}.OnReceive",
         Thread.CurrentThread.ManagedThreadId,
         message
     }, Formatting.Indented));
     switch (message)
     {
     case SomeMessage someMessage:
         Console.Write(JsonConvert.SerializeObject(new
         {
             Method  = $"{GetType().Name}.OnReceive",
             Message = $"Message Arrived",
             Thread.CurrentThread.ManagedThreadId,
             someMessage
         }, Formatting.Indented));
         SomeResult result = new SomeResult(DateTime.Now);
         Sender.Tell(result);
         break;
     }
 }
 public ActionResult ExportCompleted(SomeResult result)
 {
     return(Json(result, JsonRequestBehavior.AllowGet));
 }