Example #1
0
        public Task <DeviceLicenseResponseModel> GetDeviceLicenses(Guid customerUid, IHeaderDictionary customHeaders = null)
        {
            log.LogDebug($"{nameof(GetDeviceLicenses)} Mock: customerUid {customerUid}");

            var deviceLicenseResponseModel = new DeviceLicenseResponseModel
            {
                Total = 10
            };

            return(Task.FromResult(deviceLicenseResponseModel));
        }
Example #2
0
        public DeviceLicenseResponseModel GetDeviceLicenses(string accountTrn)
        {
            var deviceLicenseResponseModel = new DeviceLicenseResponseModel
            {
                Total = 10
            };

            Logger.LogInformation($"{nameof(GetDeviceLicenses)}: accountTrn {accountTrn}. deviceLicenseResponseModel {JsonConvert.SerializeObject(deviceLicenseResponseModel)}");

            return(deviceLicenseResponseModel);
        }
Example #3
0
        public void GetDeviceLicensesTest()
        {
            const string accountId = "trn::profilex:us-west-2:account:560c2a6c-6b7e-48d8-b1a5-e4009e2d4c97";

            var deviceLicensesModel = new DeviceLicenseResponseModel
            {
                Total = 57
            };
            var route       = $"/accounts/{accountId}/devicelicense";
            var expectedUrl = $"{baseUrl}{route}";

            mockServiceResolution.Setup(m => m.ResolveRemoteServiceEndpoint(
                                            It.IsAny <string>(), It.IsAny <ApiType>(), It.IsAny <ApiVersion>(), route, It.IsAny <IList <KeyValuePair <string, string> > >())).Returns(Task.FromResult(expectedUrl));

            MockUtilities.TestRequestSendsCorrectJson("Get Device Licenses", mockWebRequest, null, expectedUrl, HttpMethod.Get, deviceLicensesModel, async() =>
            {
                var client = ServiceProvider.GetRequiredService <ICwsAccountClient>();
                var result = await client.GetDeviceLicenses(TRNHelper.ExtractGuid(accountId).Value);

                Assert.NotNull(result);
                Assert.Equal(57, result.Total);
                return(true);
            });
        }