コード例 #1
0
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the test customer
            clsCustomer TestCustomer = new clsCustomer();
            Int32       PrimaryKey   = 0;

            //set properties
            TestCustomer.Name         = "a";
            TestCustomer.Address      = "ad";
            TestCustomer.Postcode     = "AA111BB";
            TestCustomer.DoB          = DateTime.Now.Date;
            TestCustomer.GdprRequest  = true;
            AllCustomers.ThisCustomer = TestCustomer;
            //add customer to key
            PrimaryKey = AllCustomers.Add();
            //set key
            TestCustomer.CustomerId = PrimaryKey;
            //update test customer
            TestCustomer.Name        = "Test Son";
            TestCustomer.Address     = "Some Road";
            TestCustomer.Postcode    = "LE101NN";
            TestCustomer.DoB         = DateTime.Now.Date;
            TestCustomer.GdprRequest = false;
            //set customer with new data
            AllCustomers.ThisCustomer = TestCustomer;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestCustomer);
        }
コード例 #2
0
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.Name             = "John Smith";
            TestItem.EmailAddress     = "*****@*****.**";
            TestItem.Address          = "Flat 10, Charles street, Leicester";
            TestItem.Password         = "******";
            TestItem.isEmailConfirmed = true;
            TestItem.LoyaltyPoints    = 10.5;
            TestItem.CreatedAt        = DateTime.Now.Date;

            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey          = AllCustomers.Add();
            TestItem.CustomerId = PrimaryKey;

            // Modify data
            TestItem.Name             = "Johnny Smith";
            TestItem.EmailAddress     = "*****@*****.**";
            TestItem.Address          = "Flat 21, Charles street, Leicester";
            TestItem.Password         = "******";
            TestItem.isEmailConfirmed = false;
            TestItem.LoyaltyPoints    = 12.5;
            TestItem.CreatedAt        = DateTime.Now.Date;

            AllCustomers.ThisCustomer = TestItem;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);

            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
コード例 #3
0
        public void AddMethodOK()
        {
            clsCustomerCollection allCustomers = new clsCustomerCollection();

            clsCustomer TestItem = new clsCustomer();

            Int32 PrimaryKey = 0;

            TestItem.Active                 = true;
            TestItem.CustomerId             = 4;
            TestItem.Name                   = "Zeynep Tugce";
            TestItem.CustomerRegisteredDate = DateTime.Now.Date;
            TestItem.ProductId              = 40;
            TestItem.Point                  = 0;

            allCustomers.ThisCustomer = TestItem;

            PrimaryKey = allCustomers.Add();

            TestItem.CustomerId = PrimaryKey;

            allCustomers.ThisCustomer.Find(PrimaryKey);

            Assert.AreEqual(allCustomers.ThisCustomer, TestItem);
        }
コード例 #4
0
        public void DeleteMethodOK()
        {
            clsCustomerCollection allCustomers = new clsCustomerCollection();

            clsCustomer TestItem = new clsCustomer();

            Int32 PrimaryKey = 0;

            TestItem.Active                 = true;
            TestItem.CustomerId             = 4;
            TestItem.Name                   = "Zeynep Tugce";
            TestItem.CustomerRegisteredDate = DateTime.Now.Date;
            TestItem.ProductId              = 40;
            TestItem.Point                  = 0;

            allCustomers.ThisCustomer = TestItem;

            PrimaryKey = allCustomers.Add();

            TestItem.CustomerId = PrimaryKey;

            allCustomers.ThisCustomer.Find(PrimaryKey);

            allCustomers.Delete();

            Boolean Found = allCustomers.ThisCustomer.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
コード例 #5
0
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.Active     = true;
            TestItem.CustomerId = 1;
            TestItem.Username   = "******";
            TestItem.DateAdded  = DateTime.Now.Date;
            TestItem.Address    = "anaddress";
            TestItem.Password   = "******";
            //set ThisCustomer to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key of the test data
            TestItem.CustomerId = PrimaryKey;
            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
コード例 #6
0
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.Active     = true;
            TestItem.CustomerId = 1;
            TestItem.Username   = "******";
            TestItem.DateAdded  = DateTime.Now.Date;
            TestItem.Address    = "anaddress";
            TestItem.Password   = "******";
            //set ThisCustomer to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key of the test data
            TestItem.CustomerId = PrimaryKey;
            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //delete the record
            AllCustomers.Delete();
            //now find the record
            Boolean Found = AllCustomers.ThisCustomer.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
コード例 #7
0
        public void AddMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the test customer
            clsCustomer TestCustomer = new clsCustomer();
            Int32       PrimaryKey   = 0;

            //set properties
            TestCustomer.CustomerId   = 5;
            TestCustomer.Name         = "Bruce Lee";
            TestCustomer.Address      = "Turbo Road";
            TestCustomer.Postcode     = "PE10 1AB";
            TestCustomer.DoB          = DateTime.Now.Date;
            TestCustomer.GdprRequest  = true;
            AllCustomers.ThisCustomer = TestCustomer;
            //add customer to key
            PrimaryKey = AllCustomers.Add();
            //set key
            TestCustomer.CustomerId = PrimaryKey;
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestCustomer);
        }
コード例 #8
0
        public void DeleteMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the test customer
            clsCustomer TestCustomer = new clsCustomer();
            Int32       PrimaryKey   = 0;

            //set properties
            TestCustomer.Name         = "John Barry";
            TestCustomer.Address      = "The Road";
            TestCustomer.Postcode     = "N111FF";
            TestCustomer.DoB          = DateTime.Now.Date;
            TestCustomer.GdprRequest  = false;
            AllCustomers.ThisCustomer = TestCustomer;
            //add customer to key
            PrimaryKey = AllCustomers.Add();
            TestCustomer.CustomerId = PrimaryKey;
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            AllCustomers.Delete();
            Boolean found = AllCustomers.ThisCustomer.Find(PrimaryKey);

            Assert.IsFalse(found);
        }
コード例 #9
0
        public void DeleteMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.Name             = "John Smith";
            TestItem.EmailAddress     = "*****@*****.**";
            TestItem.Address          = "Flat 10, Charles street, Leicester";
            TestItem.Password         = "******";
            TestItem.isEmailConfirmed = true;
            TestItem.LoyaltyPoints    = 10.5;
            TestItem.CreatedAt        = DateTime.Now.Date;

            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey          = AllCustomers.Add();
            TestItem.CustomerId = PrimaryKey;
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            AllCustomers.Delete();

            Boolean Found = AllCustomers.ThisCustomer.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }