Esempio n. 1
0
        public async Task Should_Create_New_Person_Async()
        {
            var johnNash = new CreatePersonDto
            {
                FirstName    = "John",
                LastName     = "Nash",
                Gender       = Gender.Male,
                BirthDate    = new DateTime(1980, 2, 28),
                BirthPlace   = "USA",
                OtherDetails = "Nothing"
            };

            await _personAppService.CreateAsync(johnNash);

            await UsingDbContextAsync(async context =>
            {
                var foundJohnNash = await context.People.FirstOrDefaultAsync
                                    (
                    p => p.FirstName == johnNash.FirstName &&
                    p.LastName == johnNash.LastName &&
                    p.Gender == johnNash.Gender &&
                    p.BirthDate == johnNash.BirthDate
                                    );

                foundJohnNash.ShouldNotBeNull();
            });
        }