Ejemplo n.º 1
0
        /// <summary>
        /// Assert result.
        /// </summary>
        /// <param name="batchResult">Result.</param>
        /// <typeparam name="T">T.</typeparam>
        /// <returns>Method assert result.</returns>
        public static IEnumerable <T> AssertResult <T>(this ApiBatchResult <T> batchResult)
        {
            Assert.IsInstanceOf <ApiBatchResult <T> >(batchResult);
            Assert.AreEqual(batchResult.Status, BatchResultType.Success);

            Assert.Multiple(() =>
            {
                foreach (var result in batchResult.Results)
                {
                    result.AssertResult();
                }
            });

            return(batchResult.Results.Select(x => x.Data));
        }
Ejemplo n.º 2
0
        private static string GetMessages(ApiBatchResult apiBatchResult)
        {
            var messages = apiBatchResult.GetBaseResults().Select(r => r.Message);

            return(string.Join("\r\n", messages));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IdokladSdkException" /> class.
 /// </summary>
 /// <param name="apiBatchResult">API batch result.</param>
 public IdokladSdkException(ApiBatchResult apiBatchResult)
     : base(GetMessages(apiBatchResult))
 {
     ApiBatchResult = apiBatchResult ?? throw new ArgumentNullException(nameof(apiBatchResult));
 }