public void ViewModel_ScoresViewModel_LoadDataCommand_With_IsBusy_Should_Skip() { MockForms.Init(); var myData = new ScoresViewModel(); var myIsBusy = myData.IsBusy; myData.ForceDataRefresh(); myData.Dataset.Clear(); myData.IsBusy = true; var canExecute = myData.LoadDataCommand.CanExecute(null); myData.LoadDataCommand.Execute(null); var Actual = myData.Dataset.Count(); var Expected = 0; // set it back... myData.IsBusy = myIsBusy; //Reset myData.ForceDataRefresh(); // Validate the controller can stand up and has a Title Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
public async Task ViewModel_ScoresViewModel_UpdateData_Bogus_Should_Skip() { MockForms.Init(); // Get State of the DataStore, and set to run on the Mock var myDataStoreEnum = MasterDataStore.GetDataStoreMockFlag(); MasterDataStore.ToggleDataStore(DataStoreEnum.Mock); var myViewModel = new ScoresViewModel(); myViewModel.ForceDataRefresh(); var myData = DefaultModels.ScoreDefault(); // Make the ID bogus... var value = "new"; myData.Id = value; var myReturn = await myViewModel.UpdateAsync(myData); var Actual = myReturn; bool Expected = false; // Return state MasterDataStore.ToggleDataStore(myDataStoreEnum); myViewModel.ForceDataRefresh(); // Validate the controller can stand up and has a Title Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
public void ViewModel_ScoresViewModel_LoadDataCommand_Should_Pass() { MockForms.Init(); var myData = new ScoresViewModel(); myData.ForceDataRefresh(); var Actual = myData.Dataset.Count(); var Expected = myData.DataStore.GetAllAsync_Score().GetAwaiter().GetResult().Count(); //Reset myData.ForceDataRefresh(); // Validate the controller can stand up and has a Title Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
public void ViewModel_ScoresViewModel_LoadCommand_With_Bogus_DataSource_Should_Throw_Skip() { MockForms.Init(); var myData = new ScoresViewModel(); var myIsBusy = myData.IsBusy; // Make the data store null, this will fire the Exception, which then skips... myData.DataStore = null; var Actual = myData.Dataset.Count(); var Expected = 0; //Reset myData.ForceDataRefresh(); // Validate the controller can stand up and has a Title Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }