コード例 #1
0
        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();
        }
コード例 #2
0
        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);
            }
        }