Пример #1
0
        public void WhenDeleteProductByTypeName_ThenCheckResponse()
        {
            // Arrange
            using (SimpleServer.Create(TestHelpers.BaseUrl, LibraryRequestHandler))
            {
                var client  = new YouScribeClient(TestHelpers.BaseUrl);
                var request = client.CreateLibraryRequest();

                // Act
                var ok = request.DeleteProductAsync("MyDownloads", 10).Result;
                // Assert
                Assert.True(ok);
            }
        }
Пример #2
0
        public void WhenAddProductWithLibId_ThenCheckResponse()
        {
            // Arrange
            using (SimpleServer.Create(TestHelpers.BaseUrl, LibraryRequestHandler))
            {
                var client  = new YouScribeClient(TestHelpers.BaseUrl);
                var request = client.CreateLibraryRequest();

                // Act
                var ok = request.AddProductAsync(1, 10, true).Result;

                // Assert
                Assert.True(ok);
            }
        }
Пример #3
0
        public void WhenAddProductWithLibId_ThenCheckResponse()
        {
            // Arrange
            using (SimpleServer.Create(TestHelpers.BaseUrl, LibraryRequestHandler))
            {
                var client = new YouScribeClient(TestHelpers.BaseUrl);
                var request = client.CreateLibraryRequest();

                // Act
                var ok = request.AddProductAsync(1, 10, true).Result;

                // Assert
                Assert.True(ok);
            }
        }
Пример #4
0
        public void WhenGetLibraries_ThenCheckResponse()
        {
            // Arrange
            using (SimpleServer.Create(TestHelpers.BaseUrl, LibraryRequestHandler))
            {
                var client  = new YouScribeClient(TestHelpers.BaseUrl);
                var request = client.CreateLibraryRequest();

                // Act
                var libraries = request.GetAsync().Result;

                // Assert
                Assert.NotEmpty(libraries);
                Assert.Equal(3, libraries.Count());
            }
        }
Пример #5
0
        public void WhenGetLibraryByTypeName_ThenCheckResponse()
        {
            // Arrange
            using (SimpleServer.Create(TestHelpers.BaseUrl, LibraryRequestHandler))
            {
                var client  = new YouScribeClient(TestHelpers.BaseUrl);
                var request = client.CreateLibraryRequest();

                // Act
                var library = request.GetAsync("MyDownloads").Result;

                // Assert
                Assert.NotNull(library);
                Assert.Equal("MyDownloads", library.TypeName);
            }
        }
Пример #6
0
        public void WhenGetByProductId_ThenCheckResponse()
        {
            // Arrange
            using (SimpleServer.Create(TestHelpers.BaseUrl, LibraryRequestHandler))
            {
                var client  = new YouScribeClient(TestHelpers.BaseUrl);
                var request = client.CreateLibraryRequest();

                // Act
                var data = request.GetByProductIdAsync(1).Result;

                // Assert
                Assert.NotEmpty(data);
                Assert.Equal(123, data.FirstOrDefault());
                Assert.Equal(456, data.LastOrDefault());
            }
        }
Пример #7
0
        public void WhenGetLibrary_ThenCheckResponse()
        {
            // Arrange
            using (SimpleServer.Create(TestHelpers.BaseUrl, LibraryRequestHandler))
            {
                var client = new YouScribeClient(TestHelpers.BaseUrl);
                var request = client.CreateLibraryRequest();

                int id = 1;

                // Act
                var library = request.GetAsync(id).Result;

                // Assert
                Assert.NotNull(library);
                Assert.Equal("MyDownloads", library.TypeName);
            }
        }
Пример #8
0
        public void WhenGetLibraries_ThenCheckResponse()
        {
            // Arrange
            using (SimpleServer.Create(TestHelpers.BaseUrl, LibraryRequestHandler))
            {
                var client = new YouScribeClient(TestHelpers.BaseUrl);
                var request = client.CreateLibraryRequest();

                // Act
                var libraries = request.GetAsync().Result;

                // Assert
                Assert.NotEmpty(libraries);
                Assert.Equal(3, libraries.Count());
            }
        }
Пример #9
0
        public void WhenGetByProductId_ThenCheckResponse()
        {
            // Arrange
            using (SimpleServer.Create(TestHelpers.BaseUrl, LibraryRequestHandler))
            {
                var client = new YouScribeClient(TestHelpers.BaseUrl);
                var request = client.CreateLibraryRequest();

                // Act
                var data = request.GetByProductIdAsync(1).Result;

                // Assert
                Assert.NotEmpty(data);
                Assert.Equal(123, data.FirstOrDefault());
                Assert.Equal(456, data.LastOrDefault());
            }
        }
Пример #10
0
        public void WhenDeleteProductByTypeName_ThenCheckResponse()
        {
            // Arrange
            using (SimpleServer.Create(TestHelpers.BaseUrl, LibraryRequestHandler))
            {
                var client = new YouScribeClient(TestHelpers.BaseUrl);
                var request = client.CreateLibraryRequest();

                // Act
                var ok = request.DeleteProductAsync("MyDownloads", 10).Result;
                // Assert
                Assert.True(ok);
            }
        }