Exemple #1
0
        public async Task ViewModel_CharactersViewModel_UpdateData_Should_Pass()
        {
            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();
            var myData      = DefaultModels.CharacterDefault();
            await myViewModel.AddAsync(myData);

            var value = "new";

            myData.Name = value;
            var myReturn = myViewModel.UpdateAsync(myData);

            var Actual = await myViewModel.GetAsync(myData.Id);

            string Expected = value;

            // Return state
            MasterDataStore.ToggleDataStore(myDataStoreEnum);

            // Validate the controller can stand up and has a Title
            Assert.AreEqual(Expected, Actual.Name, TestContext.CurrentContext.Test.Name);
        }
Exemple #2
0
        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);
        }