public void process_manager_entity_has_primary_key() { var context = new FakeProcessManagerDbContext(_dbContextOptions); IEntityType sut = context.Model.FindEntityType(typeof(FakeProcessManager)); sut.FindPrimaryKey().Properties.Should().ContainSingle(p => p.Name == "SequenceId"); }
public void process_manager_entity_has_Id_property() { var context = new FakeProcessManagerDbContext(_dbContextOptions); IEntityType sut = context.Model.FindEntityType(typeof(FakeProcessManager)); IProperty actual = sut.FindProperty("Id"); actual.Should().NotBeNull(); }
public void process_manager_entity_has_index_for_Id() { var context = new FakeProcessManagerDbContext(_dbContextOptions); IEntityType sut = context.Model.FindEntityType(typeof(FakeProcessManager)); IProperty property = sut.FindProperty("Id"); property.GetContainingIndexes().Should().ContainSingle(index => index.IsUnique); }
static SqlProcessManagerDataContext_specs() { _dbContextOptions = new DbContextOptionsBuilder <ProcessManagerDbContext>() .UseSqlServer($@"Server=(localdb)\mssqllocaldb;Database={typeof(SqlProcessManagerDataContext_specs).FullName}.Core;Trusted_Connection=True;") .Options; using (var context = new FakeProcessManagerDbContext(_dbContextOptions)) { context.Database.Migrate(); context.Database.ExecuteSqlCommand("DELETE FROM FakeProcessManagers"); context.Database.ExecuteSqlCommand("DELETE FROM PendingCommands"); context.Database.ExecuteSqlCommand("DELETE FROM PendingScheduledCommands"); } }
public async Task FindProcessManager_returns_process_manager_that_satisfies_predicate() { // Arrange var processManagers = Enumerable .Repeat <Func <FakeProcessManager> >(() => new FakeProcessManager { AggregateId = Guid.NewGuid() }, 10) .Select(f => f.Invoke()) .ToList(); FakeProcessManager expected = processManagers.First(); using (var db = new FakeProcessManagerDbContext(_dbContextOptions)) { var random = new Random(); foreach (FakeProcessManager processManager in from p in processManagers orderby random.Next() select p) { db.FakeProcessManagers.Add(processManager); } await db.SaveChangesAsync(default);