Exemple #1
0
        public async Task ShouldCreateBasicShareWithWrongContentsAndFail()
        {
            /// Arrange
            var outputFormatIds = new List <string>()
            {
                "Original"
            };

            var shareContentItems = new List <ShareContent>()
            {
                new ShareContent()
                {
                    ContentId = "NonExistingId1", OutputFormatIds = outputFormatIds
                },
                new ShareContent()
                {
                    ContentId = "NonExistingId2", OutputFormatIds = outputFormatIds
                }
            };

            var request = new ShareBasicCreateRequest()
            {
                Contents        = shareContentItems,
                Description     = "Description of share with wrong content ids",
                ExpirationDate  = new DateTime(2020, 12, 31),
                Name            = "Share with wrong content ids",
                RecipientsEmail = new List <UserEmail>()
                {
                    _fixture.Configuration.EmailRecipient
                }
            };

            /// Act and Assert
            await Assert.ThrowsAsync <ContentNotFoundException>(async() =>
            {
                var result = await _client.Shares.CreateAsync(request);
            });
        }
Exemple #2
0
        public async Task ShouldCreateBasicShare()
        {
            /// Arrange
            var outputFormatIds = new List <string>()
            {
                "Original"
            };

            var shareContentItems = new List <ShareContent>()
            {
                new ShareContent()
                {
                    ContentId = await _fixture.GetRandomContentIdAsync(string.Empty, 30), OutputFormatIds = outputFormatIds
                },
                new ShareContent()
                {
                    ContentId = await _fixture.GetRandomContentIdAsync(string.Empty, 30), OutputFormatIds = outputFormatIds
                }
            };

            var request = new ShareBasicCreateRequest()
            {
                Contents        = shareContentItems,
                Description     = "Description of Basic share aaa",
                ExpirationDate  = new DateTime(2020, 12, 31),
                Name            = "Basic share aaa",
                RecipientsEmail = new List <UserEmail>()
                {
                    _fixture.Configuration.EmailRecipient
                }
            };

            /// Act
            var result = await _client.Shares.CreateAsync(request);

            /// Assert
            Assert.NotNull(result);
        }