Пример #1
0
        public async Task BasePlayerModel_GetDamageTotalString_Default_Speed_Should_Pass()
        {
            // Arrange
            // Add each model here to warm up and load it.
            DataSetsHelper.WarmUp();

            await ItemIndexViewModel.Instance.CreateAsync(new ItemModel { Attribute = AttributeEnum.Attack, Value = 300, Id = "PrimaryHand", Damage = 1 });

            var data = new BasePlayerModel <CharacterModel>();

            data.Level = 1;

            // Add the first item
            data.AddItem(ItemLocationEnum.PrimaryHand, (await ItemIndexViewModel.Instance.ReadAsync("PrimaryHand")).Id);

            DiceHelper.EnableForcedRolls();
            DiceHelper.SetForcedRollValue(1);

            // Act

            // Add the second item, this will return the first item as the one replaced
            var result = data.GetDamageTotalString;

            // Reset
            DiceHelper.DisableForcedRolls();

            // Assert
            Assert.AreEqual("1 + 1D 1", result);
        }
Пример #2
0
        /// <summary>
        /// Default App Constructor
        /// </summary>
        public App()
        {
            InitializeComponent();

            // Warm up the data sets
            DataSetsHelper.WarmUp();

            // Call the Main Page to open
            MainPage = new MainPage();
        }
Пример #3
0
        /// <summary>
        /// Button to delete the data store
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        async void WipeDataList_Clicked(object sender, EventArgs e)
        {
            bool answer = await DisplayAlert("Delete Data", "Are you sure you want to delete all data?", "Yes", "No");

            if (answer)
            {
                // data helper to pass on command to each index view model
                await DataSetsHelper.WipeData();
            }
        }
Пример #4
0
        /// <summary>
        /// Button to delete the data store
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public async void WipeDataList_Clicked(object sender, EventArgs e)
        {
            bool answer = await DisplayAlert("Delete Data", "Are you sure you want to delete all data?", "Yes", "No");

            if (answer)
            {
                Task.Run(async() => { await DataSetsHelper.WipeDataInSequence(); });
                //MessagingCenter.Send(this, "WipeDataList", true);
            }
        }
Пример #5
0
 /// <summary>
 /// Data Source Toggle
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 async void DataSource_Toggled(object sender, EventArgs e)
 {
     // Flip the settings
     if (DataSourceValue.IsToggled == true)
     {
         await DataSetsHelper.SetDataSource(1);
     }
     else
     {
         await DataSetsHelper.SetDataSource(0);
     }
 }
Пример #6
0
        /// <summary>
        /// The Wipe Data comes in from multiple Messages one from each view model
        /// The user can also click the Wipe button quickly
        ///
        /// So need a way to control the wipe so it does not overlap
        ///
        /// First call up to the shared Helper so wipe wipes all data sets, not just the message that came in
        /// This will ensure the wipe happens in the correct sequence.
        ///
        /// Then the helper will call to the BaseView to wipe just its data
        /// </summary>
        /// <returns></returns>
        public async Task <bool> WipeDataListAsync()
        {
            var result = await DataSetsHelper.WipeDataInSequence();

            return(result);
        }
Пример #7
0
 /// <summary>
 /// Wipes the current data.
 /// </summary>
 public void RunWipeData()
 {
     Task.Run(async() => { await DataSetsHelper.WipeDataInSequence(); });
 }