public void GivenISortByCreatingUser_WhenSortSelector_ThenSortsByCreatingUser()
        {
            PrepareDataTableRequestParameters("0", "asc");
            MockRequest.Expect(m => m["id"]).Return("1");
            Target = new AuditLoginClientDataTable(MockRequest);
            string expected = TestData.UserAccessChangeEvents[0].CreatingUser.DisplayName;

            var actual = Target.SortSelector.Compile().Invoke(TestData.LoginEvents[0]);

            Assert.AreEqual(expected, actual);
        }
        public void GivenISortByCreatedTime_WhenSortSelector_ThenSortsByCreatedTime()
        {
            PrepareDataTableRequestParameters("1", "asc");
            MockRequest.Expect(m => m["id"]).Return("1");
            Target = new AuditLoginClientDataTable(MockRequest);
            string expected = ((int)TimeSpan.FromTicks(TestData.LoginEvents[0].CreateTime.Ticks).TotalMinutes).ToString();

            var actual = Target.SortSelector.Compile().Invoke(TestData.LoginEvents[0]);

            Assert.AreEqual(expected, actual);
        }
        public void GivenIdRequestParameter_AndUserDoesntMatchId_WhenInvokeFilterPredicate_ThenReturnFalse()
        {
            LoginEvent item = new LoginEvent {
                CreatingUserId = 1
            };

            MockRequest.Expect(m => m["id"]).Return("2");
            Target = new AuditLoginClientDataTable(MockRequest);

            Assert.IsFalse(Target.FilterPredicate.Compile().Invoke(item));
        }
        public void GivenEntity_WhenInvokeDataSelector_ThenPropertiesMatch()
        {
            LoginEvent expectedState = TestData.LoginEvents[0];

            MockRequest.Expect(m => m["id"]).Return("1");
            Target = new AuditLoginClientDataTable(MockRequest);

            dynamic actual = Target.DataSelector.Compile().Invoke(expectedState);

            Assert.AreEqual(expectedState.CreateTime, actual.CreateTime);
            Assert.AreEqual(expectedState.CreatingUser.DisplayName, actual.CreatingUser);
            Assert.AreEqual(expectedState.Id, actual.Id);
        }