public static void Main(string[] args) { var vetclinicManager = new BusinessLogic(); var newClient = new ClientBL() { FirstName = "Tom", LastName = "Krus", Telephone = "0984756874" }; vetclinicManager.AddClient(newClient); var newPet = new PetBL() { PetName = "Murzik", Type = "Cat", ClientId = 13 }; vetclinicManager.AddPet(newPet); var newWaybill = new IndividualWaybillBL() { TotalAmount = 100.87M, ClientId = 13 }; vetclinicManager.AddWaybill(newWaybill); vetclinicManager.RemovingClientById(1); vetclinicManager.RemovingPetById(4); vetclinicManager.RemovingWaybillById(2); vetclinicManager.GetClients(); Console.ReadKey(); }
public void CreateClient_saves_a_client_via_context() { var mockSet = new Mock <DbSet <Client> >(); var mockContext = new Mock <AgencyContext>(); mockContext.Setup(m => m.Clients).Returns(mockSet.Object); var service = new BusinessLogic(mockContext.Object); service.AddClient(new Client { FirstName = "Marusya", LastName = "Lazorenko", BankAccount = 12435 }); mockSet.Verify(m => m.Add(It.IsAny <Client>()), Times.Once()); mockContext.Verify(m => m.SaveChanges(), Times.Once()); }
public void addClient() { Console.Clear(); try { Console.WriteLine("Enter first name "); String fName = Console.ReadLine(); Console.WriteLine("Enter last name "); String lName = Console.ReadLine(); Console.WriteLine("Enter bank account "); int account = Convert.ToInt32(Console.ReadLine()); Client client = new Client { FirstName = fName, LastName = lName, BankAccount = account }; businessLogic.AddClient(client); } catch (Exception e) { Console.WriteLine(e.Message); Console.Write("Press Eneter key to continue.. "); Console.ReadLine(); } }