当前位置: 首页>>代码示例>>C#>>正文


C# TestHelper类代码示例

本文整理汇总了C#中TestHelper的典型用法代码示例。如果您正苦于以下问题:C# TestHelper类的具体用法?C# TestHelper怎么用?C# TestHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TestHelper类属于命名空间,在下文中一共展示了TestHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Should_get_200_OK_or_204_No_Content_when_item_exists

        public void Should_get_200_OK_or_204_No_Content_when_item_exists()
        {
            using (var testHelper = new TestHelper(authToken, storageUrl))
            {
                try
                {
                    testHelper.PutItemInContainer(Constants.HeadStorageItemName);
                    testHelper.AddMetadataToItem(Constants.HeadStorageItemName);

                    var getStorageItemInformation = new GetStorageItemInformation(storageUrl, Constants.CONTAINER_NAME, Constants.HeadStorageItemName);
                    var getStorageItemInformationResponse = new GenerateRequestByType().Submit(
                        getStorageItemInformation, authToken);
                    Assert.That(getStorageItemInformationResponse.Status == HttpStatusCode.OK
                        || getStorageItemInformationResponse.Status == HttpStatusCode.NoContent, Is.True);

                    var metadata = getStorageItemInformationResponse.Metadata;
                    Assert.That(metadata["Test"], Is.EqualTo("test"));
                    Assert.That(metadata["Test2"], Is.EqualTo("test2"));
                }
                finally
                {
                    testHelper.DeleteItemFromContainer(Constants.HeadStorageItemName);
                }
            }
        }
开发者ID:andrewbrodie,项目名称:csharp-cloudfiles,代码行数:25,代码来源:GetStorageItemInformationSpecs.cs

示例2: SetUpDataBinding

 public void SetUpDataBinding()
 {
     //temporary lines, this lines should be another place
     TestHelper th = new TestHelper();
     control1.CreateRootNode(th.GetTestDescriptor);
     control1.CreateTreeNodes(th.GetTestBinding);
 }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:7,代码来源:Form1.cs

示例3: Should_fail_when_an_invalid_paramter_is_passed

        public void Should_fail_when_an_invalid_paramter_is_passed()
        {
            using (TestHelper testHelper = new TestHelper(authToken, storageUrl))
            {
                for (int i = 0; i < 12; ++i)
                    testHelper.PutItemInContainer(Constants.StorageItemName, i.ToString());

                try
                {
                    Dictionary<GetItemListParameters, string> parameters =
                        new Dictionary<GetItemListParameters, string> {{(GetItemListParameters) int.MaxValue, "2"}};

                    new GetContainerItemList(storageUrl, Constants.CONTAINER_NAME, parameters);
                }
                catch (NotImplementedException ne)
                {
                    Assert.That(ne, Is.TypeOf(typeof (NotImplementedException)));
                }
                finally
                {
                    for (int i = 0; i < 12; ++i)
                        testHelper.DeleteItemFromContainer(i.ToString());
                }
            }
        }
开发者ID:nzeyimana,项目名称:csharp-cloudfiles,代码行数:25,代码来源:GetContainerItemListSpecs.cs

示例4: SetUpDataBinding

 public void SetUpDataBinding()
 {
     //temporary lines, this lines should be another place
     TestHelper th = new TestHelper();
     control1.CreateRootNode(th.GetTestDescriptor);
     control1.CreateTreeNodes(th.GetTestBinding);
     control1.ControllerView.AfterSelect += FillInfoListBox;
 }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:8,代码来源:Form1.cs

示例5: SetupTestingAssists

        public void SetupTestingAssists()
        {
            _testHelper = new TestHelper();

            var parameterNames = MethodInfoExtensions.GetMethodInfo<IProxyFactory>(x => x.CreateVersioning<object>(null, null, null))
                                                     .GetParameters()
                                                     .Select(param => param.Name);
            parameterNames.Should().Contain(new[] { ExistingControllerArgumentName, ExistingObjectArgumentName });
        }
开发者ID:Groostav,项目名称:VersionCommander,代码行数:9,代码来源:PropertyVersionControllerFixture.cs

示例6: CreateDummyfiles

        public void CreateDummyfiles()
        {
            _testHelper = new TestHelper(DefaultTestfileFolderPath);

            if (Directory.Exists(DummyImportFolderPath)) Directory.Delete(DummyImportFolderPath, true);
            if (Directory.Exists(DummyExportFolderPath)) Directory.Delete(DummyExportFolderPath, true);
            Directory.CreateDirectory(DummyImportFolderPath);
            File.WriteAllText(DummyImportFolderPath + "/a", "bli");
            File.WriteAllText(DummyImportFolderPath + "/b", "bla");
            File.WriteAllText(DummyImportFolderPath + "/c", "blub");
        }
开发者ID:RainsSoft,项目名称:VFSPrototype,代码行数:11,代码来源:FileSystemManipulatorCallbacksTest.cs

示例7: Should_return_created_when_a_stream_is_passed_instead_of_a_file_name

 public void Should_return_created_when_a_stream_is_passed_instead_of_a_file_name()
 {
     using (var testHelper = new TestHelper(authToken, storageUrl))
     {
         var fs = new FileStream(Constants.StorageItemName, FileMode.Open, FileAccess.Read);
         var putStorageItem = new PutStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName, fs, null);
         var response = new GenerateRequestByType().Submit(putStorageItem, authToken);
         fs.Close();
         Assert.That(response.Status, Is.EqualTo(HttpStatusCode.Created));
         testHelper.DeleteItemFromContainer();
     }
 }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:12,代码来源:PutStorageItemSpecs.cs

示例8: Should_return_created_when_etag_is_not_supplied_because_it_is_optional

        public void Should_return_created_when_etag_is_not_supplied_because_it_is_optional()
        {
            using (TestHelper testHelper = new TestHelper(authToken, storageUrl))
            {
                var putStorageItem = new PutStorageItem(storageUrl, authToken, Constants.CONTAINER_NAME, Constants.StorageItemName, Constants.StorageItemName);
                putStorageItem.Headers.Remove("ETag");

                var response = new ResponseFactory<CloudFilesResponse>().Create(new CloudFilesRequest(putStorageItem));
                Assert.That(response.Status, Is.EqualTo(HttpStatusCode.Created));
                testHelper.DeleteItemFromContainer();
            }
        }
开发者ID:jzhu2009,项目名称:csharp-cloudfiles,代码行数:12,代码来源:PutStorageItemSpecs.cs

示例9: should_return_204_no_content_when_the_item_exists

        public void should_return_204_no_content_when_the_item_exists()
        {
            using (TestHelper testHelper = new TestHelper(authToken, storageUrl))
            {
                testHelper.PutItemInContainer();

                var deleteStorageItem = new DeleteStorageItem(storageUrl, authToken, Constants.CONTAINER_NAME, Constants.StorageItemName);
                var response = new ResponseFactory<CloudFilesResponse>().Create(new CloudFilesRequest(deleteStorageItem));

                Assert.That(response.Status, Is.EqualTo(HttpStatusCode.NoContent));
                Assert.That(response.Headers["Content-Type"].Contains("text/plain"), Is.True);
            }
        }
开发者ID:jzhu2009,项目名称:csharp-cloudfiles,代码行数:13,代码来源:DeleteContainerItemSpecs.cs

示例10: Should_return_created_as_status_when_the_file_does_not_already_exist

        public void Should_return_created_as_status_when_the_file_does_not_already_exist()
        {
            using (TestHelper testHelper = new TestHelper(authToken, storageUrl))
            {
                var putStorageItem = new PutStorageItem(storageUrl, authToken, Constants.CONTAINER_NAME, Constants.StorageItemName, Constants.StorageItemName);

                Assert.That(putStorageItem.ContentLength, Is.EqualTo(34));

                var response = new ResponseFactory<CloudFilesResponse>().Create(new CloudFilesRequest(putStorageItem));
                Assert.That(response.Status, Is.EqualTo(HttpStatusCode.Created));
                Assert.That(response.Headers[Constants.ETAG], Is.EqualTo(putStorageItem.ETag));
                testHelper.DeleteItemFromContainer();
            }
        }
开发者ID:jzhu2009,项目名称:csharp-cloudfiles,代码行数:14,代码来源:PutStorageItemSpecs.cs

示例11: Should_return_created_as_status_when_the_file_does_not_already_exist

        public void Should_return_created_as_status_when_the_file_does_not_already_exist()
        {
            using (var testHelper = new TestHelper(authToken, storageUrl))
            {
                var putStorageItem = new PutStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName, Constants.StorageItemName);

               // Assert.That(putStorageItem.ContentLength, Is.EqualTo(34)); //does not belong in this test

                var response = new GenerateRequestByType().Submit(putStorageItem, authToken);
                Assert.That(response.Status, Is.EqualTo(HttpStatusCode.Created));
                Assert.That(response.Headers[Constants.ETAG], Is.EqualTo(response.ETag));
                testHelper.DeleteItemFromContainer();
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:14,代码来源:PutStorageItemSpecs.cs

示例12: Should_return_no_content_when_the_container_exists

        public void Should_return_no_content_when_the_container_exists()
        {
            using (var testHelper = new TestHelper(authToken, storageUrl))
            {
                testHelper.PutItemInContainer(Constants.StorageItemName, Constants.StorageItemName);
                var getContainerInformation = new GetContainerInformation(storageUrl,  Constants.CONTAINER_NAME);

                var informationResponse = new GenerateRequestByType().Submit(getContainerInformation, authToken);
                Assert.That(informationResponse.Status, Is.EqualTo(HttpStatusCode.NoContent));
                Assert.That(informationResponse.Headers[Constants.XContainerObjectCount], Is.EqualTo("1"));
                Assert.That(informationResponse.Headers[Constants.XContainerBytesUsed], (Is.Not.Null));
                testHelper.DeleteItemFromContainer(Constants.StorageItemName);
            }
        }
开发者ID:jssingh,项目名称:csharp-cloudfiles,代码行数:14,代码来源:GetContainerInformationSpecs.cs

示例13: should_return_204_no_content_when_the_item_exists

        public void should_return_204_no_content_when_the_item_exists()
        {
            using (TestHelper testHelper = new TestHelper(authToken, storageUrl))
            {
                testHelper.PutItemInContainer();

                var deleteStorageItem = new DeleteStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName);
                var response = new GenerateRequestByType().Submit(deleteStorageItem,authToken );

                Assert.That(response.Status, Is.EqualTo(HttpStatusCode.NoContent));
                Console.WriteLine(response.Headers["Content-Type"]);
                Assert.That(Regex.Match(response.Headers["Content-Type"], "text/(plain|html)").Success, Is.True);
            }
        }
开发者ID:SimplyChris,项目名称:csharp-cloudfiles,代码行数:14,代码来源:DeleteContainerItemSpecs.cs

示例14: Should_get_serialized_json_format

        public void Should_get_serialized_json_format()
        {
            var testHelper = new TestHelper(authToken, storageUrl);
            testHelper.PutItemInContainer(Constants.StorageItemNameJpg);
            var getContainerInformation = new GetContainerInformationSerialized(storageUrl,  Constants.CONTAINER_NAME, Format.JSON);

            var jsonResponse = new GenerateRequestByType().Submit(getContainerInformation, authToken);
            Assert.That(jsonResponse.Status, Is.EqualTo(HttpStatusCode.OK));
            var jsonReturnValue = String.Join("", jsonResponse.ContentBody.ToArray());
            jsonResponse.Dispose();
            var expectedSubString = "[{\"name\":[ ]?\"" + Constants.StorageItemNameJpg + "\",[ ]?\"hash\":[ ]?\"b44a59383b3123a747d139bd0e71d2df\",[ ]?\"bytes\":[ ]?\\d+,[ ]?\"content_type\":[ ]?\"image.*jpeg\",[ ]?\"last_modified\":[ ]?\"" + String.Format("{0:yyyy-MM}", DateTime.Now);

            Assert.That(Regex.Match(jsonReturnValue, expectedSubString).Success, Is.True);
            testHelper.DeleteItemFromContainer(Constants.StorageItemNameJpg);
            testHelper.Dispose();
        }
开发者ID:jssingh,项目名称:csharp-cloudfiles,代码行数:16,代码来源:GetContainerInformationSpecs.cs

示例15: Should_return_created_when_content_length_is_not_supplied_because_it_is_optional

        public void Should_return_created_when_content_length_is_not_supplied_because_it_is_optional()
        {
            using (var testHelper = new TestHelper(authToken, storageUrl))
            {
                var putStorageItem = new PutStorageItem(storageUrl, Constants.CONTAINER_NAME, Constants.StorageItemName, Constants.StorageItemName);
                var uri = putStorageItem.CreateUri();
                var request = new CloudFilesRequest(uri);
                putStorageItem.Apply(request);
             //   request.ContentLength = 0;
                request.Headers.Add("X-Auth-Token", HttpUtility.UrlEncode(authToken));
                var response= request.GetResponse();

                Assert.That(response.Status, Is.EqualTo(HttpStatusCode.Created));
                Assert.That(response.Headers[Constants.ETAG], Is.EqualTo(request.ETag));
                testHelper.DeleteItemFromContainer();
            }
        }
开发者ID:bhowerton,项目名称:csharp-cloudfiles,代码行数:17,代码来源:PutStorageItemSpecs.cs


注:本文中的TestHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。