Beispiel #1
0
        public void TestPostList()
        {
            //prepare data
            var all = repository.ReadListDataIdName();

            repository.Delete(all.Select(d => d.Id).ToList());
            var entity = testEntity;

            repository.Add(testEntity);


            // read data
            var list   = new List <Core.Entities.BalanceDate>();
            var target = new ActionBlock <Core.Entities.BalanceDate>(a =>
            {
                list.Add(a);
            }, new ExecutionDataflowBlockOptions()
            {
                MaxDegreeOfParallelism = 1
            });

            repository.PostList(target).Wait();
            target.Completion.Wait();;

            //await repository.PostList(target).ConfigureAwait(false);
            //await target.Completion.ConfigureAwait(false);

            //test data
            Assert.IsNotNull(list);
            Assert.IsTrue(list.Count > 0);
            Assert.IsNotNull(list[0].DateOfBalance);
            Assert.IsNotNull(list[0].BalanceDateBankAccounts);
            Assert.IsTrue(list[0].BalanceDateBankAccounts.Count > 0);
            Assert.IsNotNull(list[0].BalanceDateBankAccounts[0].BankAccount);
            Assert.IsNotNull(list[0].BalanceDateBankAccounts[0].BankAccount.Bank);
        }