コード例 #1
0
        public async void ItShouldCreateALocation()
        {
            //Given
            EFCoreLocationRepository locationRepo = new EFCoreLocationRepository(ctx);
            Location newLocation = new Location
            {
                Name = "location"
            };
            //When
            await locationRepo.Add(newLocation);

            //Then
            Location actualLocation = (await locationRepo.GetAll()).ElementAt(0);

            Assert.Equal("location", actualLocation.Name);
        }
コード例 #2
0
        public async void ItShouldRemoveALocation()
        {
            //Given
            EFCoreLocationRepository locationRepo = new EFCoreLocationRepository(ctx);
            Location newLocation = new Location
            {
                Name = "location"
            };

            //When
            await locationRepo.Add(newLocation);

            Location tempLocation = (await locationRepo.GetAll()).ElementAt(0);
            await locationRepo.Delete(tempLocation.ID);

            //Then
            Assert.Equal(0, (await locationRepo.GetAll()).Count());
        }