public void GetUserAlgoritmsTest_ListReturned()
        {
            //arrange
            List <Algorithm> getList = new List <Algorithm>
            {
                new Algorithm {
                    Id = 2, Title = "test", Path = "path", Input = "input", Output = "output", UserId = 2
                },
                new Algorithm {
                    Id = 4, Title = "test", Path = "path", Input = "input", Output = "output", UserId = 2
                },
                new Algorithm {
                    Id = 6, Title = "test", Path = "path", Input = "input", Output = "output", UserId = 2
                }
            };

            List <int> expectedList = new List <int> {
                2, 4, 6
            };



            var mock = new Mock <AlgorithmRepository>();

            mock.Setup(a => a.GetAll()).Returns(getList);
            AlgorithmOperation algorithmOperation = new AlgorithmOperation(mock.Object);

            //act
            List <int> actualList = algorithmOperation.GetUserAlgoritms(2);

            //assert


            Assert.AreEqual(expectedList, actualList);
        }
Beispiel #2
0
 public LoginForm()
 {
     InitializeComponent();
     userOperation      = new UserOperation(new UserRepository());
     algorithmOperation = new AlgorithmOperation(new AlgorithmRepository());
     groupOperation     = new GroupOperation(new AccessGroupRepository());
 }
 public ChooseFileForm(int _userId, AlgorithmOperation _ao, GroupOperation _go)
 {
     InitializeComponent();
     algorithmOperation         = _ao;
     groupOperation             = _go;
     USERID                     = _userId;
     algList_listbox.DataSource = algorithmOperation.GetTitles(USERID);
 }
Beispiel #4
0
 public AllUsersForm(UserOperation _uo, AlgorithmOperation _ao, GroupOperation _go)
 {
     InitializeComponent();
     userOperation                = _uo;
     algorithmOperation           = _ao;
     groupOperation               = _go;
     usersList_listbox.DataSource = userOperation.GetUsernames();
 }
Beispiel #5
0
 private void ef_rb_CheckedChanged(object sender, EventArgs e)
 {
     if (ef_rb.Checked)
     {
         userOperation      = new UserOperation(new UserRepositoryEF());
         algorithmOperation = new AlgorithmOperation(new AlgorithmRepositoryEF());
         groupOperation     = new GroupOperation(new AccessGroupRepositoryEF());
     }
 }
        public AddUserAccessForm(int _userId, UserOperation _uo, AlgorithmOperation _ao, GroupOperation _go)
        {
            InitializeComponent();
            userId = _userId;

            userOperation      = _uo;
            algorithmOperation = _ao;
            groupOperation     = _go;

            algorithm_cb.DataSource = algorithmOperation.GetUserAlgorithmTitles(userId);
        }
        public OtherUsersAlgorithmsForm(int _userId, UserOperation _uo, AlgorithmOperation _ao, GroupOperation _go)
        {
            InitializeComponent();

            userId             = _userId;
            userOperation      = _uo;
            algorithmOperation = _ao;
            groupOperation     = _go;

            userList_cb.DataSource = userOperation.GetUsernames();
        }
Beispiel #8
0
        public MyProfileInfoForm(int _userId, UserOperation _uo, AlgorithmOperation _ao)
        {
            InitializeComponent();
            userOperation      = _uo;
            algorithmOperation = _ao;
            userId             = _userId;

            username_label.Text = $"Ім'я користувача: {userOperation.GetUsername(userId)}";

            string type = userOperation.UserAuthorization(userId) ? "Адміністратор" : "Користувач";

            role_label.Text = $"Тип профілю: {type}";

            algorithmsCount_label.Text = $"Кількість алгоритмів у сховищі: {algorithmOperation.GetUserAlgoritms(userId).Count().ToString()}";
        }
Beispiel #9
0
        public UserForm(int _userId, bool _admin, UserOperation _uo, AlgorithmOperation _ao, GroupOperation _go)
        {
            InitializeComponent();

            USERID = _userId;

            admin = _admin;

            списокКористувачівToolStripMenuItem.Visible = всіАлгоритмиToolStripMenuItem.Visible = admin;
            списокКористувачівToolStripMenuItem.Enabled = всіАлгоритмиToolStripMenuItem.Enabled = admin;

            userOperation     = _uo;
            algoritmOperation = _ao;
            groupOperation    = _go;
        }