Ejemplo n.º 1
0
        public static void Delete <T>(T obj) where T : SObject
        {
            var objectName = typeof(T).Name;

            Log.ForContext <SoqlApi>().Information("Deleting {$objectName} {$ID}", objectName, obj.Id);

            HttpManager httpManager = new HttpManager();

            httpManager.Del($"sobjects/{objectName}/{obj.Id}");
            UnitTestDataManager.RemoveId(obj.Id.ToString());
        }
Ejemplo n.º 2
0
        public static void Delete <T>(IEnumerable <T> objects) where T : SObject
        {
            var objectName  = typeof(T).Name;
            var httpManager = new HttpManager();
            var logger      = Log.ForContext <SoqlApi>();

            foreach (var obj in objects)
            {
                logger.Information("Deleting {$objectName} {$ID}", objectName, obj.Id);
                httpManager.Del($"sobjects/{objectName}/{obj.Id}");
                UnitTestDataManager.RemoveId(obj.Id.ToString());
            }
        }
Ejemplo n.º 3
0
        public static T Insert <T>(T obj) where T : SObject
        {
            var jsonData = JsonFactory.GetJson(obj);

            var         objectName  = typeof(T).Name;
            HttpManager httpManager = new HttpManager();

            jsonData = httpManager.Post($"sobjects/{objectName}/", jsonData);
            RecordCreateResponse recordCreateResponse = JsonConvert.DeserializeObject <RecordCreateResponse>(jsonData);

            obj.Id = recordCreateResponse.id;

            UnitTestDataManager.AddId(obj.Id.ToString());

            return(obj);
        }