コード例 #1
0
        public async Task ViewModel_MonstersViewModel_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 MonstersViewModel();

            myViewModel.ForceDataRefresh();

            var myData = DefaultModels.MonsterDefault();

            // 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);
        }
コード例 #2
0
        public async Task ViewModel_MonstersViewModel_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 MonstersViewModel();
            var myData      = DefaultModels.MonsterDefault();
            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);
        }
コード例 #3
0
        public async Task ViewModel_MessageCenter_MonstersViewModel_MessageCenter_DeleteData_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 MonstersViewModel();
            var myData      = DefaultModels.MonsterDefault();
            await myViewModel.AddAsync(myData);

            var myPage = new DeleteMonsterPage(new MonsterDetailViewModel(new Monster()));

            MessagingCenter.Send(myPage, "DeleteData", myData);

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

            Object Expected = null;

            // Return state
            MasterDataStore.ToggleDataStore(myDataStoreEnum);

            // Validate the controller can stand up and has a Title
            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
コード例 #4
0
        public void ViewModel_MonstersViewModel_LoadDataCommand_With_IsBusy_Should_Skip()
        {
            MockForms.Init();

            var myData   = new MonstersViewModel();
            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);
        }
コード例 #5
0
        public void ViewModel_MonstersViewModel_Instantiate_Should_Pass()
        {
            MockForms.Init();

            var Actual = new MonstersViewModel();

            // Validate the controller can stand up and has a Title
            Assert.AreEqual("Monster List", Actual.Title, TestContext.CurrentContext.Test.Name);
        }
コード例 #6
0
        public App()
        {
            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);

            Version = fvi.FileVersion;

            RNG               = new Random();
            RiderViewModel    = new RidersViewModel();
            SpellsViewModel   = new SpellsViewModel();
            MonstersViewModel = new MonstersViewModel();
        }
コード例 #7
0
        public void ViewModel_MonstersViewModel_DataSet_Should_Be_Valid()
        {
            MockForms.Init();

            var myData = new MonstersViewModel();
            var myLoad = myData.LoadDataCommand;

            var Actual   = myData.Dataset;
            var Expected = myData.Dataset;

            // Validate the controller can stand up and has a Title
            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
コード例 #8
0
        public void ViewModel_MonstersViewModel_LoadDataCommand_Should_Pass()
        {
            MockForms.Init();

            var myData = new MonstersViewModel();

            myData.ForceDataRefresh();

            var Actual   = myData.Dataset.Count();
            var Expected = myData.DataStore.GetAllAsync_Monster().GetAwaiter().GetResult().Count();

            // Validate the controller can stand up and has a Title
            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
コード例 #9
0
        public void ViewModel_MonstersViewModel_SetNeedsRefresh_True_Should_Be_True()
        {
            MockForms.Init();

            var myData = new MonstersViewModel();

            myData.SetNeedsRefresh(true);

            var Actual   = myData.NeedsRefresh();
            var Expected = true;

            // Validate the controller can stand up and has a Title
            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
コード例 #10
0
        public void ViewModel_MonstersViewModel_LoadCommand_With_Bogus_DataSource_Should_Throw_Skip()
        {
            MockForms.Init();

            var myData   = new MonstersViewModel();
            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;

            // Validate the controller can stand up and has a Title
            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
コード例 #11
0
        // Constructor loads all the characters for display
        public PickCharacter()
        {
            InitializeComponent();
            partyList             = new List <Character>();
            PartyList.ItemsSource = partyList;
            BindingContext        = _viewModel = CharactersViewModel.Instance;

            // Grabs a copy of the monsters
            _monsterViewModel = MonstersViewModel.Instance;
            if (_monsterViewModel.Dataset.Count == 0)
            {
                _monsterViewModel.LoadDataCommand.Execute(null);
            }
            else if (_monsterViewModel.NeedsRefresh())
            {
                _monsterViewModel.LoadDataCommand.Execute(null);
            }
        }
コード例 #12
0
        //Constructor
        public BattlePage(CharactersViewModel Data)
        {
            charactersViewModel = Data;
            InitializeComponent();
            monsterViewModel = MonstersViewModel.Instance;

            // _viewModel = GameEngineViewModel.Instance;
            _viewModel          = new GameEngineViewModel();
            _viewModel.gameOver = false;
            _viewModel.gameEngine.ClearDialogCache();

            _viewModel.magicRevive             = true;
            _viewModel.BattleScore.AutoBattle  = false;
            _viewModel.gameEngine.currentRound = 1;
            _viewModel.GenerateNewMonsters();
            _viewModel.MoveFirstCreature(charactersViewModel);
            _viewModel.gameEngine.ConsoleDialog1 = "";
            BindingContext = _viewModel;
        }
コード例 #13
0
        public MonstersPage()
        {
            InitializeComponent();

            BindingContext = viewModel = new MonstersViewModel();
        }
コード例 #14
0
 public MonstersPage()
 {
     InitializeComponent();
     //BindingContext = _viewModel = MonstersViewModel.Instance;
     BindingContext = _viewModel = new MonstersViewModel();
 }
コード例 #15
0
 public MonstersPage()
 {
     InitializeComponent();
     BindingContext = _instancem = MonstersViewModel.Instance;
 }
コード例 #16
0
 public MonsterPartyPage()
 {
     InitializeComponent();
     BindingContext = _viewModel = MonstersViewModel.Instance;
 }
コード例 #17
0
 public MonsterPage()
 {
     InitializeComponent();
     // Set the data binding for the page
     BindingContext = _viewModel = MonstersViewModel.Instance;
 }