public async Task ChangePrefix_ShouldChangePrefix() { AdminChannelRepository repo = new AdminChannelRepository(GetMysql()); var ac = await repo.Insert(DefaultTestData.DefaultServer, 11u, "!"); await repo.ChangePrefix(ac, "$"); ac = await repo.GetAdminChannelsForChannel(ac.ChannelId); Assert.Equal("$", ac.Prefix); }
public async Task AfterInsertingServer_WeShouldBeAbleToQueryAdminChannelsForGivenServer() { AdminChannelRepository repo = new AdminChannelRepository(GetMysql()); await repo.Insert(DefaultTestData.DefaultServer, 11u, "!"); await repo.Insert(DefaultTestData.DefaultServer, 25u, "!"); await repo.Insert(DefaultTestData.DefaultServer, 33u, "!"); await repo.Insert(DefaultTestData.OtherServers.GetRandom(), 33u, "!"); ulong[] expectedChannels = new ulong[] { 11, 25, 33 }; var channels = await repo.GetAdminChannels(DefaultTestData.DefaultServer); foreach(var e in expectedChannels) { Assert.NotNull(channels.Single(x => x.ChannelId == e && x.Server.Id == DefaultTestData.DefaultServer.Id)); } }
public async Task AfterInsertingServer_WeShouldBeAbleToQueryAdminChannelsForGivenGuild() { AdminChannelRepository repo = new AdminChannelRepository(GetMysql()); await repo.Insert(DefaultTestData.DefaultServer, 11u, "!"); await repo.Insert(DefaultTestData.DefaultServer, 25u, "!"); await repo.Insert(DefaultTestData.DefaultServer, 33u, "!"); await repo.Insert(DefaultTestData.OtherServers.GetRandom(), 33u, "!"); foreach(var s in DefaultTestData.SameGuildServers) { await repo.Insert(s, 11u, "!"); } var channels = await repo.GetAdminChannels(DefaultTestData.SameGuildServers[0].GuildId); foreach(var c in channels) { Assert.Equal(11u, c.ChannelId); Assert.Equal(DefaultTestData.SameGuildServers[0].GuildId, c.Server.GuildId); Assert.Single(channels, (AdminChannel ac) => ac.Server.Id == c.Server.Id); } }