Exemplo n.º 1
0
        public void TestMadeFound()
        {
            //create an instance of the class
            clsOrder AnOrder = new clsOrder();
            //create some test data
            Boolean Found   = false;
            Boolean OK      = true;
            Int32   OrderId = 1;

            //set the test data to the class and try to find it
            Found = AnOrder.Find(OrderId);
            if (AnOrder.Made != true)
            {
                OK = false;
            }
            //check to see if its true
            Assert.IsTrue(OK);
        }
Exemplo n.º 2
0
        public void TestDateDispatchFound()
        {
            //create an instance of the class
            clsOrder AnOrder = new clsOrder();
            //create some test data
            Boolean Found   = false;
            Boolean OK      = true;
            Int32   OrderId = 1;

            //set the test data to the class and try to find it
            Found = AnOrder.Find(OrderId);
            if (AnOrder.DateDispatch != Convert.ToDateTime("14/02/2021"))
            {
                OK = false;
            }
            //check to see if its true
            Assert.IsTrue(OK);
        }
Exemplo n.º 3
0
        public void TestCustomerAddressFound()
        {
            //create an instance of the class
            clsOrder AnOrder = new clsOrder();
            //create some test data
            Boolean Found   = false;
            Boolean OK      = true;
            Int32   OrderId = 1;

            //set the test data to the class and try to find it
            Found = AnOrder.Find(OrderId);
            if (AnOrder.Address != "5 Colin Grundy Drive")
            {
                OK = false;
            }
            //check to see if its true
            Assert.IsTrue(OK);
        }
Exemplo n.º 4
0
        public void DateAddedMin()
        {
            //Create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //String variable to store any error message
            String Error = "";
            //Create a variable to store the test date data
            DateTime TestDate;

            //Set the date to today's date
            TestDate = DateTime.Now.Date;
            //Convert the date variable to a string variable
            string DateAdded = TestDate.ToString();

            //Invoke the method
            Error = AnOrder.Valid(DateAdded, Description, ShippingAddress, Quantity);
            //Test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 5
0
        public void ThisOrderOK()
        {
            //create an instance of the class
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create some test data for the class
            clsOrder TestOrder = new clsOrder();

            TestOrder.Address      = "some address";
            TestOrder.CustomerId   = 2;
            TestOrder.DateDispatch = DateTime.Now.Date;
            TestOrder.ItemName     = "some Item";
            TestOrder.ItemQuantity = 3;
            TestOrder.Made         = true;
            TestOrder.OrderId      = 7;
            //set the record based on the test data
            AllOrders.ThisOrder = TestOrder;
            //check to see they are both equal
            Assert.AreEqual(AllOrders.ThisOrder, TestOrder);
        }
Exemplo n.º 6
0
        public void DatePurchasedMin()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //create a variable to store the test date data
            DateTime TestDate;

            //set the date totodays date
            TestDate = DateTime.Now.Date;
            //convert the date variable to a string variable
            string DatePurchased = TestDate.ToString();

            //invoke the method
            Error = AnOrder.Valid(Address, DeliveryDate, DatePurchased);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 7
0
        public void DateAddedMin()
        {
            //create an instance of the class we want to create
            clsOrder Order = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //create a variable to store the test date data
            DateTime TestDate;

            //set the date to todays date
            TestDate = DateTime.Now.Date;
            //convert the date variable to a string variable
            string Date = TestDate.ToString();

            //invoke the method
            Error = Order.Valid(ProductName, ProductNo, OrderNo, Date, Price);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 8
0
        public void DeleteMethodOK()
        {
            clsOrderCollection AllOrder = new clsOrderCollection();
            clsOrder           TestItem = new clsOrder();
            Int32 PrimaryKey            = 0;

            TestItem.BookName   = "The Good Times";
            TestItem.Quantity   = 2;
            TestItem.OrderDate  = DateTime.Now.Date;
            TestItem.Price      = 20;
            TestItem.Dispatched = true;
            AllOrder.ThisOrder  = TestItem;
            PrimaryKey          = AllOrder.Add();
            TestItem.OrderNo    = PrimaryKey;
            AllOrder.ThisOrder.Find(PrimaryKey);
            AllOrder.Delete();
            Boolean Found = AllOrder.ThisOrder.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
Exemplo n.º 9
0
        public void DeleteMethodOK()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            clsOrder           TestItem  = new clsOrder();
            Int32 PrimaryKey             = 0;

            TestItem.ClothesAvailable = true;
            TestItem.OrderNo          = 1;
            TestItem.Address          = "105 Vancouver Road Leicester";
            TestItem.DeliveryDate     = DateTime.Now.Date;
            TestItem.DatePurchased    = DateTime.Now.Date;
            AllOrders.ThisOrder       = TestItem;
            PrimaryKey       = AllOrders.Add();
            TestItem.OrderNo = PrimaryKey;
            AllOrders.ThisOrder.Find(PrimaryKey);
            AllOrders.Delete();
            Boolean Found = AllOrders.ThisOrder.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
Exemplo n.º 10
0
        public void TestOrderQuantityFound()
        {
            //Create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //Boolean variable to store the result of the search
            Boolean Found = false;
            //Boolean variable to record if the data is OK (assume it is)
            Boolean OK = true;
            //Create some test data to use with the method
            Int32 OrderId = 7;

            //Invoke the method
            Found = AnOrder.Find(OrderId);
            //Check the Order Id
            if (AnOrder.OrderQuantity != 1)
            {
                OK = false;
            }
            //Test to see that the result is correct
            Assert.IsTrue(OK);
        }
Exemplo n.º 11
0
        public void TestProductNoFound()
        {
            // create an instance of the class we want to create
            clsOrder OrderProcessing = new clsOrder();
            //boolean variable to store the result of the search
            Boolean Found = false;
            //boolean variable to record if data is ok (assume it is)
            Boolean OK = true;
            //create some test data to use with the method
            Int32 ProductNo = 1;

            //invoke the method
            Found = OrderProcessing.Find(ProductNo);
            //check the address no
            if (OrderProcessing.ProductNo != 1)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
Exemplo n.º 12
0
        public void ListandCountsOK()

        {
            clsOrderCollection AllOrder = new clsOrderCollection();
            List <clsOrder>    TestList = new List <clsOrder>();
            clsOrder           TestItem = new clsOrder();

            //properties
            TestItem.OrderNo    = 1;
            TestItem.BookName   = "The Good Times";
            TestItem.Quantity   = 2;
            TestItem.OrderDate  = DateTime.Now.Date;
            TestItem.Price      = 20;
            TestItem.Dispatched = true;

            TestList.Add(TestItem);

            AllOrder.OrderList = TestList;

            Assert.AreEqual(AllOrder.Count, TestList.Count);
        }
Exemplo n.º 13
0
        public void TestClothesAvailableFound()
        {
            //create an instance of the class we want to create
            clsOrder AOrder = new clsOrder();
            //boolean variable to store the result of the search
            Boolean Found = false;
            //boolean variable to record if data is OK (assume it is)
            Boolean OK = true;
            //create some test data to use with the method
            Int32 OrderNo = 1;

            //invoke the method
            Found = AOrder.Find(OrderNo);
            //check the property
            if (AOrder.ClothesAvailable != true)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
Exemplo n.º 14
0
        public void UpdateMethodOK()
        {
            //create an instance of the class
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create the item of test data
            clsOrder TestItem = new clsOrder();
            //var to store primary key
            Int32 PrimaryKey = 0;

            //set the properties
            TestItem.Address      = "some address";
            TestItem.CustomerId   = 2;
            TestItem.DateDispatch = DateTime.Now.Date;
            TestItem.ItemName     = "Zack Snyder's cut";
            TestItem.ItemQuantity = 2;
            TestItem.Made         = true;
            TestItem.OrderId      = 5;
            //set ThisOrder to the test data
            AllOrders.ThisOrder = TestItem;
            //Add the record
            PrimaryKey = AllOrders.Add();
            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;
            //modify test data
            TestItem.Address      = "2 Jefferson Avenue";
            TestItem.CustomerId   = 2;
            TestItem.DateDispatch = DateTime.Now.Date;
            TestItem.ItemName     = "Zack Snyder's cut";
            TestItem.ItemQuantity = 2;
            TestItem.Made         = true;
            //set the record based on the new test data
            AllOrders.ThisOrder = TestItem;
            //update the record
            AllOrders.Update();
            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);
            //test to see if they are both equal
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Exemplo n.º 15
0
        public void ListandCountOK()
        {
            //create an instance of the class
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create a list for the class
            List <clsOrder> TestList = new List <clsOrder>();
            //create some test data for the class
            clsOrder TestItem = new clsOrder();

            TestItem.Address      = "some address";
            TestItem.CustomerId   = 3;
            TestItem.DateDispatch = DateTime.Now.Date;
            TestItem.ItemName     = "Maaz needs Mac 10";
            TestItem.ItemQuantity = 7;
            TestItem.Made         = true;
            TestItem.OrderId      = 4;
            //add the test data to the list
            TestList.Add(TestItem);
            //set the record based on the test data
            AllOrders.OrderList = TestList;
            //check to see they are both equal
            Assert.AreEqual(AllOrders.Count, TestList.Count);
        }
Exemplo n.º 16
0
        public void UpdateMethodOK()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            clsOrder           TestItem  = new clsOrder();
            Int32 PrimaryKey             = 0;

            TestItem.ClothesAvailable = true;
            TestItem.OrderNo          = 1;
            TestItem.Address          = "105 Vancouver Road Leicester";
            TestItem.DeliveryDate     = DateTime.Now.Date;
            TestItem.DatePurchased    = DateTime.Now.Date;
            AllOrders.ThisOrder       = TestItem;
            PrimaryKey                = AllOrders.Add();
            TestItem.OrderNo          = PrimaryKey;
            TestItem.ClothesAvailable = false;
            TestItem.OrderNo          = 3;
            TestItem.Address          = "21 Oxford Street Leicester";
            TestItem.DeliveryDate     = DateTime.Now.Date;
            TestItem.DatePurchased    = DateTime.Now.Date;
            AllOrders.ThisOrder       = TestItem;
            AllOrders.Update();
            AllOrders.ThisOrder.Find(PrimaryKey);
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Exemplo n.º 17
0
        public void InstanceOK()
        {
            clsOrder AnOrder = new clsOrder();

            Assert.IsNotNull(AnOrder);
        }
Exemplo n.º 18
0
        public void InstanceOk()
        {
            clsOrder OrderProcessing = new clsOrder();

            Assert.IsNotNull(OrderProcessing);
        }