Пример #1
0
        public void InsertSale_IfYouInsertASaleWithNullIdAndNoExistingSales_IdStartsAtOne()
        {
            var mockDatabase = new MockDatabase();
            var sale         = new Sale();

            mockDatabase.InsertSale(sale);
            Assert.AreEqual(1, sale.SaleId);
        }
Пример #2
0
        public void InsertEmployee_IfYouInsertAnEmpoyeeWithNullIdAndNoExistingEmployees_IdStartsAtOne()
        {
            var mockDatabase = new MockDatabase();
            var employee     = new Employee();

            mockDatabase.InsertEmployee(employee);
            Assert.AreEqual(1, employee.EmployeeId);
        }
Пример #3
0
        public void InsertEmployee_IfYouInsertAnEmployeeWithNonNullId_ExistingIdIsNotOverwritten()
        {
            var mockDatabase = new MockDatabase();
            var employee     = new Employee
            {
                EmployeeId = 7
            };

            mockDatabase.InsertEmployee(employee);
            Assert.AreEqual(7, employee.EmployeeId);
        }
Пример #4
0
        public void InsertSale_IfYouInsertANonNullId_TheExistingIdIsNotOverwritten()
        {
            var mockDatabase = new MockDatabase();
            var sale         = new Sale
            {
                SaleId = 7
            };

            mockDatabase.InsertSale(sale);
            Assert.AreEqual(7, sale.SaleId);
        }
Пример #5
0
        public void GetSaleById_IfYouInsertASale_YouCanGetItBack()
        {
            var mockDatabase = new MockDatabase();
            var sale         = new Sale {
                SaleId = 20202
            };

            mockDatabase.InsertSale(sale);
            var actual = mockDatabase.GetSaleById(20202);

            Assert.IsNotNull(actual);
            Assert.AreEqual(20202, actual.SaleId);
        }
Пример #6
0
        public void GetEmployeeById_IfYouInsertAnEmployee_YouCanGetItBack()
        {
            var mockDatabase = new MockDatabase();
            var employee     = new Employee {
                EmployeeId = 20202
            };

            mockDatabase.InsertEmployee(employee);
            var actual = mockDatabase.GetEmployeeById(20202);

            Assert.IsNotNull(actual);
            Assert.AreEqual(20202, actual.EmployeeId);
        }
Пример #7
0
        public void InsertSale_IfYouInsertInsertASaleWithNullIdAndAPreviousSaleExists_IdIsMaxPlusOne()
        {
            var mockDatabase = new MockDatabase();
            var initialSale  = new Sale {
                SaleId = 7
            };

            mockDatabase.InsertSale(initialSale);
            var secondSale = new Sale();

            mockDatabase.InsertSale(secondSale);
            Assert.AreEqual(8, secondSale.SaleId);
        }
Пример #8
0
        public void InsertEmployee_IfYouInsertAnEmployeeWithNullIdAndAnEmployeeExists_IdIsMaxPlusOne()
        {
            var mockDatabase    = new MockDatabase();
            var initialEmployee = new Employee {
                EmployeeId = 7
            };

            mockDatabase.InsertEmployee(initialEmployee);
            var secondEmployee = new Employee();

            mockDatabase.InsertEmployee(secondEmployee);
            Assert.AreEqual(8, secondEmployee.EmployeeId);
        }