public void GivenAValidViewModel_WhenEditRole_ThenJsonResultReturned_AndDataIsTrue() { JsonResult result = Target.EditRole(new UserRoleModel { UserId = 1 }) as JsonResult; result.AssertGetData(true); }
public void GivenValidViewModel_WhenCreate_ThenReturnJsonTrue() { ProgramModel viewModel = new ProgramModel(); JsonResult actual = Target.Create(viewModel) as JsonResult; actual.AssertGetData(true); }
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); }
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()); }
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>(); }
public void GivenCountFromLogicManager_WhenCountStudentsWithApprovedProviders_ThenJsonResultIsCountFromLogicManager() { int expected = 83498; MockLogicManager.Expect(m => m.CountStudentsWithApprovedProviders()).Return(expected); JsonResult result = Target.CountStudentsWithApprovedProviders(); result.AssertGetData(expected); }
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()); }
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); }
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); }
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); }
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); }
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); }
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()); }
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); }
public void GivenSelectedStudents_WhenIPostCreateServiceOfferingSchedule_ThenJsonResultYieldsTrue() { JsonResult result = Target.CreateScheduledOffering(new ServiceOfferingScheduleModel()) as JsonResult; result.AssertGetData(true); }
public void GivenValidViewModel_WhenPostAddProviders_ThenReturnJsonTrueResult() { JsonResult result = Target.AddProviders(new AddStudentApprovalModel()) as JsonResult; result.AssertGetData(true); }
public void WhenSetFavorite_ThenSuccessJsonReturned() { JsonResult result = Target.SetFavorite(2437582, false) as JsonResult; result.AssertGetData(true); }
public void GivenStudentIdValid_WhenSetOptOut_ThenReturnTrueJsonResultValue() { JsonResult result = Target.SetOptOut(2, false) as JsonResult; result.AssertGetData(true); }
public void WhenMultiToggleActivationIsCalled_ThenJsonResultReturned_AndDataIsTrue() { JsonResult result = Target.MultiToggleActivation(new int[] { 1 }, true) as JsonResult; result.AssertGetData(true); }