Beispiel #1
0
        public void TestEqualsSimpleString()
        {
            var obj1 = new Customer("Sergey", new List<Rental>());
            obj1.Rentals.Add(new Rental(new Movie("Noi", new NewReleasePrice()), 10));
            var st1 = new Statement(obj1).ToSimpleString();

            var obj2 = new Customer("Sergey", new List<Rental>());
            obj2.Rentals.Add(new Rental(new Movie("Noi", new NewReleasePrice()), 10));
            var st2 = new Statement(obj2).ToSimpleString();

            Assert.AreEqual(st1, st2);
        }
Beispiel #2
0
        public void TestEqualsRental()
        {
            var rentals = new List<Rental>
            {
                new Rental(new Movie("Noi", new NewReleasePrice()), 10),
                new Rental(new Movie("Macho and Botan", new RegularPrice()), 1)
            };

            var client = new Customer("Unknow", rentals);
            client.Rentals.Add(new Rental(new Movie("Noi", new NewReleasePrice()), 10));
            client.Rentals.Add(new Rental(new Movie("Macho and Botan", new RegularPrice()), 1));

            Assert.AreEqual(client.Rentals, client.Rentals);
        }
Beispiel #3
0
 public void TestEqualsName()
 {
     const string nameClient = "Sergey";
     var client = new Customer(nameClient, new List<Rental>());
     Assert.AreEqual(client.Name, nameClient);
 }
Beispiel #4
0
 public void TestJsonString()
 {
     var obj = new Customer("Sergey", new List<Rental>());
     obj.Rentals.Add(new Rental(new Movie("Noi", new NewReleasePrice()), 10));
     var jsonString = new Statement(obj).ToJson();
     var jsonConvertString = JsonConvert.SerializeObject(new Statement(obj), Formatting.Indented);
     Assert.AreEqual(jsonString, jsonConvertString);
 }