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


C# Xunit类代码示例

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


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

示例1: AddAzureRmAutoscaleSettingTests

        public AddAzureRmAutoscaleSettingTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            //ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsAutoscaleOperationsMock = new Mock<IAutoscaleSettingsOperations>();
            insightsManagementClientMock = new Mock<InsightsManagementClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new AddAzureRmAutoscaleSettingCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsManagementClient = insightsManagementClientMock.Object
            };

            response = new AzureOperationResponse<AutoscaleSettingResource>()
            {
                Body = new AutoscaleSettingResource()
            };

            insightsAutoscaleOperationsMock.Setup(f => f.CreateOrUpdateWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<AutoscaleSettingResource>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<Microsoft.Rest.Azure.AzureOperationResponse<AutoscaleSettingResource>>(response))
                .Callback((string resourceGrp, string settingNm, AutoscaleSettingResource createOrUpdateParams, Dictionary<string, List<string>> headers, CancellationToken t) =>
                {
                    resourceGroup = resourceGrp;
                    settingName = settingNm;
                    createOrUpdatePrms = createOrUpdateParams;
                });

            insightsManagementClientMock.SetupGet(f => f.AutoscaleSettings).Returns(this.insightsAutoscaleOperationsMock.Object);
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:28,代码来源:AddAzureRmAutoscaleSettingTests.cs

示例2: EnumerateTestCommands

		protected override System.Collections.Generic.IEnumerable<Xunit.Sdk.ITestCommand> EnumerateTestCommands(Xunit.Sdk.IMethodInfo method)
		{
			return base.EnumerateTestCommands(method).Select(enumerateTestCommand => new ActionTestCommandWrapper(enumerateTestCommand, o =>
			{
				((ReplicateToSql)o).ConnectionString=connectionStringSettings;
			}));
		}
开发者ID:neiz,项目名称:ravendb,代码行数:7,代码来源:FactIfSqlServerIsAvailable.cs

示例3: GetAzureRmUsageTests

        public GetAzureRmUsageTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsUsageMetricOperationsMock = new Mock<IUsageMetricsOperations>();
            insightsClientMock = new Mock<InsightsClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new GetAzureRmUsageCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsClient = insightsClientMock.Object
            };

            response = Utilities.InitializeUsageMetricResponse();

            insightsUsageMetricOperationsMock
                .Setup(f => f.ListAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<UsageMetricListResponse>(response))
                .Callback((string f, string s, string a, CancellationToken t) =>
                {
                    resourceId = f;
                    filter = s;
                    apiVersion = a;
                });

            insightsClientMock
                .SetupGet(f => f.UsageMetricOperations)
                .Returns(this.insightsUsageMetricOperationsMock.Object);
        }
开发者ID:brnleehng,项目名称:azure-powershell,代码行数:28,代码来源:GetAzureRmUsageTests.cs

示例4: GetAzureRmUsageTests

        public GetAzureRmUsageTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            //ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsUsageMetricOperationsMock = new Mock<IUsageMetricsOperations>();
            insightsClientMock = new Mock<InsightsClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new GetAzureRmUsageCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsClient = insightsClientMock.Object
            };

            response = new Microsoft.Rest.Azure.AzureOperationResponse<IEnumerable<UsageMetric>>()
            {
                Body = new List<UsageMetric>()
            };

            insightsUsageMetricOperationsMock
                .Setup(f => f.ListWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ODataQuery<UsageMetric>>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<Microsoft.Rest.Azure.AzureOperationResponse<IEnumerable<UsageMetric>>>(response))
                .Callback((string r, string api, ODataQuery<UsageMetric> q, Dictionary<string, List<string>> headers, CancellationToken t) =>
                {
                    resourceId = r;
                    filter = q;
                    apiVersion = api;
                });

            insightsClientMock
                .SetupGet(f => f.UsageMetrics)
                .Returns(this.insightsUsageMetricOperationsMock.Object);
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:31,代码来源:GetAzureRmUsageTests.cs

示例5: GetAzureRmAutoscaleSettingTests

        public GetAzureRmAutoscaleSettingTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsAutoscaleOperationsMock = new Mock<IAutoscaleOperations>();
            insightsManagementClientMock = new Mock<InsightsManagementClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new GetAzureRmAutoscaleSettingCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsManagementClient = insightsManagementClientMock.Object
            };

            response = new AutoscaleSettingGetResponse()
            {
                RequestId = Guid.NewGuid().ToString(),
                StatusCode = HttpStatusCode.OK,
                Id = "",
                Location = "",
                Name = "",
                Properties = null,
                Tags = null,
            };

            responseList = new AutoscaleSettingListResponse()
            {
                RequestId = Guid.NewGuid().ToString(),
                StatusCode = HttpStatusCode.OK,
                AutoscaleSettingResourceCollection = new AutoscaleSettingResourceCollection()
                {
                    Value = new List<AutoscaleSettingResource>()
                    {
                        new AutoscaleSettingResource(){
                                Id = "",
                                Location = "",
                                Name = "",
                                Properties = null,
                                Tags = null,
                            },
                    }
                }
            };

            insightsAutoscaleOperationsMock.Setup(f => f.GetSettingAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<AutoscaleSettingGetResponse>(response))
                .Callback((string resourceGrp, string settingNm, CancellationToken t) =>
                {
                    resourceGroup = resourceGrp;
                    settingName = settingNm;
                });

            insightsAutoscaleOperationsMock.Setup(f => f.ListSettingsAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<AutoscaleSettingListResponse>(responseList))
                .Callback((string resourceGrp, string targetResourceId, CancellationToken t) =>
                {
                    resourceGroup = resourceGrp;
                    targetResourceUri = targetResourceId;
                });

            insightsManagementClientMock.SetupGet(f => f.AutoscaleOperations).Returns(this.insightsAutoscaleOperationsMock.Object);
        }
开发者ID:brnleehng,项目名称:azure-powershell,代码行数:60,代码来源:GetAzureRmAutoscaleSettingTests.cs

示例6: RemoveAzureRmAutoscaleSettingTests

        public RemoveAzureRmAutoscaleSettingTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsAutoscaleOperationsMock = new Mock<IAutoscaleOperations>();
            insightsManagementClientMock = new Mock<InsightsManagementClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new RemoveAzureRmAutoscaleSettingCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsManagementClient = insightsManagementClientMock.Object
            };

            response = new AzureOperationResponse()
            {
                RequestId = Guid.NewGuid().ToString(),
                StatusCode = HttpStatusCode.OK,
            };

            insightsAutoscaleOperationsMock.Setup(f => f.DeleteSettingAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<AzureOperationResponse>(response))
                .Callback((string resourceGrp, string settingNm, CancellationToken t) =>
                {
                    resourceGroup = resourceGrp;
                    settingName = settingNm;
                });

            insightsManagementClientMock.SetupGet(f => f.AutoscaleOperations).Returns(this.insightsAutoscaleOperationsMock.Object);
        }
开发者ID:brnleehng,项目名称:azure-powershell,代码行数:28,代码来源:RemoveAzureRmAutoscaleSettingTests.cs

示例7: Y2016_Day12_Process_Returns_Correct_Solution

        public static void Y2016_Day12_Process_Returns_Correct_Solution()
        {
            // Arrange
            string[] instructions = new[]
            {
                "cpy 41 a",
                "inc a",
                "inc a",
                "dec a",
                "jnz a 2",
                "dec a",
            };

            int[] binsOfInterest = new[] { 0, 1, 2 };

            // Act
            var actual = Day12.Process(instructions, initialValueOfC: 0);

            // Assert
            Assert.NotNull(actual);
            Assert.Equal(4, actual.Count);
            Assert.Equal(42, actual['a']);
            Assert.Equal(0, actual['b']);
            Assert.Equal(0, actual['c']);
            Assert.Equal(0, actual['d']);
        }
开发者ID:martincostello,项目名称:adventofcode,代码行数:26,代码来源:Day12Tests.cs

示例8: AddQueryListMultipleNullItem

        public void AddQueryListMultipleNullItem()
        {
            var list = new[] { "test1", null, "test3" };
            var url = UrlBuilder.Create("test").AddQuery("name", "value").AddQueryList("test", list).Url;

            Assert.Equal("test?name=value&test=test1&test=test3", url);
        }
开发者ID:MetSystem,项目名称:dotnet-apiport,代码行数:7,代码来源:UrlBuilderTest.cs

示例9: ShouldAccumulateFullTriangle

        public void ShouldAccumulateFullTriangle()
        {
            var expectedValues = new[] { "ProductA",
                                            "45.2", "110", "110",  "147",
                                                    "50",  "125",  "150",
                                                           "55",   "140",
                                                                   "100" };

            var triangle = new ClaimTriangle("ProductA", _collector);
            triangle[1990][1990] = 45.2;
            triangle[1990][1991] = 64.8;
            triangle[1990][1993] = 37;
            triangle[1991][1991] = 50;
            triangle[1991][1992] = 75;
            triangle[1991][1993] = 25;
            triangle[1992][1992] = 55;
            triangle[1992][1993] = 85;
            triangle[1993][1993] = 100;

            var actualValues = triangle.Accumulate().Flatten(new TriangleDimensions { OriginYear = 1990, DevelopmentYears = 4 });

            for (int i = 0; i < actualValues.Length; i++)
            {
                Assert.Equal(expectedValues[i], actualValues[i]);
            }
        }
开发者ID:wayneqs,项目名称:claims,代码行数:26,代码来源:ClaimTriangleFacts.cs

示例10: BugfixingLeaderSorted_Test

 public void BugfixingLeaderSorted_Test()
 {
     //var numbers = new int[] {1, 1, 1, 1, 50};
     //var numbers = new int[] {2, 2, 2, 2, 2, 3, 4, 4, 4, 6};
     var numbers = new[] {2, 2, 2, 2, 2, 3, 4, 4, 4};
     int result = Kata.Solution(numbers);
 }
开发者ID:kkorus,项目名称:kata,代码行数:7,代码来源:KataTests.cs

示例11: TestValidSources

        public void TestValidSources()
        {
            // Arrange
            string[] testValues = new[] { "http://bing.com", "http://microsoft.com", "https://paypal.com", "http://library" };

            TestValues(testValues, true);
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:7,代码来源:UriHelperTest.cs

示例12: TestInvalidSources

        public void TestInvalidSources()
        {
            // Arrange
            string[] testValues = new[] { null, "", "link", "c:\\dir", "\\username\folder", "127.0.0.1", "localhost", "crash;\\_andBurn", "ftp://bing.com", "gopher://kill.it", "http://" };

            TestValues(testValues, false);
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:7,代码来源:UriHelperTest.cs

示例13: Y2015_Day13_GetMaximumTotalChangeInHappiness

        public static void Y2015_Day13_GetMaximumTotalChangeInHappiness()
        {
            // Arrange
            string[] potentialHappiness = new[]
            {
                "Alice would gain 54 happiness units by sitting next to Bob.",
                "Alice would lose 79 happiness units by sitting next to Carol.",
                "Alice would lose 2 happiness units by sitting next to David.",
                "Bob would gain 83 happiness units by sitting next to Alice.",
                "Bob would lose 7 happiness units by sitting next to Carol.",
                "Bob would lose 63 happiness units by sitting next to David.",
                "Carol would lose 62 happiness units by sitting next to Alice.",
                "Carol would gain 60 happiness units by sitting next to Bob.",
                "Carol would gain 55 happiness units by sitting next to David.",
                "David would gain 46 happiness units by sitting next to Alice.",
                "David would lose 7 happiness units by sitting next to Bob.",
                "David would gain 41 happiness units by sitting next to Carol.",
            };

            // Act
            int actual = Day13.GetMaximumTotalChangeInHappiness(potentialHappiness);

            // Assert
            Assert.Equal(330, actual);
        }
开发者ID:martincostello,项目名称:adventofcode,代码行数:25,代码来源:Day13Tests.cs

示例14: Should_be_able_to_convert_to_json

        public void Should_be_able_to_convert_to_json()
        {
            var obj = new { foo = "bar" };
            var json = obj.ToJson();

            Assert.NotEqual(string.Empty, json);
        }
开发者ID:rootzhou,项目名称:Core,代码行数:7,代码来源:ObjectExtensions.cs

示例15: NextItemTest

 public void NextItemTest()
 {
     Random rnd = new Random();
     int[] array = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
     int item = rnd.NextItem(array);
     Assert.Contains(item, array);
 }
开发者ID:BiaoLiu,项目名称:osharp,代码行数:7,代码来源:RandomExtensionsTest.cs


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