public void FailsWhenDetailIsNull()
        {
            var svc = new AccountService(_accountRepositoryMock.Object);
            var result = svc.CreateApplication(null);

            Assert.IsFalse(result.Success);
            Assert.IsFalse(string.IsNullOrWhiteSpace(result.ErrorMessage));
        }
        public void ApplicationIsSavedToDBWhenDataIsValid()
        {
            var svc = new AccountService(_accountRepositoryMock.Object);
            var result = svc.CreateApplication(GetValidData());

            Assert.IsTrue(result.Success);
            _accountRepositoryMock.Verify(x => x.CreateApplication(It.IsAny<Application>()), Times.Once(), "Account not created");
        }
        public void FailsWhenAccountDoesntExist()
        {
            _accountRepositoryMock.Setup(x => x.GetAccountById(It.IsAny<string>())).Returns<Account>(null);

            var svc = new AccountService(_accountRepositoryMock.Object);
            var result = svc.CreateApplication(GetValidData());

            Assert.IsFalse(result.Success);
            Assert.IsFalse(string.IsNullOrWhiteSpace(result.ErrorMessage));
        }
        public void CreatesAccountWhenDataIsValid()
        {
            var svc = new AccountService(_accountRepositoryMock.Object);
            var result = svc.CreateApplication(GetValidData());

            Assert.IsTrue(result.Success);
            dynamic newAccount = result.Result;

            Assert.IsFalse(string.IsNullOrWhiteSpace(newAccount.PublicKey));
            Assert.IsFalse(string.IsNullOrWhiteSpace(newAccount.PrivateKey));
            Assert.IsFalse(string.IsNullOrWhiteSpace(newAccount.ApplicationId));
        }