Example #1
0
        public async Task Should_load_accounts_list()
        {
            var firstInn = LegalEntityInn.Parse("1754462785");
            var firstKpp = Kpp.Parse("515744582");

            var secondInn = LegalEntityInn.Parse("5616395700");
            var secondKpp = Kpp.Parse("515744444");

            var orgName = "org";


            await using var accountScope1 = await Context.Accounts.CreateAccount(firstInn, firstKpp, orgName).ConfigureAwait(false);

            await using var accountScope2 = await Context.Accounts.CreateAccount(Inn.Parse("678050110389"), orgName).ConfigureAwait(false);

            await using var accountScope3 = await Context.Accounts.CreateAccount(secondInn, secondKpp, orgName).ConfigureAwait(false);

            await Task.Delay(1.Seconds());


            var accountsAfterCreate = await Context.Accounts.LoadAllAccountsAsync();

            accountsAfterCreate.Count.Should().Be(3);
            accountsAfterCreate.Should().ContainEquivalentOf(accountScope1.Entity);
            accountsAfterCreate.Should().ContainEquivalentOf(accountScope2.Entity);
            accountsAfterCreate.Should().ContainEquivalentOf(accountScope3.Entity);
        }
Example #2
0
        public async Task Should_create_a_new_legal_entity_account_and_read_it()
        {
            await using var accountScope = await Context.Accounts.CreateAccount(LegalEntityInn.Parse("1754462785"), Kpp.Parse("515744582"), "org");

            var account = accountScope.Entity;
            await Task.Delay(1.Seconds());

            var loadedAccount = await Context.Accounts.GetAccount(account.Id);

            loadedAccount.Should().BeEquivalentTo(account);
        }
Example #3
0
        public async Task Should_not_create_the_same_org()
        {
            var inn     = LegalEntityInn.Parse("1754462785");
            var kpp     = Kpp.Parse("515744582");
            var orgName = "org";

            await using var accountScope1 = await Context.Accounts.CreateAccount(inn, kpp, orgName);

            await using var accountScope2 = await Context.Accounts.CreateAccount(inn, kpp, orgName);

            var accountsAfterCreate = await Context.Accounts.LoadAllAccountsAsync();

            accountsAfterCreate.Count.Should().Be(1);
            accountsAfterCreate.Should().ContainEquivalentOf(accountScope1.Entity);
        }
Example #4
0
        public async Task Should_unable_to_read_deleted_account()
        {
            var accountScope = await Context.Accounts.CreateAccount(LegalEntityInn.Parse("1754462785"), Kpp.Parse("515744582"), "org");

            var account = accountScope.Entity;

            await using (accountScope)
            {
                await Task.Delay(1.Seconds());

                var accountAfterCreate = await Context.Accounts.GetAccount(account.Id);

                accountAfterCreate.Should().BeEquivalentTo(account);
            }

            var loadedAccount = await Context.Accounts.GetAccountOrNull(account.Id);

            loadedAccount.Should().BeNull();
        }
Example #5
0
        public async Task Should_not_list_deleted_account()
        {
            var accountScope = await Context.Accounts.CreateAccount(LegalEntityInn.Parse("1754462785"), Kpp.Parse("515744582"), "org");

            var account = accountScope.Entity;

            await using (accountScope)
            {
                await Task.Delay(1.Seconds());

                var accountsAfterCreate = await Context.Accounts.LoadAllAccountsAsync();

                accountsAfterCreate.Should().ContainEquivalentOf(account);
            }

            var accountsAfterDelete = await Context.Accounts.LoadAllAccountsAsync();

            accountsAfterDelete.Select(x => x.Id).Should().NotContain(account.Id);
        }