public void ViewModel_CharactersViewModel_LoadDataCommand_With_IsBusy_Should_Skip() { MockForms.Init(); var myData = new CharactersViewModel(); 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; myData.ForceDataRefresh(); // Validate the controller can stand up and has a Title Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
public async Task ViewModel_CharactersViewModel_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 CharactersViewModel(); myViewModel.ForceDataRefresh(); var myData = DefaultModels.CharacterDefault(); // 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); // Validate the controller can stand up and has a Title Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
public void ViewModel_CharactersViewModel_LoadDataCommand_Should_Pass() { MockForms.Init(); var myData = new CharactersViewModel(); myData.ForceDataRefresh(); var Actual = myData.Dataset.Count(); var Expected = myData.DataStore.GetAllAsync_Character().GetAwaiter().GetResult().Count(); // Validate the controller can stand up and has a Title Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
public void ViewModel_CharactersViewModel_LoadCommand_With_Bogus_DataSource_Should_Throw_Skip() { MockForms.Init(); var myData = new CharactersViewModel(); var myIsBusy = myData.IsBusy; // Make the data store null, this will fire the Exception, which then skips... myData.DataStore = null; myData.ForceDataRefresh(); var Actual = myData.Dataset.Count(); var Expected = 0; // Validate the controller can stand up and has a Title Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }