コード例 #1
0
        public void GivenAValidViewModel_WhenEditRole_ThenJsonResultReturned_AndDataIsTrue()
        {
            JsonResult result = Target.EditRole(new UserRoleModel {
                UserId = 1
            }) as JsonResult;

            result.AssertGetData(true);
        }
コード例 #2
0
        public void GivenValidViewModel_WhenCreate_ThenReturnJsonTrue()
        {
            ProgramModel viewModel = new ProgramModel();

            JsonResult actual = Target.Create(viewModel) as JsonResult;

            actual.AssertGetData(true);
        }
コード例 #3
0
        public void GivenValidViewModel_WhenRemoveProviderPost_ThenLogicManagerRemovesProvider_AndJsonSuccessResultReturned()
        {
            RemoveApprovedProviderModel viewModel = new RemoveApprovedProviderModel();

            JsonResult result = Target.RemoveProvider(viewModel) as JsonResult;

            MockLogicManager.AssertWasCalled(m => m.RemoveProvider(viewModel));
            result.AssertGetData(true);
        }
コード例 #4
0
        public void GivenTermHasMatchingNames_WhenGettingAutocompleteList_ThenListContainsMatches()
        {
            JsonResult result = Target.AutocompleteServiceTypeProviderOrProgram("as");

            IEnumerable <string> actual = result.AssertGetData <IEnumerable <string> >();

            CollectionAssert.AreEquivalent(new List <string> {
                "After School Basketball", "Joe's World-class Tutoring Services and Eatery!"
            }, actual.ToList());
        }
コード例 #5
0
        public void WhenRequestDataTableAjaxHandler_ThenJsonResultContainsDataTableResultModel()
        {
            DataTableRequestModel requestModel = new DataTableRequestModel();

            MockAccountManager.Expect(m => m.GenerateDataTableResultViewModel(Arg.Is(requestModel), Arg <IClientDataTable <User> > .Is.NotNull)).Return(new DataTableResultModel());

            JsonResult result = Target.DataTableAjaxHandler(requestModel);

            result.AssertGetData <DataTableResultModel>();
        }
コード例 #6
0
        public void GivenCountFromLogicManager_WhenCountStudentsWithApprovedProviders_ThenJsonResultIsCountFromLogicManager()
        {
            int expected = 83498;

            MockLogicManager.Expect(m => m.CountStudentsWithApprovedProviders()).Return(expected);

            JsonResult result = Target.CountStudentsWithApprovedProviders();

            result.AssertGetData(expected);
        }
コード例 #7
0
        public void GivenTermHasMatchingProviderNames_WhenGettingAutocompleteList_ThenListContainsMatches()
        {
            JsonResult result = Target.AutocompletePartnerName("and");

            IEnumerable <string> actual = result.AssertGetData <IEnumerable <string> >();

            CollectionAssert.AreEquivalent(new List <string> {
                "Boys and Girls Club", "Joe's World-class Tutoring Services and Eatery!"
            }, actual.ToList());
        }
コード例 #8
0
        public void WhenRequestDataTableAjaxHandler_ThenGenerateListViewModelReceivesCorrectDataTableRequest_AndResultPassedToJson()
        {
            DataTableResultModel  expected     = new DataTableResultModel();
            DataTableRequestModel requestModel = new DataTableRequestModel();

            MockAccountManager.Expect(m => m.GenerateDataTableResultViewModel(Arg.Is(requestModel), Arg <IClientDataTable <User> > .Is.NotNull)).Return(expected);

            JsonResult result = Target.DataTableAjaxHandler(requestModel);

            result.AssertGetData(expected);
        }
コード例 #9
0
        public void WhenDataTableAjaxHandler_ThenJsonContainsGeneratedViewModel()
        {
            DataTableRequestModel model    = new DataTableRequestModel();
            DataTableResultModel  expected = new DataTableResultModel();

            MockLogicManager.Expect(m => m.GenerateDataTableResultViewModel(Arg.Is(model), Arg <IClientDataTable <ServiceOffering> > .Is.NotNull)).Return(expected);

            JsonResult result = Target.DataTableAjaxHandler(model);

            result.AssertGetData(expected);
        }
コード例 #10
0
        public void WhenAutocompleteLastNameIsCalled_ThenJsonResultHasData()
        {
            IEnumerable <string> expected = new string[] { "bob", "bob smith" };
            string expectedTerm           = "bob";

            MockAccountManager.Expect(m => m.SearchLastNames(expectedTerm)).Return(expected);

            JsonResult actual = Target.AutocompleteLastName(expectedTerm);

            actual.AssertGetData(expected);
        }
コード例 #11
0
        public void GivenLogicManagerGeneratesViewModel_WhenDataTableAjaxHandler_ThenJsonResultContainsViewModel()
        {
            var request  = new DataTableRequestModel();
            var expected = new DataTableResultModel();

            MockLogicManager.Expect(m => m.GenerateDataTableResultViewModel(Arg.Is(request), Arg <IClientDataTable <Program> > .Is.NotNull)).Return(expected);

            JsonResult result = Target.DataTableAjaxHandler(request);

            result.AssertGetData(expected);
        }
コード例 #12
0
        public void WhenGetDataTableAjaxHandler_ThenReturnGeneratedViewModel()
        {
            DataTableRequestModel model    = new DataTableRequestModel();
            DataTableResultModel  expected = new DataTableResultModel();

            MockLogicManager.Expect(m => m.GenerateApprovalDataTableResultViewModel(Arg.Is(model), Arg <IClientDataTable <Student> > .Is.NotNull)).Return(expected);

            JsonResult result = Target.DataTableAjaxHandler(model);

            result.AssertGetData(expected);
        }
コード例 #13
0
        public void GivenStudentsWithSchools_WhenGettingDataTableAjaxHandler_ThenDataTableStateContainsColumns()
        {
            MockHttpContext.Request.Expect(m => m["iSortCol_0"]).Return("0");
            MockHttpContext.Request.Expect(m => m["sSortDir_0"]).Return("asc");
            DataTableRequestModel request = new DataTableRequestModel {
                iDisplayLength = 10
            };

            JsonResult result = Target.DataTableAjaxHandler(request) as JsonResult;

            DataTableResultModel actual = result.AssertGetData <DataTableResultModel>();

            Assert.IsTrue(actual.aaData.Any());
        }
コード例 #14
0
        private void AssertDataTableAjaxHandler(bool expectedIsAdministrator)
        {
            var expected     = new DataTableResultModel();
            var requestModel = new DataTableRequestModel();

            MockLogicManager.Expect(m => m.GenerateDataTableResultViewModel(requestModel, null)).IgnoreArguments().Do(new Func <DataTableRequestModel, IClientDataTable <ServiceType>, DataTableResultModel>((p, r) =>
            {
                ServiceTypeClientDataTable castR = r as ServiceTypeClientDataTable;
                Assert.IsNotNull(castR);
                Assert.AreEqual(expectedIsAdministrator, castR.IsAdministrator);
                return(expected);
            }));

            JsonResult result = Target.DataTableAjaxHandler(requestModel);

            result.AssertGetData(expected);
        }
コード例 #15
0
        public void GivenSelectedStudents_WhenIPostCreateServiceOfferingSchedule_ThenJsonResultYieldsTrue()
        {
            JsonResult result = Target.CreateScheduledOffering(new ServiceOfferingScheduleModel()) as JsonResult;

            result.AssertGetData(true);
        }
コード例 #16
0
        public void GivenValidViewModel_WhenPostAddProviders_ThenReturnJsonTrueResult()
        {
            JsonResult result = Target.AddProviders(new AddStudentApprovalModel()) as JsonResult;

            result.AssertGetData(true);
        }
コード例 #17
0
        public void WhenSetFavorite_ThenSuccessJsonReturned()
        {
            JsonResult result = Target.SetFavorite(2437582, false) as JsonResult;

            result.AssertGetData(true);
        }
コード例 #18
0
        public void GivenStudentIdValid_WhenSetOptOut_ThenReturnTrueJsonResultValue()
        {
            JsonResult result = Target.SetOptOut(2, false) as JsonResult;

            result.AssertGetData(true);
        }
コード例 #19
0
        public void WhenMultiToggleActivationIsCalled_ThenJsonResultReturned_AndDataIsTrue()
        {
            JsonResult result = Target.MultiToggleActivation(new int[] { 1 }, true) as JsonResult;

            result.AssertGetData(true);
        }