Пример #1
0
        public async Task Should_Insert_New_Person()
        {
            ContactList contactList = null;
            int         peopleCount = 0;

            await UsingDbContext(
                async context =>
            {
                contactList = await context.ContactLists.FirstOrDefaultAsync();
                peopleCount = await context.People.CountAsync();
            });

            await _personAppService.CreatePersonAsync(
                new CreatePersonInput
            {
                ContactListId = contactList.Id,
                Name          = "john"
            });

            await UsingDbContext(async context =>
            {
                (await context.People.FirstOrDefaultAsync(p => p.Name == "john")).ShouldNotBe(null);
                (await context.People.CountAsync()).ShouldBe(peopleCount + 1);
            });
        }
        public async Task Should_Insert_New_Person()
        {
            await _personAppService.CreatePersonAsync(new CreatePersonInput { Name = "john" });

            await UsingDbContext(async context =>
            {
                (await context.People.CountAsync()).ShouldBe(_initialPeople.Count + 1);
                (await context.People.FirstOrDefaultAsync(p => p.Name == "john")).ShouldNotBe(null);
            });
        }