public async Task AddContactDetailsAsync_GivenAContactDetail_ShouldAddContactDetailToRepo() { //---------------Set up test pack------------------- var contact = CreateRandomContact(999999999); var db = new FakeContactDbContext(Guid.NewGuid().ToString()); var contactService = new ContactService(db.DbContext); await db.Add(contact); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var results = await contactService.AddContactDetailsAsync(contact.ContactDetails[0], contact.ContactId); //---------------Test Result ----------------------- var contactFromRepo = await contactService.GetByIdAsync(contact.ContactId); Assert.IsTrue(results); Assert.AreEqual(contactFromRepo.ContactDetails[0].ContactId, contact.ContactId); Assert.AreEqual(contactFromRepo.ContactDetails[0].Description, contact.ContactDetails[0].Description); Assert.AreEqual(contactFromRepo.ContactDetails[0].ContactTypeId, contact.ContactDetails[0].ContactTypeId); }
public void SetUp() { _db = new FakeContactDbContext(Guid.NewGuid().ToString()); }