예제 #1
0
        public async Task TestChatPasCannotBeCreatedShouldReturnErrorCode()
        {
            var interactor = new AcceptContactInteractor(new InMemoryContactRepository(), new InMemoryMessenger());
            var response   = await interactor.ExecuteAsync(new AcceptContactRequest
            {
                ChatKeyAddress          = new Address(Hash.Empty.Value),
                ChatAddress             = new Address(Hash.Empty.Value),
                ContactPublicKeyAddress = new Address(Hash.Empty.Value),
                ContactAddress          = new Address(Hash.Empty.Value),
                UserImageHash           = string.Empty,
                UserPublicKeyAddress    = new Address(Hash.Empty.Value),
                UserName    = string.Empty,
                UserKeyPair = InMemoryContactRepository.NtruKeyPair
            });

            Assert.AreEqual(ResponseCode.ChatPasswordAndSaltCannotBeGenerated, response.Code);
        }
        public async Task TestChatPasCanBeCreatedShouldPersistContactAndSendInformation()
        {
            Assert.Inconclusive("TODO: To be tested the crypto module needs to be separated from interactor.");
            var inMemoryMessenger = new InMemoryMessenger();

            inMemoryMessenger.SentMessages.Add(new Message(new TryteString(""), new Address(Hash.Empty.Value)));

            var interactor = new AcceptContactInteractor(new InMemoryContactRepository(), inMemoryMessenger, new EncryptionStub());
            var response   = await interactor.ExecuteAsync(new AcceptContactRequest
            {
                ChatKeyAddress          = new Address(Hash.Empty.Value),
                ChatAddress             = new Address(Hash.Empty.Value),
                ContactPublicKeyAddress = new Address(Hash.Empty.Value),
                ContactAddress          = new Address(Hash.Empty.Value),
                UserImagePath           = string.Empty,
                UserPublicKeyAddress    = new Address(Hash.Empty.Value),
                UserName    = string.Empty,
                UserKeyPair = InMemoryContactRepository.NtruKeyPair
            });

            Assert.AreEqual(ResponseCode.Success, response.Code);
        }