public void Insert() { using (var dbContext = this.GlobalServiceProvider.GetRequiredService <SqliteDbContext>()) { var testsInfo = new DbContextTestInfo { Name = Guid.NewGuid().ToString(), Type = InfoType.Black, CreateTime = DateTime.Now }; dbContext.Insert(testsInfo); Assert.True(testsInfo.Id > 0); } }
public void Select() { using (var dbContext = this.GlobalServiceProvider.GetRequiredService <SqliteDbContext>()) { var testsInfo = new DbContextTestInfo { Name = Guid.NewGuid().ToString(), Type = InfoType.Black, CreateTime = DateTime.Now }; dbContext.Insert(testsInfo); var selectInfo = dbContext.SelectById(testsInfo.Id); Assert.NotNull(selectInfo); Assert.Equal(selectInfo.Name, testsInfo.Name); } }
public void Insert(DbContextTestInfo info) { var id = this.ExecuteScalar <int>(nameof(Insert), info); info.Id = id; }