Exemplo n.º 1
0
        public void Are_Equal_To_Each_Other()
        {
            var a = new NoContent();
            var b = new NoContent();

            a.Equals(b).Should().BeTrue();
            a.Equals((object)b).Should().BeTrue();
            (a == b).Should().BeTrue();
            (!(a != b)).Should().BeTrue();
        }
Exemplo n.º 2
0
        public async Task <object> GetConfirmAsync <T>(T param) where T : struct
        {
            try
            {
                string address;

                switch (param)
                {
                case Tick tick:
                    address = System.IO.Path.Combine(tick.Code, tick.Date, tick.Open, tick.Close);
                    break;

                case GroupDetail detail:
                    address = detail.Code;
                    break;

                case Catalog.Dart.Theme:
                    address = string.Empty;
                    break;

                default:
                    return(null);
                }
                var response = await client.ExecuteAsync(new RestRequest(Security.RequestTheIntegratedAddress(address, param), Method.GET), source.Token);

                switch (param)
                {
                case GroupDetail:
                    return(HttpStatusCode.OK.Equals(response.StatusCode) ? JsonConvert.DeserializeObject <string>(response.Content) : string.Empty);

                case Tick when HttpStatusCode.NoContent.Equals(response.StatusCode):
                    return(param);

                case Catalog.Dart.Theme when HttpStatusCode.OK.Equals(response.StatusCode):
                    return(JsonConvert.DeserializeObject <List <Catalog.Models.Theme> >(response.Content));
                }
            }
            catch (Exception ex)
            {
                Base.SendMessage(GetType(), ex.StackTrace);
            }
            return(null);
        }