How to use Setup method of NSpec.Tests.WhenRunningSpecs.describe_numbers class

Best NSpec code snippet using NSpec.Tests.WhenRunningSpecs.describe_numbers.Setup

Run NSpec automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

describe_levels.cs

Source: describe_levels.cs Github

copy
1using FluentAssertions;
2using NUnit.Framework;
3
4namespace NSpec.Tests.WhenRunningSpecs
5{
6    public class describe_levels : when_running_specs
7    {
8        class describe_numbers : nspec
9        {
10            void method_level_context()
11            {
12                it["1 is 1"] = () => Assert.That(true, Is.True);
13
14                context["except in crazy world"] = () =>
15                {
16                    it["1 is 2"] = () => Assert.That(1, Is.EqualTo(2));
17                };
18            }
19        }
20
21        [SetUp]
22        public void Setup()
23        {
24            Run(typeof(describe_numbers));
25        }
26
27        [Test]
28        public void classes_that_directly_inherit_nspec_have_level_1()
29        {
30            TheContext("describe numbers").Level.Should().Be(1);
31        }
32
33        [Test]
34        public void method_level_contexts_have_one_level_deeper()
35        {
36            TheContext("method level context").Level.Should().Be(2);
37        }
38
39        [Test]
40        public void and_nested_contexts_one_more_deep()
41        {
42            TheContext("except in crazy world").Level.Should().Be(3);
43        }
44    }
45}
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Trigger Setup code on LambdaTest Cloud Grid

Execute automation tests with Setup on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)