Ejemplo n.º 1
0
        public void RandomIDTest()
        {
            string expected = "0123456789";
            string actual;

            actual = MainBank.RandomID();
            Assert.AreNotEqual(expected, actual);
        }
Ejemplo n.º 2
0
        //Button Clicked Function to process the transaction
        private async void Submit_Donation_Clicked(object sender, EventArgs e)
        {
            double someVar = 0.0;//set a default value someVar to 0.0

            try
            {
                someVar = Convert.ToDouble(paymentAmount.Text);//tries to convert the user input to double
            }
            finally
            {
                if (someVar == 0.0 || someVar < 0)                       //if the user input fails to convert to double, or if it is negative or 0.0
                {
                    DonaAmt.Text = "Invalid Entry! Please enter again!"; //displays that the number that the user entered is invalid
                }
                else//if the number that the user entered successfully converts to double, then
                {
                    var httpClient = new HttpClient();                                                                                                    //new httpclient object
                    var response   = await httpClient.GetStringAsync("http://paribusapienv.3ux9m2mjwg.us-west-2.elasticbeanstalk.com/bank/?format=json"); //responser to get string data from the api

                    var bankInfo = JsonConvert.DeserializeObject <List <ArchApp.Models.MainBank> >(response);                                             //deserialize

                    int totalBankAmt = 0;                                                                                                                 //declare and initialize totalbankamt to 0
                    foreach (Models.MainBank OurBank in bankInfo)                                                                                         //look for the money
                    {
                        totalBankAmt = OurBank.money;                                                                                                     //money in the bank
                        System.Diagnostics.Debug.WriteLine("This is the bank amount: " + totalBankAmt);                                                   //debug
                        break;                                                                                                                            //break
                    }

                    DonaAmt.Text = "Donation amount that you entered is: $" + Convert.ToString(someVar); //prints whatever the user inputs
                    string   bankName = "The Baby Bobby Bank";                                           //bank name
                    MainBank newBank  = new MainBank()                                                   //create a new bank object
                    {
                        id    = Convert.ToInt32(1),                                                      //set id to 1
                        money = Convert.ToInt32(paymentAmount.Text) + totalBankAmt,                      //set new balance = current balance + user input
                        name  = Convert.ToString(bankName)                                               //bank name
                    };

                    var json    = JsonConvert.SerializeObject(newBank);                                                                            //serialize to put
                    var content = new StringContent(json, Encoding.UTF8, "application/json");                                                      //application/json format

                    HttpClient client1 = new HttpClient();                                                                                         //new httpclient object
                    var        result  = await client1.PutAsync("http://paribusapienv.3ux9m2mjwg.us-west-2.elasticbeanstalk.com/bank/", content);  //put functionality

                    if (result.IsSuccessStatusCode)                                                                                                //if theres no error putting to database then
                    {
                        await DisplayAlert("Thank You!", string.Concat("You have donated $", paymentAmount.Text, " for a good cause."), "K, lol"); //this alert is shown

                        await Navigation.PushModalAsync(new MainPage());                                                                           //and when the button is clicked, the user is redirected to the homepage
                    }
                    else//if there is an error
                    {
                        await DisplayAlert("Oops!", "Something went wrong! Please try again.", "Try again");//then inform the user that something went wrong
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void getDepartmentTest()
        {
            string ID       = "0123456789";
            string expected = "OddzialKrakow";
            string actual;

            actual = MainBank.getDepartment(ID);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 4
0
        public void getDepartmentIDTest()
        {
            string department = "OddzialKrakow";
            string expected   = "KR1234";
            string actual;

            actual = MainBank.getDepartmentID(department);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
        public void getOtherDepartmentTest()
        {
            string department = "OddzialKrakow";
            string expected   = "OddzialWarszawa";
            string actual;

            actual = MainBank.getOtherDepartment(department);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 6
0
        public void checkClientIDTest()
        {
            string ID       = "9845685478";
            bool   expected = false;
            bool   actual;

            actual = MainBank.checkClientID(ID);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 7
0
        public void checkDepartmentsTest()
        {
            string ID       = "0123456789";
            bool   expected = true;
            bool   actual;

            actual = MainBank.checkDepartments(ID);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 8
0
        public void checkPeselTest()
        {
            string pesel    = "21545545454544";
            bool   expected = true;
            bool   actual;

            actual = MainBank.checkPesel(pesel);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 9
0
 public static void Init()
 {
     FMOD.Studio.System.create(out _System);
     _System.getLowLevelSystem(out FMOD.System low);
     low.setSoftwareFormat(0, FMOD.SPEAKERMODE._7POINT1, 0);
     _System.initialize(1, FMOD.Studio.INITFLAGS.NORMAL, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
     _System.loadBankFile(FileSystemManager.RootDirectory + "/Content/Banks/Master_Bank.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out Bank MainBank);
     _System.loadBankFile(FileSystemManager.RootDirectory + "/Content/Banks/Master_Bank.strings.bank", LOAD_BANK_FLAGS.NORMAL, out Bank MainBankStrings);
     MainBank.getEventList(out MainEvents);
     DumpEventInformation();
 }
Ejemplo n.º 10
0
        public void sendMoneyTest()
        {
            double amountOfMoney = 20;
            string SenderID      = "0123456789";
            string ReciverID     = "1111111111";
            bool   expected      = true;
            bool   actual;

            actual = MainBank.sendMoney(amountOfMoney, SenderID, ReciverID);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 11
0
        public void departmentIDTest()
        {
            string ID = "0123456789";
            Dictionary <string, string> expected = new Dictionary <string, string> {
                { "KR1234", "OddzialKrakow" }, { "WA1234", "OddzialWarszawa" }
            };
            Dictionary <string, string> actual;

            actual = MainBank.departmentID(ID);
            CollectionAssert.AreEqual(expected, actual);
        }