public void Given_RetrieveContactsFromDatabase_ShouldReturnTrue() { /// Arrange AddressBookRepository repository = new AddressBookRepository(); /// Act bool result = repository.RetrieveFromDatabase(); /// Assert Assert.AreEqual(result, true); }
public void InsertMultipleContacts() { ///Arrange AddressBookRepository addressBookRepository = new AddressBookRepository(); List <ContactDetails> contactsList = new List <ContactDetails>(); contactsList.Add(new ContactDetails { FirstName = "Manish", LastName = "Pandey", PhoneNumber = "2344746584", Email = "mani.com", Area = "maruti colony", City = "Warangal", State = "AndhraPradesh", Country = "India", AddressBookName = "My Book", ContactType = "Friend" }); contactsList.Add(new ContactDetails { FirstName = "Vijay", LastName = "Sankar", PhoneNumber = "2344734597", Email = "vij.com", Area = "Vijaya colony", City = "Khammam", State = "AndhraPradesh", Country = "India", AddressBookName = "Mukhesh", ContactType = "Friend" }); contactsList.Add(new ContactDetails { FirstName = "Rashid", LastName = "Khan", PhoneNumber = "4562746584", Email = "khan.com", Area = "Happy colony", City = "Banglore", State = "Karnataka", Country = "India", AddressBookName = "My Book", ContactType = "Family" }); // Act addressBookRepository.InsertMultipleContactsWithThreads(contactsList); List <ContactDetails> actual = addressBookRepository.GetAddressBookDetails().FindAll(contact => (contact.FirstName == "Manish" && contact.LastName == "Pandey") || (contact.FirstName == "Vijay" && contact.LastName == "Sankar") || (contact.FirstName == "Rashid" && contact.LastName == "Khan")); ///Assert CollectionAssert.AreEqual(actual, contactsList); }
public Form1() { InitializeComponent(); // btnAdd.Enabled = false; btnDelete.Enabled = false; btnUpdate.Enabled = false; // listView1.DisplayMember = "Name"; a = new AddressBook(); abr = new AddressBookRepository(); list(); }
public void Given_WrongFirstAndLastName_Should_ReturnFalse() { /// Arrange string firstName = "Kunal"; string lastName = "P"; string phoneNo = "9858647525"; AddressBookRepository repository = new AddressBookRepository(); /// Act bool result = repository.UpdateContact(firstName, lastName, phoneNo); /// Assert Assert.AreEqual(result, false); }
public override Person GetPersonByID(int personID) { try { return((from person in AddressBookRepository.RetrieveAllPersons() where person.ID == personID select person).SingleOrDefault()); } catch (Exception e) { throw new AddressBookBusinessException(e); } }
public override IEnumerable <Person> FindPersonByName(string personName) { try { return(from person in AddressBookRepository.RetrieveAllPersons() where person.FullName.StartsWith(personName, StringComparison.InvariantCultureIgnoreCase) select person); } catch (Exception e) { throw new AddressBookBusinessException(e); } }
public override Person FindOldest() { try { return((from person in AddressBookRepository.RetrieveAllPersons() orderby person.BirthDate ascending select person).FirstOrDefault()); } catch (Exception e) { throw new AddressBookBusinessException(e); } }
public override uint CountGenders(Gender gender) { try { return((uint)(from person in AddressBookRepository.RetrieveAllPersons() where person.Gender == gender select person).Count()); } catch (Exception e) { throw new AddressBookBusinessException(e); } }
public void AddMultipleContacts_UsingThread() { List <Contact> contacts = new List <Contact>(); contacts.Add(new Contact { FirstName = "Mukesh", LastName = "Maurya", Address = "Vasai", ZipCode = "400125", City = "Thane", State = "Maharashtra", PhoneNo = "8547861020", Email = "*****@*****.**", Type = "Profession", Date = new System.DateTime(2018 - 08 - 12) }); contacts.Add(new Contact { FirstName = "Sagar", LastName = "Verma", Address = "RK naagr", ZipCode = "210320", City = "Jaipur", State = "Rajasthan", PhoneNo = "7452015302", Email = "*****@*****.**", Type = "Friend", Date = new System.DateTime(2019 - 10 - 11) }); AddressBookRepository addressBook = new AddressBookRepository(); DateTime startTime = DateTime.Now; addressBook.AddMultipleContactsWithThread(contacts); DateTime endTime = DateTime.Now; Console.WriteLine("Total time for execution of thread :" + (endTime - startTime)); }
public CitiesController(AddressBookRepository repository, LinkGenerator linkGenerator, IMapper mapper) { this.repository = repository; this.linkGenerator = linkGenerator; this.mapper = mapper; }