public void GetState_Valid()
        {
            #region ASSIGN

            StateRepo          testRepo       = new StateRepo();
            StateApiController testController = new StateApiController(testRepo);

            #endregion

            #region ACT

            var taskReturn = testController.GetState(1);
            taskReturn.Wait();
            var result = taskReturn.Result.Value;

            State testData = result;

            #endregion

            #region ASSERT

            Assert.AreEqual(testData.ID, 1);
            Assert.AreEqual(testData.Name, "Alaska");
            Assert.AreEqual(testData.Abbreviation, "AK");

            #endregion
        }
        public void GetStateAbbreviation_InvalidID()
        {
            #region ASSIGN

            StateRepo          testRepo       = new StateRepo();
            StateApiController testController = new StateApiController(testRepo);

            #endregion

            #region ACT

            var taskReturn = testController.GetStateAbbrevation(4);
            taskReturn.Wait();
            var result = taskReturn.Result.Value;

            string testData = result;

            #endregion

            #region ASSERT

            Assert.AreNotEqual(testData, "AK");

            #endregion
        }
        public void GetStateName_Valid()
        {
            #region ASSIGN

            StateRepo          testRepo       = new StateRepo();
            StateApiController testController = new StateApiController(testRepo);

            #endregion

            #region ACT

            var taskReturn = testController.GetStateName(1);
            taskReturn.Wait();
            var result = taskReturn.Result.Value;

            string testData = result;

            #endregion

            #region ASSERT

            Assert.AreEqual(testData, "Alaska");

            #endregion
        }
Example #4
0
        public async Task GivenTomSelectsTheFollowingStatesAsync(Table table)
        {
            var zoneStates = table.CreateSet <ZoneState>();
            var allStates  = await StateRepo.GetAllStatesAsync();

            var countries = _taxRateRequest.Zone.Countries;

            foreach (var zoneCountry in countries)
            {
                var stateNames = zoneStates
                                 .Where(x => x.CountryCode == zoneCountry.CountryCode)
                                 .Select(x => x.Name);

                var states = allStates.Where(x => stateNames.Contains(x.Name));
                zoneCountry.States = states;
            }
        }
        public void GetStates()
        {
            #region ASSIGN

            StateRepo          testRepo       = new StateRepo();
            StateApiController testController = new StateApiController(testRepo);

            #endregion

            #region ACT

            var taskReturn = testController.GetStates();
            taskReturn.Wait();
            var result = taskReturn.Result.Value;

            List <State> testList = new List <State>(result);

            #endregion

            #region ASSERT

            Assert.AreEqual(testList.Count, 4);

            Assert.AreEqual(testList[0].ID, 1);
            Assert.AreEqual(testList[0].Name, "Alaska");
            Assert.AreEqual(testList[0].Abbreviation, "AK");

            Assert.AreEqual(testList[1].ID, 2);
            Assert.AreEqual(testList[1].Name, "Virgina");
            Assert.AreEqual(testList[1].Abbreviation, "VA");

            Assert.AreEqual(testList[2].ID, 3);
            Assert.AreEqual(testList[2].Name, "Florida");
            Assert.AreEqual(testList[2].Abbreviation, "FL");

            Assert.AreEqual(testList[3].ID, 4);
            Assert.AreEqual(testList[3].Name, "Texas");
            Assert.AreEqual(testList[3].Abbreviation, "TX");

            #endregion
        }
        public void GetStates_EmptyDataSet()
        {
            #region ASSIGN

            StateRepo          testRepo       = new StateRepo(false);
            StateApiController testController = new StateApiController(testRepo);

            #endregion

            #region ACT

            var taskReturn = testController.GetStates();
            taskReturn.Wait();
            var result = taskReturn.Result.Result;

            #endregion

            #region ASSERT

            Assert.IsTrue(result is NotFoundResult);
            Assert.AreEqual((result as NotFoundResult).StatusCode, 404);

            #endregion
        }
        public void GetStateAbbreviation_NonExistingID()
        {
            #region ASSIGN

            StateRepo          testRepo       = new StateRepo();
            StateApiController testController = new StateApiController(testRepo);

            #endregion

            #region ACT

            var taskReturn = testController.GetStateAbbrevation(0);
            taskReturn.Wait();
            var result = taskReturn.Result.Result;

            #endregion

            #region ASSERT

            Assert.IsTrue(result is NotFoundResult);
            Assert.AreEqual((result as NotFoundResult).StatusCode, 404);

            #endregion
        }
Example #8
0
 public StateController()
 {
     _sRepo = new StateRepo();
 }
Example #9
0
 public StateManager()
 {
     _stateRepo   = new StateRepo();
     _countryRepo = new CountryRepo();
 }
Example #10
0
 public CityManager()
 {
     _cityRepo    = new CityRepo();
     _stateRepo   = new StateRepo();
     _countryRepo = new CountryRepo();
 }
Example #11
0
 public StateManager()
 {
     _StateRepo = new StateRepo();
 }