示例#1
0
        public void BuzzFizzGetStringOutputForNeither3No5MultiplersTest()
        {
            var testNumbers = new List <int> {
                4, 7, 11
            };

            foreach (var testNumber in testNumbers)
            {
                BuzzFizz.GetStringOutput(testNumber).ShouldBe(testNumber.ToString());
            }
        }
示例#2
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                BuzzFizz buzzFizz = new BuzzFizz(BuzzFizzNumber, GetUserId());
                AddBuzzFizz(buzzFizz);
                HttpContext.Session.SetString("BuzzFizz", buzzFizz.ToString());
                HttpContext.Session.SetString("Data", buzzFizz.date.ToString());

                return(RedirectToPage("./Szukane"));
            }
            return(Page());
        }
示例#3
0
        static void Main(string[] args)
        {
            /*
             * Write a program that prints to the console the numbers from 1 to 100
             * But for multiples of three print "Buzz" instead of the number
             * and for the multiples of five print "Fizz".
             * For numbers which are multiples of both three and five print "BuzzFizz"
             */
            for (var i = 1; i <= 100; i++)
            {
                Console.WriteLine(BuzzFizz.GetStringOutput(i));
            }

            Console.WriteLine("Press enter to quit...");
            Console.ReadLine();
        }
示例#4
0
        public void AddBuzzFizz(BuzzFizz buzzFizz)
        {
            var BuzzFizzQuerry = (from BuzzFizz in _context.BuzzFizz where BuzzFizz.historical == false orderby BuzzFizz.date descending select BuzzFizz).Take(10);
            int amount         = BuzzFizzQuerry.Count();

            if (amount >= 10)
            {
                var BuzzFizzLast = BuzzFizzQuerry.LastOrDefault();

                if (BuzzFizzLast != null)
                {
                    BuzzFizzLast.historical = true;
                }
            }

            _context.BuzzFizz.Add(buzzFizz);
            _context.SaveChanges();
        }
示例#5
0
        static void Main(string[] args)
        {
            //This will write to the Cosnole
            Console.WriteLine("This will output BuzzFizz using a static class method to the UpperBound of 100.");
            BuzzFizz.StaticOutput(100);
            Console.ReadKey();
            Console.WriteLine();

            //This will write to the Cosnole
            Console.WriteLine("This will output BuzzFizz using an instantiated object of BuzzFizz \n " +
                              "to the UpperBound of 150 which is set when the object is constructed.");
            BuzzFizz BF = new BuzzFizz(150);

            BF.ObjectInstanceOutput();
            Console.ReadKey();
            Console.WriteLine();

            //If you wanted to run this Console Application from the command line
            //by passing an integer value as the first parameter
            Console.WriteLine("This will output BuzzFizz using a static class mehod to the UpperBound of \n " +
                              "the int value passed into the console application as the first parameter.");
            int parameter;

            if (args.Count() > 0)
            {
                if (int.TryParse(args[0], out parameter))
                {
                    BuzzFizz.StaticOutput(Convert.ToInt32(args[0]));
                }
                else
                {
                    Console.WriteLine("Invalid Argument: " + args[0]);
                }
            }
            else
            {
                Console.WriteLine("No Argugment passed into the application.");
            }
        }
示例#6
0
 public void BuzzFizzGetStringOutputFor3And5MultiplersTest()
 {
     BuzzFizz.GetStringOutput(15).ShouldBe(BuzzFizzOutput);
     BuzzFizz.GetStringOutput(30).ShouldBe(BuzzFizzOutput);
     BuzzFizz.GetStringOutput(60).ShouldBe(BuzzFizzOutput);
 }
示例#7
0
 public void BuzzFizzGetStringOutputFor5MultiplerTest()
 {
     BuzzFizz.GetStringOutput(5).ShouldBe(FizzOutput);
     BuzzFizz.GetStringOutput(20).ShouldBe(FizzOutput);
     BuzzFizz.GetStringOutput(100).ShouldBe(FizzOutput);
 }
示例#8
0
 public void BuzzFizzGetStringOutputFor3MultiplerTest()
 {
     BuzzFizz.GetStringOutput(3).ShouldBe(BuzzOutput);
     BuzzFizz.GetStringOutput(6).ShouldBe(BuzzOutput);
     BuzzFizz.GetStringOutput(9).ShouldBe(BuzzOutput);
 }