public async Task SelectSessions_SessionExistss_ReturnsAll() { // Arrange var cxn = new SqlConnectionWrapperMock(); var repository = new SqlSessionsRepository(cxn.Object); int ps = 100; int pn = 1; Session[] result = { new Session { SessionId = new Guid("12345678901234567890123456789012") }, new Session { SessionId = new Guid("11111111111111111111111111111111") } }; cxn.SetupQueryAsync("[AdminStore].SelectSessions", new Dictionary <string, object> { { "ps", ps }, { "pn", pn } }, result); // Act IEnumerable <Session> sessions = await repository.SelectSessions(ps, pn); // Assert cxn.Verify(); CollectionAssert.AreEquivalent(result, sessions.ToList()); }
public async Task SelectSessions_SessionDoesNotExist_ReturnsEmpty() { // Arrange var cxn = new SqlConnectionWrapperMock(); var repository = new SqlSessionsRepository(cxn.Object); int ps = 100; int pn = 1; Session[] result = { }; cxn.SetupQueryAsync("[AdminStore].SelectSessions", new Dictionary <string, object> { { "ps", ps }, { "pn", pn } }, result); // Act IEnumerable <Session> sessions = await repository.SelectSessions(ps, pn); // Assert cxn.Verify(); Assert.IsFalse(sessions.Any()); }