示例#1
0
        public async Task <IActionResult> Index(int currentPage = 1, int itemsOnPage = 20)
        {
            var model = await logic.GetAllDataModelAsync();

            // form pagenation model
            var pagenationModel = new Pagenation <UserData>(model, itemsOnPage, currentPage);

            return(View(pagenationModel));
        }
示例#2
0
        public async void GetUserDataList_FromInitializedDbTables_LogicUserDataListEqualExpectedUserDataList()
        {
            // arrange
            var usersData = GetUsersData();

            fixture.dbAuth.UserData.AddRange(usersData);
            await fixture.dbAuth.SaveChangesAsync();


            var expected = new UserData[]
            {
                new UserData
                {
                    Login    = "******",
                    RoleName = "admin"
                },
                new UserData
                {
                    Login    = "******",
                    RoleName = "technologist"
                },
                new UserData
                {
                    Login    = "******",
                    RoleName = "seniorTechnologist"
                },
            };

            // act
            var actual = (await logic.GetAllDataModelAsync()).ToList();

            // assert
            foreach (var expectedItem in expected)
            {
                Assert.Contains(actual, actualItem =>
                                expectedItem.Login == actualItem.Login &&
                                expectedItem.RoleName == actualItem.RoleName);
            }
        }