Exemple #1
0
        public void GetPierClaimLocation_AreEqual()
        {
            //Arrange
            var SystemUnderTest = new RestService();
            var dependency      = new GetPierClaimLocationInput()
            {
                AppName = "Admin User", Username = "******", DeviceName = "Apple", Station = "123", Version = "1"
            };

            var expected             = new GetPierClaimLocationResponse();
            PierClaimLocations main1 = new PierClaimLocations();

            main1.Name         = "Pier";
            main1.SubLocations = new string[] { "Pier 1", "Pier 2", "Pier 3" };
            PierClaimLocations main2 = new PierClaimLocations();

            main2.Name         = "DCI Bullpen";
            main2.SubLocations = new string[] { };
            PierClaimLocations main3 = new PierClaimLocations();

            main3.Name             = "Arrivals";
            main3.SubLocations     = new string[] { "DL Arvl", "OA Arvl", "AS Arvl" };
            expected.MainLocations = new PierClaimLocations[] { main1, main2, main3 };
            expected.StatusCode    = "0";


            //Act
            var actual = SystemUnderTest.GetPierClaimLocation(dependency);

            //Assert
            Assert.AreEqual(expected.StatusCode, actual.StatusCode);
        }
        public GetPierClaimLocationResponse GetPierClaimLocation(GetPierClaimLocationInput input)
        {
            //logger.Trace("Service : IRestService, Method : GetPierClaimLocation, Request : GetPierClaimLocationInput = {"Appname":user.Name,"Username" : user.Username, "DeviceName" : "Apple", "Station" : "123", "Version" : "1" };")
            GetPierClaimLocationResponse getPierClaimLocationResponse = new GetPierClaimLocationResponse();
            PierClaimLocations           main1 = new PierClaimLocations();

            main1.Name         = "Pier";
            main1.SubLocations = new string[] { "Pier 1", "Pier 2", "Pier 3" };
            PierClaimLocations main2 = new PierClaimLocations();

            main2.Name         = "DCI Bullpen";
            main2.SubLocations = new string[] { };
            PierClaimLocations main3 = new PierClaimLocations();

            main3.Name         = "Arrivals";
            main3.SubLocations = new string[] { "DL Arvl", "OA Arvl", "AS Arvl" };

            getPierClaimLocationResponse.MainLocations = new PierClaimLocations[] { main1, main2, main3 };
            getPierClaimLocationResponse.ReturnCode    = "1";
            //logger.Trace("Service : IRestService , Method : GetPierClaimLocation , Response : GetPierClaimLocationResponse = {"MainLocation":PierResponse.MainLocation, "ReturnCode":PierResponse.ReturnCode,"Message":PierResponse.Message};
            return(getPierClaimLocationResponse);
        }
        public GetPierClaimLocationResponse GetPierClaimLocation(GetPierClaimLocationInput input)
        {
            logger.Trace("Service : IRestService, Method : GetPierClaimLocation, Request : GetPierClaimLocationInput = {'Appname':user.Name,'Username' : user.Username, 'DeviceName' : 'Apple', 'Station' : '123', 'Version' : '1' }");
            GetPierClaimLocationResponse getPierClaimLocationResponse = new GetPierClaimLocationResponse();
            PierClaimLocations           main1 = new PierClaimLocations();

            main1.Name         = "Pier";
            main1.SubLocations = new string[] { "Pier 1", "Pier 2", "Pier 3" };
            PierClaimLocations main2 = new PierClaimLocations();

            main2.Name         = "DCI Bullpen";
            main2.SubLocations = new string[] { };
            PierClaimLocations main3 = new PierClaimLocations();

            main3.Name         = "Arrivals";
            main3.SubLocations = new string[] { "DL Arvl", "OA Arvl", "AS Arvl" };

            getPierClaimLocationResponse.MainLocations = new PierClaimLocations[] { main1, main2, main3 };
            getPierClaimLocationResponse.StatusCode    = "0";
            logger.Trace("Service : IRestService , Method : GetPierClaimLocation , Response : GetPierClaimLocationResponse = {'MainLocation':PierResponse.MainLocation, 'ReturnCode':PierResponse.ReturnCode,'Message':PierResponse.Message}");

            return(getPierClaimLocationResponse);
        }
        public async void InitializeList()
        {
            try
            {
                //logger.Trace("SqliteService<UserModel> : LoadUser")
                ISqliteService <UserModel> userRepo = new SqliteService <UserModel>();
                var user = await userRepo.Load();

                GetPierClaimLocationInput pierInput = new GetPierClaimLocationInput()
                {
                    AppName = user.Name, Username = user.Username, DeviceName = "Apple", Station = "123", Version = "1"
                };
                if (Mvx.Resolve <IValidation>().ObjectIsNotNull(pierInput))
                {
                    PierResponse = Mvx.Resolve <IRestService>().GetPierClaimLocation(pierInput);
                }
            }
            catch (Exception)
            {
                Mvx.Resolve <IUserDialogs>().Toast("An error occurred!", null);
                //logger.Log(LogLevel.Info,e.ToString);
            }
        }
        public async void InitializeList()
        {
            try
            {
                PageLocationTitle = "Please select a " + pierClaimFlag + " location";
                _logger.Trace("Service: SqliteService<UserModel> Method: LoadUser");
                ISqliteService <UserModel> userRepo = new SqliteService <UserModel>();
                var user = await userRepo.Load();

                GetPierClaimLocationInput pierInput = new GetPierClaimLocationInput()
                {
                    AppName = user.Name, Username = user.Username, DeviceName = "Apple", Station = "123", Version = "1"
                };
                if (Mvx.Resolve <IValidation>().ObjectIsNotNull(pierInput))
                {
                    PierResponse = Mvx.Resolve <IRestService>().GetPierClaimLocation(pierInput);
                }
            }
            catch (Exception e)
            {
                Mvx.Resolve <IUserDialogs>().Toast("An error occurred!", null);
                _logger.Trace("SqliteService<UserModel> Method: LoadUser ex: " + e.ToString() + "");
            }
        }