public Library.Models.CustomerModel GetCustomerById(int id) { var result = _dbContext.Customers.Where(x => x.CustomerId == id).First(); Library.Models.CustomerModel customer = new Library.Models.CustomerModel(result.FirstName, result.LastName, result.Phone, result.Email, result.Zip, result.CustomerId); Console.WriteLine($"\n\nCustomer ID: {customer.CustomerId}\nName: {customer.FirstName} {customer.LastName}\nPhone: {customer.Phone}\nEmail: {customer.Email}\nZip: {customer.Zip}"); return(customer); }
public void GetCustomerById() { // arrange var context = new SlithyTovesContext(); var repository = new Repository(context); var expected = new Library.Models.CustomerModel("Ashley", "Brown"); // act var actual = repository.GetCustomerById(1); // assert Assert.True(actual.CustomerId.Equals(expected.CustomerId)); }