public DecayDaemon(DataSQLite db, Clients clients) { _db = db; _clients = clients; _decays = new List<DecayDefinition>(); _timer = new Timer(DoDecays, null, 0, 5000); }
public Startup(IHostingEnvironment env) { _db = new DataSQLite(); _server = new GameServer(_db); var builder = new ConfigurationBuilder(); Configuration = builder.Build(); }
public void CreateBody_WithInvalidTemplateString_ReturnsNull() { using (var db = new DataSQLite()) { var body = db.CreateBody("invalid template string"); Assert.Null(body); Assert.Empty(db.Bodies()); } }
public GameServer(DataSQLite db) { _db = db; Cmd.Db = db; _clients = new Clients(_db); Cmd.Clients = _clients; Do.Clients = _clients; _spawnDaemon = new SpawnDaemon(_db, _clients); _decayDaemon = new DecayDaemon(_db, _clients); _regenDaemon = new RegenDaemon(_db, _clients); _npcDaemon = new NpcDaemon(_db, _clients); }
public void CreateBody_WithEmptyTemplateString_ReturnsNull() { using (var db = new DataSQLite()) { { var body = db.CreateBody(null); Assert.Null(body); Assert.Empty(db.Bodies()); } { var body = db.CreateBody(""); Assert.Null(body); Assert.Empty(db.Bodies()); } { var body = db.CreateBody(" \t"); Assert.Null(body); Assert.Empty(db.Bodies()); } } }
public void AddRoleToEntity_Persists() { using (var db = new DataSQLite()) { string role = "testrole"; string itemId; { var item = db.CreateItem("item-chair"); itemId = item.Id; Assert.False(db.HasRole(itemId, role)); db.AddRoleToEntity(itemId, role); Assert.True(db.HasRole(itemId, role)); } { var item = db.Item(itemId); Assert.True(db.HasRole(itemId, role)); db.DeleteItem(itemId); Assert.False(db.HasRole(itemId, role)); Assert.Empty(db.Items()); } } }
public NpcDaemon(DataSQLite db, Clients clients) { _db = db; _clients = clients; _timer = new Timer(OnTick, null, 0, 5000); }
public RegenDaemon(DataSQLite db, Clients clients) { _db = db; _clients = clients; _timer = new Timer(DoRegens, null, 0, 5000); }
public void CreateItem_WithEmptyTemplateString_ReturnsNull() { using (var db = new DataSQLite()) { { var item = db.CreateItem(null); Assert.Null(item); Assert.Empty(db.Items()); } { var item = db.CreateItem(""); Assert.Null(item); Assert.Empty(db.Items()); } { var item = db.CreateItem(" \t"); Assert.Null(item); Assert.Empty(db.Items()); } } }
static Daemon() { _db = new DataSQLite(); _decays = new List<DecayDefinition>(); }
public void DeleteBody_DeletesBody() { using (var db = new DataSQLite()) { var monster = db.CreateBody("body-monster"); Assert.NotEmpty(db.Bodies()); db.DeleteBody(monster.Id); Assert.Empty(db.Bodies()); var guard = db.CreateBody("body-guard"); Assert.NotEmpty(db.Bodies()); db.DeleteBody(guard.Id); Assert.Empty(db.Bodies()); } }
public void DeleteItem_AlsoDeletesRoles() { using (var db = new DataSQLite()) { var item = db.CreateItem("item-chair"); var itemId = item.Id; Assert.True(db.HasRole(itemId, "seat")); db.DeleteItem(item.Id); Assert.False(db.HasRole(itemId, "seat")); Assert.Empty(db.RolesByEntity(itemId)); Assert.Empty(db.Items()); } }
public Clients(DataSQLite db) { _db = db; }
public HeartbeatDaemon(DataSQLite db, Clients clients) { _db = db; _clients = clients; _heartbeatTimer = new Timer(HeartbeatTimer_Elapsed, null, 0, 5000); }
public void DeleteItem_DeletesItem() { using (var db = new DataSQLite()) { var weapon = db.CreateItem("item-weapon"); Assert.NotEmpty(db.Items()); db.DeleteItem(weapon.Id); Assert.Empty(db.Items()); } }
public void GetScene_InvalidId_ReturnsNull() { using (var db = new DataSQLite()) { var scene = db.Scene("invalid ID"); Assert.Null(scene); } }
public void GetScene_EmptyId_ReturnsNull() { using (var db = new DataSQLite()) { { var scene = db.Scene(null); Assert.Null(scene); } { var scene = db.Scene(""); Assert.Null(scene); } { var scene = db.Scene(" "); Assert.Null(scene); } } }
public void GetAllItemSpawnsTest() { using (var db = new DataSQLite()) { var spawns = db.ItemSpawns(); Assert.NotEmpty(spawns); Assert.Contains(spawns, s => s.SceneId == "scene-1" && s.TemplateId == "item-chair" && s.MaxSpawns == 1); } }
public void GetAllBodySpawnsTest() { using (var db = new DataSQLite()) { var spawns = db.BodySpawns(); Assert.NotEmpty(spawns); Assert.Contains(spawns, s => s.SceneId == "scene-1" && s.TemplateId == "body-healer" && s.MaxSpawns == 1); } }
public Heartbeat(DataSQLite db) { _db = db; _heartbeatTimer = new Timer(HeartbeatTimer_Elapsed, null, 0, 5000); }
public void SetEntityName_InvalidEntity() { using (var db = new DataSQLite()) { db.SetName("invalid ID", "a name"); } }
public GameServer() { Daemon.StartDaemon(); _db = new DataSQLite(); }
public void CreateItem_WithInvalidTemplateString_ReturnsNull() { using (var db = new DataSQLite()) { var item = db.CreateItem("invalid template string"); Assert.Null(item); Assert.Empty(db.Items()); } }
public void SetGender_InvalidBody() { using (var db = new DataSQLite()) { db.SetGender("invalid ID", Gender.Female); } }
public void DeleteBody_AlsoDeletesRoles() { using (var db = new DataSQLite()) { var body = db.CreateBody("body-player"); var bodyId = body.Id; Assert.True(db.HasRole(bodyId, "player")); db.DeleteBody(body.Id); Assert.False(db.HasRole(bodyId, "player")); Assert.Empty(db.RolesByEntity(bodyId)); Assert.Empty(db.Bodies()); } }