public void Append_SelectAll_Transaction_UnitTest()
 {
     Database database = new Database();
     Transactions transaction1 = new Transactions(1, DateTime.Now, "Checking", "Snickers", .50f);
     Transactions transaction2 = new Transactions(2, DateTime.Now, "Checking", "Snickers", .50f);
     database.Append(transaction1);
     database.Append(transaction2);
     List<Transactions> TransactionList = database.SelectAllTransactions();
     Assert.AreSame(TransactionList[0], transaction1);
     Assert.AreSame(TransactionList[1], transaction2);
 }
 public void Append_SelectAll_Product_UnitTest()
 {
     Database database = new Database();
     Product product1 = new Product("This is Not a Product", .25f);
     Product product2 = new Product("This is Not a Product2", .25f);
     database.Append(product1);
     database.Append(product2);
     List<Product> productList = database.SelectAllProduct();
     Assert.AreSame(productList[0], product1);
     Assert.AreSame(productList[1], product2);
 }
 public void Append_SelectAll_Employee_UnitTest()
 {
     Database database = new Database();
     Employee employee1 = new Employee("Bob", "Hope", "E1001", "Milwaukee");
     Employee employee2 = new Employee("Joe", "Schmoe", "E1002", "Waukesha");
     database.Append(employee1);
     database.Append(employee2);
     List<Employee> EmployeeList = database.SelectAllEmployee();
     Assert.AreSame(EmployeeList[0], employee1);
     Assert.AreSame(EmployeeList[1], employee2);
     Assert.AreEqual(EmployeeList[0].EmployeeID, "E1001");
 }
 public void Append_SelectAll_City_UnitTest()
 {
     Database database = new Database();
     City city1 = new City("Milwaukee", "WI", "MKE-WI");
     City city2 = new City("Waukesha", "WI", "WAU-WI");
     database.Append(city1);
     database.Append(city2);
     List<City> cityList = database.SelectAllCity();
     Assert.AreSame(cityList[0], city1);
     Assert.AreSame(cityList[1], city2);
     Assert.AreEqual(cityList[0].ID, "MKE-WI");
 }
        public void TransferFromMachine_UnitTest()
        {
            // Init
            Database database = new Database();
            TransferManager transferManager = new TransferManager(database);
            transferManager.buyStock("Snickers", 5, .25f);
            List<Product> listProduct = database.SelectAllProduct();

            Machine machine = new Machine("Milwaukee", "", "M101");
            database.Append(machine);
            transferManager.TransferToMachine(machine, listProduct);
            Assert.AreEqual(machine.getSingleQuantity("Snickers"), 5);
            List<Product> transferList = machine.selectAllProductByType("Snickers");

            // Action
            transferManager.TransferFromMachine(machine, transferList);

            // Assert
            Assert.AreEqual(database.SelectAllProduct().Count, 5);
            Assert.AreEqual(machine.getSingleQuantity("Snickers"), 0);

            List<Transactions> listTransactions = database.SelectAllTransactions();
            Assert.AreEqual(listTransactions.Count, 5);
            Assert.AreEqual(listTransactions[4].Amount, 1.25f);
        }
Ejemplo n.º 6
0
        public void TestEmployeeFullName()
        {
            Database database = new Database();
            Employee employee1 = new Employee("Jeff", "Test", "EIO987", "Brookfield");

            database.Append(employee1);
            
            List<Employee> EmployeeList = database.SelectAllEmployee();
            Assert.AreEqual("Jeff Test", EmployeeList[0].FullName);
        }
Ejemplo n.º 7
0
        public void MachineTestObjectAdded()
        {
            Database database = new Database();
            Machine machine1 = new Machine("Hartford", "Downtown", "M100");

            database.Append(machine1);

            List<Machine> MachineList = database.SelectAllMachine();

            Assert.AreEqual(machine1, MachineList[0]);
        }
Ejemplo n.º 8
0
        public void MachineNeedRestockInitial()
        {
            Database database = new Database();
            Machine machine1 = new Machine("Hartford", "Downtown", "M100");

            database.Append(machine1);

            List<Machine> MachineList = database.SelectAllMachine();

            Assert.AreEqual(true, MachineList[0].NeedRestock);
        }
Ejemplo n.º 9
0
        public void TestEmployeeDateType()
        {
            Database database = new Database();
            Employee employee1 = new Employee("Jeff", "Test", "EIO987", "Brookfield");

            database.Append(employee1);

            DateTime today = DateTime.Today;

            List<Employee> EmployeeList = database.SelectAllEmployee();
            Assert.IsInstanceOfType(EmployeeList[0].DateStarted, typeof(DateTime));
        }
Ejemplo n.º 10
0
        public void TestEmployeeDateToday()
        {
            Database database = new Database();
            Employee employee1 = new Employee("Jeff", "Test", "EIO987", "Brookfield");

            database.Append(employee1);

            DateTime today = DateTime.Today;

            List<Employee> EmployeeList = database.SelectAllEmployee();
            Assert.AreEqual(today, EmployeeList[0].DateStarted);
        }
Ejemplo n.º 11
0
        public void MachineCheckProductSingleQuantity()
        {
            Database database = new Database();
            Machine machine1 = new Machine("Hartford", "Downtown", "M100");

            Product product1 = new Product("coke", .75f);
            Product product2 = new Product("snickers", .75f);

            machine1.addProduct(product1);
            machine1.addProduct(product2);

            database.Append(machine1);

            List<Machine> MachineList = database.SelectAllMachine();

            Assert.AreEqual(1, MachineList[0].getSingleQuantity("coke"));
        }
Ejemplo n.º 12
0
        public void MachineCheckProductTypeNames()
        {
            Database database = new Database();
            Machine machine1 = new Machine("Hartford", "Downtown", "M100");

            Product product1 = new Product("coke", .75f);
            Product product2 = new Product("snickers", .75f);

            machine1.addProduct(product1);
            machine1.addProduct(product2);
            List<string> expected = new List<string> { "coke", "snickers" };

            database.Append(machine1);

            List<Machine> MachineList = database.SelectAllMachine();

            CollectionAssert.AreEqual(expected, MachineList[0].getProductNames());
        }
        public void MachineSale_UnitTest()
        {
            // Init
            Database database = new Database();
            TransferManager transferManager = new TransferManager(database);
            Machine machine = new Machine("Milwaukee", "The Mall", "M101");
            database.Append(machine);
            transferManager.buyStock("Snickers", 5, .25f);
            List<Product> listProduct = database.SelectAllProduct();
            transferManager.TransferToMachine(machine, listProduct);
            List<Product> listProductBefore = machine.selectAllProductByType("Snickers");
            int startingCount = listProductBefore.Count;

            // Action
            transferManager.machineSale(machine, listProductBefore[0]);

            // Assert
            List<Product> listProductAfter = machine.selectAllProductByType("Snickers");
            List<Transactions> listTransactionsAfter = database.SelectAllTransactions();
            int endingCount = listProductAfter.Count;
            int transactionCount = listTransactionsAfter.Count;
            Assert.AreEqual(startingCount - 1, endingCount);
            Assert.AreEqual(5, transactionCount);
        }
 public void Append_SelectAll_Vehicle_UnitTest()
 {
     Database database = new Database();
     Vehicle vehicle1 = new Vehicle("Truck1", "Milwaukee", 1);
     Vehicle vehicle2 = new Vehicle("Truck2", "Milwaukee", 1);
     database.Append(vehicle1);
     database.Append(vehicle2);
     List<Vehicle> vehicleList = database.SelectAllVehicle();
     Assert.AreSame(vehicleList[0], vehicle1);
     Assert.AreSame(vehicleList[1], vehicle2);
     Assert.AreEqual(vehicleList[0].VehicleID, "Truck1");
 }
Ejemplo n.º 15
0
        public void MachineUpdateRetailPrice()
        {
            Database database = new Database();
            Machine machine1 = new Machine("Hartford", "Downtown", "M100");

            Product product1 = new Product("coke", .75f);
            Product product2 = new Product("snickers", .75f);

            machine1.addProduct(product1);
            machine1.addProduct(product2);
            machine1.updateRetailPrice("coke", 2.00f);
            float expected = 2.00f;

            database.Append(machine1);

            List<Machine> MachineList = database.SelectAllMachine();

            Assert.AreEqual(expected, product1.RetailPrice);
        }