示例#1
0
        public async Task WHEN_entity_is_deleted_from_repository_THEN_entity_is_not_found()
        {
            // arrange

            _repository.Add(new Park
            {
                ParkId = 1001,
                Name   = "Park1",
                SizeInMetresSquared = 1000,
                Longitude           = 1.00m,
                Latitude            = -1.00m,
                OpeningTime         = DateTime.MinValue,
                ClosingTime         = DateTime.MaxValue,
                Supervisor          = new Supervisor()
            });
            _repository.SaveChangesAsync().Wait();

            var existing = await _repository.GetParkByIdAsync(1001);

            // act

            _repository.Delete(existing);

            var result = await _repository.SaveChangesAsync();

            var parks = await _repository.GetAllParksAsync();

            // assert

            Assert.True(result);
            Assert.DoesNotContain(existing, parks);
        }