public async Task TestContactRepositoryThrowsExceptionShouldReturnErrorCode() { var interactor = new DeclineContactInteractor(new ExceptionContactRepository()); var response = await interactor.ExecuteAsync( new DeclineContactRequest { ContactChatAddress = new Address(Hash.Empty.Value), UserPublicKeyAddress = new Address(Hash.Empty.Value) }); Assert.AreEqual(ResponseCode.UnkownException, response.Code); }
public async Task TestDeclinedContactGetsAddedToRepository() { var contactRepository = new InMemoryContactRepository(); var interactor = new DeclineContactInteractor(contactRepository); var response = await interactor.ExecuteAsync( new DeclineContactRequest { ContactChatAddress = new Address(Hash.Empty.Value), UserPublicKeyAddress = new Address(Hash.Empty.Value) }); Assert.AreEqual(ResponseCode.Success, response.Code); Assert.AreEqual(Hash.Empty.Value, contactRepository.PersistedContacts[0].ChatAddress); Assert.AreEqual(Hash.Empty.Value, contactRepository.PersistedContacts[0].PublicKeyAddress); Assert.IsTrue(contactRepository.PersistedContacts[0].Rejected); }