예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var game1  = new Videogame("Metal Gear Solid", "Stealth", 50);
            var game2  = new Videogame("Super Mario", "Jump'n'Run", 60);
            var movie1 = new Movie("Star Wars", "SciFi", 30);
            var movie2 = new Movie("Isle of Dogs", "SciFi", 20);

            string s1 = JsonConvert.SerializeObject(game1);
            string s2 = JsonConvert.SerializeObject(game2);
            string s3 = JsonConvert.SerializeObject(movie1);
            string s4 = JsonConvert.SerializeObject(movie2);

            Console.WriteLine(s1);
            Console.WriteLine(s3);

            File.WriteAllText(@"C:\Users\Public\movie1.json", JsonConvert.SerializeObject(movie1));

            var desgame1  = JsonConvert.DeserializeObject(s1);
            var desmovie1 = JsonConvert.DeserializeObject(s3);

            Console.WriteLine(desgame1);
            Console.WriteLine(desmovie1);

            var filemovie1 = JsonConvert.DeserializeObject <Movie>(File.ReadAllText(@"C:\Users\Public\movie1.json"));

            Console.WriteLine(filemovie1);

            Console.WriteLine("Thank you!\n");
        }
예제 #2
0
 public void PriceIsMinus()
 {
     Assert.Catch(() =>
     {
         var test4 = new Videogame("Super Mario", "Jump'n'Run", -30);
     }
                  );
 }
예제 #3
0
 public void CannotCreateBookWithEmptyName()
 {
     Assert.Catch(() =>
     {
         var test5 = new Videogame("", "Jump'n'Run", 30);
     }
                  );
 }
예제 #4
0
        public void CanUpdatePrice()
        {
            var test7 = new Videogame("Testmovie", "Testgenre", 10);

            test7.SetPrice(20);

            Assert.IsTrue(test7.Price == 20);
        }
예제 #5
0
 public void CannotUpdatePrice()
 {
     Assert.Catch(() =>
     {
         var test8 = new Videogame("Super Mario", "Jump'n'Run", 10);
         test8.SetPrice(-25);
     }
                  );
 }
예제 #6
0
        public void NameIsWrong()
        {
            var test3 = new Videogame("Testgame", "Action", 20);

            Assert.IsFalse(test3.Name == "Super Mario");
        }
예제 #7
0
        public void NameIsNotTrue()
        {
            var test9 = new Videogame("Testagme", "Testgenre", 10);

            Assert.IsFalse(test9.Name == "Zelda");
        }