Exemplo n.º 1
0
        /// <summary>
        /// Sets agenda logo. Existing logo will be replaced. Optimal size is 280 x 100 (96 DPI) or 900 x 300 (300 DPI). Max. file size is 5 MB.
        /// </summary>
        /// <param name="model">New logo.</param>
        /// <param name="cancellationToken">Cancellation token.</param>
        /// <returns>Agenda's logo.</returns>
        public async Task <ApiResult <bool> > UploadLogoAsync(LogoPostModel model, CancellationToken cancellationToken = default)
        {
            if (model is null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            var request = await _client.CreateRequestAsync(LogoUrl, Method.PUT, cancellationToken).ConfigureAwait(false);

            request.AddFile(model.FileName, model.FileBytes, model.FileName);
            request.AlwaysMultipartFormData = true;
            return(await _client.ExecuteAsync <bool>(request, cancellationToken).ConfigureAwait(false));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets agenda logo. Existing logo will be replaced. Optimal size is 280 x 100 (96 DPI) or 900 x 300 (300 DPI). Max. file size is 5 MB.
        /// </summary>
        /// <param name="model">New logo.</param>
        /// <returns><c>true</c>.</returns>
        public ApiResult <bool> UploadLogo(LogoPostModel model)
        {
            if (model is null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            var request = _client.CreateRequest(LogoUrl, Method.PUT);

            request.AddFile(model.FileName, model.FileBytes, model.FileName);
            request.AlwaysMultipartFormData = true;
            return(_client.Execute <bool>(request));
        }
Exemplo n.º 3
0
        public void LogoUpdate_SuccessfullyUpdated()
        {
            // Arrange
            var model = new LogoPostModel
            {
                FileBytes      = File.ReadAllBytes($"{TestContext.CurrentContext.TestDirectory}/{LogoPath}"),
                FileName       = LogoFileName,
                HighResolution = true
            };

            // Act
            var data = _accountClient.Agendas.UploadLogo(model).AssertResult();

            // Assert
            Assert.True(data);
        }