コード例 #1
0
        public async void GetByIdAsync_ValidId_Plant()
        {
            using (var ctx = new TestDataContext())
            {
                SeedPlants(ctx);
                var service = new PlantService(ctx);

                var plant = await service.GetByIdAsync(0);

                Assert.Null(plant);
            }
        }
コード例 #2
0
        public async void GetByIdAsync_InvalidId_Plant()
        {
            using (var ctx = new TestDataContext())
            {
                SeedPlants(ctx);
                var service = new PlantService(ctx);

                var plant = await service.GetByIdAsync(0);

                Assert.IsType <Plant>(plant);
                Assert.Equal(1, plant.PlantId);
            }
        }