示例#1
0
        public async Task DeletePart()
        {
            //Arrange
            var dbOptions = new DbContextOptionsBuilder <HyperCarsDbContext>()
                            .UseInMemoryDatabase("HyperCarsDb")
                            .Options;

            var db = new HyperCarsDbContext(dbOptions);

            var part = new Part
            {
                Id   = 3,
                Name = "Test3"
            };

            var partService = new PartService(db);

            var totalCars = db.Parts.CountAsync();

            await db.SaveChangesAsync();

            //Act
            var result = partService.DeletePart(3);

            //Assert
            result.Equals(true);
        }