public void GetUnitsTest() { _connection.Open(); // Arrange: var mock = new Mock <IDatabase>(); mock.SetupGet(x => x.Connection).Returns(_connection); var gateway = new CardsGateway(); var expected = new List <string>() { "Testowy RozdziaĆ", "Testowy RozdziaĆ 2" }; // Act: var result = gateway.GetUnits(1, mock.Object); // Assert: for (int i = 0; i < expected.Count; i++) { Assert.AreEqual(expected[i], result[i]); } _connection.Close(); }
public void LoadUser(object sender, LoginEventArgs e) { _user = e.User; _user.LoadCardsLocal(); FlierKey = _user.Cards[0][0]; var gateway = new CardsGateway(); var units = gateway.GetUnits(_user.ID, Database.Instance); foreach (var item in units) { UnitsBox.Add(item); } }