Ejemplo n.º 1
0
        public void Database_CreateContract_ContractInDatabase()
        {
            Customer     customer     = new Customer(3, "TestCust", "Denmark");
            Material     material     = new Material(1, "Jern", "J");
            ContractLine contractLine = new ContractLine(material, 0.50m, 1000, 0, true, "Nothing");
            DateTime     date         = new DateTime(2017, 5, 16);
            Contract     contract     = new Contract(4, customer, date, Currency.DKK, "MR");

            contract.ContractLines.Add(contractLine);

            dbc.AddContract(contract);
            Contract actual = dbc.GetContract(4);

            Assert.AreEqual("TestCust", actual.Customer.Name);
            //Assert.AreEqual(1, actual.ContractLines.Count);
            Assert.AreEqual("Jern", actual.ContractLines[0].Material.Type);
            Assert.AreEqual(1000, actual.ContractLines[0].TotalAmount);
            Assert.AreEqual(0, actual.ContractLines[0].DeliveredAmount);
            Assert.AreEqual(1000, actual.ContractLines[0].RemainingAmount);
            Assert.AreEqual(0.50m, actual.ContractLines[0].Price);
            Assert.AreEqual(2017, actual.Date.Year);
            Assert.AreEqual(5, actual.Date.Month);
            Assert.AreEqual(16, actual.Date.Day);
        }
Ejemplo n.º 2
0
 public void AddContract(Contract contract)
 {
     dbController.AddContract(contract);
 }