/// <summary>
        /// Get the list of children Items for the Parent.
        /// </summary>
        /// <param name="parentID"></param>
        private static void GetListItems(string parentID)
        {
            //GET the RepositoryInfo
            var configuration = GetClientConfig();
            var instance      = new RepositoryApi(configuration);
            var response      = instance.ApiV1RepositoryInfoGet();
            //GET the Sets
            var  instanceSets = new SetApi(configuration);
            Guid guid         = new Guid(parentID);
            var  responseSets = instanceSets.ApiV1SetByAgencyByIdByVersionGet("int.example", guid, 1);

            //GET the list of GUID
            GetLatestItemsRequest request = new GetLatestItemsRequest
            {
                Identifiers = new List <IdentifierInRequest>()
            };

            foreach (IdentifierTriple itemTriple in responseSets)
            {
                request.Identifiers.Add(new IdentifierInRequest(itemTriple.Item3, itemTriple.Item1, itemTriple.Item2));
            }
            var instanceList = new ItemApi(configuration);
            var responseList = instanceList.ApiV1ItemGetListLatestPost(request);

            foreach (RepositoryItem item in responseList)
            {
                if (item != null)
                {
                    Console.WriteLine(item.ToJson());
                }
            }
        }
Esempio n. 2
0
        public void CallApiPartV2()
        {
            SetApi setApi = new SetApi();
            var    result = setApi.LireParts("42105-1", 404);

            Assert.True(result.Count > 0);
        }
Esempio n. 3
0
        public void CallApiSetV3()
        {
            SetApi setApi = new SetApi();
            var    result = setApi.LireSet("42101-1");

            Assert.True(result.Name == "Buggy");
        }
Esempio n. 4
0
        public void SetUp()
        {
            setService = Substitute.For <ISetService>();
            dbContext  = DbContextUtility.CreateMockDb();
            var logger = Substitute.For <ILogger <SetApi> >();

            testObj = new SetApi(logger, dbContext, setService);
        }
Esempio n. 5
0
        public void CallApiPartV4()
        {
            SetApi setApi = new SetApi();
            var    result = setApi.LireParts("42064-1", 182);

            Assert.True(result.Count == 182);
            Assert.True(result.Sum(x => x.Quantity) == 1358);
        }
Esempio n. 6
0
        public void CallApiSetV2()
        {
            SetApi setApi = new SetApi();
            var    result = setApi.LireSets(2020);

            Assert.True(result.Count > 0);
            Assert.True(result.Count(x => x.ThemeId == 1) > 0);
        }
        /// <summary>
        /// Get the list of children Items for the parentID for a specific agency
        /// and a specific type with a limit of objects returned.
        /// </summary>
        /// <param name="agency"></param>
        /// <param name="parentID"></param>
        /// <param name="itemType"></param>
        /// <param name="limitMax"></param>
        private static void GetListItems(string agency, string parentID, string itemType, long limitMax)
        {
            //Converting string parameter to GUID
            Guid itemTypeGuid = new Guid(itemType);

            //GET the RepositoryInfo
            var configuration = GetClientConfig();
            var instance      = new RepositoryApi(configuration);
            var response      = instance.ApiV1RepositoryInfoGet();

            //GET the Sets
            var  instanceSets = new SetApi(configuration);
            Guid guid         = new Guid(parentID);
            var  responseSets = instanceSets.ApiV1SetByAgencyByIdByVersionGet("int.example", guid, 1);

            //GET the list of GUID
            GetLatestItemsRequest request = new GetLatestItemsRequest
            {
                Identifiers = new List <IdentifierInRequest>()
            };

            foreach (IdentifierTriple itemTriple in responseSets)
            {
                request.Identifiers.Add(new IdentifierInRequest(itemTriple.Item3, itemTriple.Item1, itemTriple.Item2));
            }
            var  instanceList = new ItemApi(configuration);
            var  responseList = instanceList.ApiV1ItemGetListLatestPost(request);
            long countdown    = 0L;

            foreach (RepositoryItem item in responseList)
            {
                if (countdown <= limitMax)
                {
                    if (item != null && item.ItemType == itemTypeGuid && item.AgencyId == agency)
                    {
                        Console.WriteLine(item.ToJson());
                    }
                }
                countdown++;
            }
        }