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


C# Framework.TestContext类代码示例

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


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

示例1: Guid_null

 public void Guid_null()
 {
     var ctx = new TestContext<Models.TestObject>();
     Guid? guid = null;
     ctx.Queryable.Where(x => x.guidNullProperty == guid).ToList();
     Assert.AreEqual("guidNullProperty eq null", ctx.LastRequest.Parsed.Filter);
 }
开发者ID:tocsoft,项目名称:Linq2OData,代码行数:7,代码来源:ValueTests.cs

示例2: Guid

 public void Guid()
 {
     var ctx = new TestContext<Models.TestObject>();
     var guid = new System.Guid("61CA9677-CABA-44A0-A187-7C86A8E0EAC3");
     ctx.Queryable.Where(x => x.guidProperty == guid).ToList();
     Assert.AreEqual("guidProperty eq guid'61ca9677-caba-44a0-a187-7c86a8e0eac3'", ctx.LastRequest.Parsed.Filter);
 }
开发者ID:tocsoft,项目名称:Linq2OData,代码行数:7,代码来源:ValueTests.cs

示例3: GetExecutionFilepath

        /// <summary>
        /// Gets the full file path of an existing output file in the execution environment
        /// </summary>
        /// <returns>The full path to the file.</returns>
        /// <param name="testContext">The test context from which to attempt to extract the path</param>
        /// <param name="filename">The filename without path</param>
        public static string GetExecutionFilepath(string filename, TestContext testContext = null)
        {
            string[] paths = new string[] {
            Path.GetFullPath(filename),
            BuildPathFromCodeBaseDir(filename),
            BuildPathFromCurrentDir(filename),
            BuildPathFromDomainDir(filename),
            BuildPathFromStackFrame(filename),
            testContext != null ?
              BuildPathFromTestDeployment(filename, testContext) :
              INEXISTANT_FILE,
            testContext != null ?
              BuildPathFromTestDir(filename, testContext) :
              INEXISTANT_FILE,
              };

              foreach (string path in paths)
              {
            if (FileExists(path))
            {
              return path;
            }
              }

              throw new FileNotFoundException(string.Format("{0} not found.", filename));
        }
开发者ID:wfuser12,项目名称:autofact_integration_Test,代码行数:32,代码来源:TestEnvironment.cs

示例4: CopyAndAttachDatabase

        public static void CopyAndAttachDatabase(TestContext context, string databaseName)
        {
            string destinationPath = CopyDatabase(context, databaseName);

            // Attach the copied database to SQL Server
            AttachDatabase(databaseName, destinationPath);
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:7,代码来源:DatabaseManager.cs

示例5: When_laird_is_defeated_then_all_kobolds_in_hall_are_defeated

        public void When_laird_is_defeated_then_all_kobolds_in_hall_are_defeated()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var laird = context.CreateCard<KoboldHumanoid>("Drakeclan Laird");
            var ambusher = context.CreateCard<KoboldHumanoid>("Drakeclan Ambusher");
            var cutter = context.CreateCard<KoboldHumanoid>("Drakeclan Cutter");
            var shaman = context.CreateCard<KoboldHumanoid>("Drakeclan Shaman");
            var kobolds = new[] {laird, ambusher, cutter, shaman};
            context.SetTopOfDungeonDeck(kobolds);
            context.AdvanceMonsterToFirstRank(laird);
            var hand = Enumerable.Range(0, 6).Select(x => context.CreateCard<Criochan>("Criochan Captain")).ToArray();
            context.SetPlayerHand(hand);
            var startingXp = player.Xp;
            var startingVp = player.Vp;

            // Act
            context.WhenBattling(laird);
            player.DetermineBattleResult();

            // Assert
            kobolds.Each(x => Assert.That(player.Discard.Contains(x), "Discard does not contain {0}".Template(x.Name)));
            context.Game.Dungeon.Ranks.Each(r=> Assert.That(r.Card, Is.Not.Null, "Rank {0} is empty".Template(r.Number)));
            kobolds.Each(x => Assert.That(context.Game.Dungeon.Ranks.All(rank => rank.Card != x)));
            Assert.That(player.Xp, Is.EqualTo(startingXp + laird.Xp));
            Assert.That(player.Vp, Is.EqualTo(startingVp + kobolds.Sum(x => x.Vp)));
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:28,代码来源:KoboldHumanoidTest.cs

示例6: Contract_Contract

        public void Contract_Contract()
        {
            using (var ctx = new TestContext())
            {
                var map = ctx.Db<Contract>();

                var columns = map.Properties;
                Assert.AreEqual(19, columns.Length);

                map.Prop(x => x.Id)
                    .IsIdentity()
                    .IsFk(false)
                    .IsDiscriminator(false)
                    .IsRequired()
                    .HasColumnName("Id");

                map.Prop(x => x.AvpContractNr)
                    .IsIdentity(false)
                    .IsFk(false)
                    .IsDiscriminator(false)
                    .IsRequired(false)
                    .HasColumnName("AvpContractNr")
                    .MaxLength(50);
            }
        }
开发者ID:kjbartel,项目名称:efmappingapi,代码行数:25,代码来源:TphTest.cs

示例7: It

        public void It()
        {
            var ctx = new TestContext<string>();

            ctx.Queryable.Where(x=>x.EndsWith("")).ToList();

            Assert.AreEqual("endswith($it, '')", ctx.LastRequest.Parsed.Filter);
        }
开发者ID:tocsoft,项目名称:Linq2OData,代码行数:8,代码来源:ItTests.cs

示例8: toLower

        public void toLower()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.stringProperty.ToLower() == "").ToList();

            Assert.AreEqual("tolower(stringProperty) eq ''", ctx.LastRequest.Parsed.Filter);
        }
开发者ID:tocsoft,项目名称:Linq2OData,代码行数:8,代码来源:StringFunctionTests.cs

示例9: startswith

        public void startswith()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.stringProperty.StartsWith("big")).ToList();

            Assert.AreEqual("startswith(stringProperty, 'big')", ctx.LastRequest.Parsed.Filter);
        }
开发者ID:tocsoft,项目名称:Linq2OData,代码行数:8,代码来源:StringFunctionTests.cs

示例10: length

        public void length()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.stringProperty.Length == 1).ToList();

            Assert.AreEqual("length(stringProperty) eq 1", ctx.LastRequest.Parsed.Filter);
        }
开发者ID:tocsoft,项目名称:Linq2OData,代码行数:8,代码来源:StringFunctionTests.cs

示例11: GreaterThanOrEqual

        public void GreaterThanOrEqual()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.intProperty >= x.secondIntProperty).ToList();

            Assert.AreEqual("intProperty ge secondIntProperty", ctx.LastRequest.Parsed.Filter);
        }
开发者ID:tocsoft,项目名称:Linq2OData,代码行数:8,代码来源:OperationTests.cs

示例12: concat

        public void concat()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.stringProperty + "test" == "propTest").ToList();

            Assert.AreEqual("concat(stringProperty, 'test') eq 'propTest'", ctx.LastRequest.Parsed.Filter);
        }
开发者ID:tocsoft,项目名称:Linq2OData,代码行数:8,代码来源:StringFunctionTests.cs

示例13: AndSingleAmp

        public void AndSingleAmp()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.boolProperty & x.secondBoolProperty).ToList();

            Assert.AreEqual("boolProperty and secondBoolProperty", ctx.LastRequest.Parsed.Filter);
        }
开发者ID:tocsoft,项目名称:Linq2OData,代码行数:8,代码来源:OperationTests.cs

示例14: round

        public void round()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => Math.Round(x.floatProperty) == 0).ToList();

            Assert.AreEqual("round(floatProperty) eq 0", ctx.LastRequest.Parsed.Filter);
        }
开发者ID:tocsoft,项目名称:Linq2OData,代码行数:8,代码来源:MathFunctionTests.cs

示例15: fractionalseconds

        public void fractionalseconds()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.dateProperty.Second == 0).ToList();

            Assert.AreEqual("fractionalseconds(dateProperty) eq 0", ctx.LastRequest.Parsed.Filter);
        }
开发者ID:tocsoft,项目名称:Linq2OData,代码行数:8,代码来源:DateFunctionTests.cs


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