Esempio n. 1
0
        public async Task ItShouldReturnAViewAndModelOnSuccess()
        {
            var reponse = new AccountPayeSchemesResponse
            {
                Account = new Core.Models.Account
                {
                    AccountId      = 123,
                    DasAccountName = "Test Account",
                    DateRegistered = DateTime.Today,
                    OwnerEmail     = "*****@*****.**"
                },
                StatusCode = SearchResponseCodes.Success
            };
            var id = "123";

            AccountHandler.Setup(x => x.FindPayeSchemes(id)).ReturnsAsync(reponse);
            var actual = await Unit.PayeSchemes("123");

            Assert.IsNotNull(actual);
            Assert.IsNotNull(actual);
            Assert.IsInstanceOf <ViewResult>(actual);
            Assert.AreEqual("", ((ViewResult)actual).ViewName);
            Assert.IsInstanceOf <AccountDetailViewModel>(((ViewResult)actual).Model);
            Assert.AreEqual(reponse.Account, ((AccountDetailViewModel)((ViewResult)actual).Model).Account);
            Assert.IsNull(((AccountDetailViewModel)((ViewResult)actual).Model).SearchUrl);
        }
Esempio n. 2
0
        public async Task <AccountPayeSchemesResponse> FindPayeSchemes(string id)
        {
            var response = new AccountPayeSchemesResponse
            {
                StatusCode = SearchResponseCodes.NoSearchResultsFound
            };

            var record = await _accountRepository.Get(id, AccountFieldsSelection.PayeSchemes);

            if (record != null)
            {
                response.StatusCode = SearchResponseCodes.Success;
                response.Account    = record;
            }

            return(response);
        }
Esempio n. 3
0
        public async Task ItShouodReturnHttpNotFoundOnSearchFailed()
        {
            var reponse = new AccountPayeSchemesResponse
            {
                Account = new Core.Models.Account
                {
                    AccountId      = 123,
                    DasAccountName = "Test Account",
                    DateRegistered = DateTime.Today,
                    OwnerEmail     = "*****@*****.**"
                },
                StatusCode = SearchResponseCodes.SearchFailed
            };
            var id = "123";

            AccountHandler.Setup(x => x.FindPayeSchemes(id)).ReturnsAsync(reponse);
            var actual = await Unit.PayeSchemes("123");

            Assert.IsNotNull(actual);
            Assert.IsInstanceOf <HttpNotFoundResult>(actual);
        }