public void InvoiceCountTest() { ICRUDTestDBContextProvider cRUDTestDBContextProvider = new CRUDTestDBContextProvider(Guid.NewGuid().ToString()); var context = cRUDTestDBContextProvider.GetContext(); var invoiceInvoiceCountTest = new Invoice { InvoiceId = 1, CustomerId = 1 }; var customerInvoiceCountTest = new Customer { CustomerId = 1 }; context.Add(invoiceInvoiceCountTest); context.Add(customerInvoiceCountTest); context.SaveChanges(); CustomerBE customerBE = new CustomerBE(cRUDTestDBContextProvider); customerBE.Load(1); Assert.IsTrue(customerBE.InvoiceCount == 1); InvoiceBE invoiceBE = new InvoiceBE(cRUDTestDBContextProvider); invoiceBE.New(); customerBE.AddToInvoice(invoiceBE); invoiceBE.Save(); CustomerBE customerBE2 = new CustomerBE(cRUDTestDBContextProvider); customerBE2.Load(1); Assert.IsTrue(customerBE2.InvoiceCount == 2); }
public void SaveWithoutIdTest() { ICRUDTestDBContextProvider cRUDTestDBContextProvider = new CRUDTestDBContextProvider(Guid.NewGuid().ToString()); InvoiceBE invoiceBE = new InvoiceBE(cRUDTestDBContextProvider); invoiceBE.New(); invoiceBE.Save(); Assert.IsTrue(invoiceBE.Id != default); }