public void EntityReferencesMightBeDisconnected()
        {
            CreatePartDoc(doc =>
            {
                var feature = SpecHelper.InsertDummyBody(doc);
                var body    = doc.GetBodiesTs().Single();

                DisconnectEntity(doc, () => body);

                new Action(() => body.GetBodyBoxTs()).ShouldThrow <COMException>().Which.Message.Should().Contain("disconnected");

                return(Disposable.Empty);
            });
        }
        public void PersistentEntityReferencesShouldNotBeDisconnected()
        {
            CreatePartDoc(doc =>
            {
                var feature = SpecHelper.InsertDummyBody(doc);
                var body    = doc.GetPersistentEntityReference(doc.GetBodiesTs().Single());

                DisconnectEntity(doc, body);

                new Action(() => body().GetBodyBoxTs()).ShouldNotThrow <COMException>();

                return(Disposable.Empty);
            });
        }
            public void GivenAWebFleetClient()
            {
                _mockHandler = new FakeHttpMessageHandler(request =>
                {
                    _httpRequest = request;

                    return(FakeHttpMessageHandler.CreateResponse(HttpStatusCode.OK,
                                                                 new List <User>
                    {
                        new User
                        {
                        }
                    }));
                });

                _sut = SpecHelper.CreateClient(_mockHandler);
            }
Example #4
0
 /// <summary>
 /// Defines a test. All tests must be contained in at least 1 level of Describes.
 /// </summary>
 /// <param name="testDescription">The description of the test. The description should start with "should".</param>
 /// <param name="test">The implementation of the test.</param>
 /// <param name="sourceFile">Do not manually specify this parameter.</param>
 /// <param name="lineNumber">Do not manually specify this parameter.</param>
 public static void It(string testDescription, Action test, [CallerFilePath] string sourceFile = default, [CallerLineNumber] int lineNumber = default)
 {
     SpecHelper.RegisterTest(testDescription, test, false, false, sourceFile, lineNumber);
 }
Example #5
0
 /// <summary>
 /// Focuses the tests contained in this describe. All non-focused tests will
 /// be excluded from the test run.
 /// </summary>
 /// <param name="definition">The definition of the describe.</param>
 public static void fDescribe <TType>(Action definition)
 {
     SpecHelper.PushDescribe(typeof(TType).Name, true, false);
     definition();
     SpecHelper.PopDescribe();
 }
Example #6
0
 /// <summary>
 /// Focuses the tests contained in this describe. All non-focused tests will
 /// be excluded from the test run.
 /// </summary>
 /// <param name="childDescription">The description of the describe.</param>
 /// <param name="definition">The definition of the describe.</param>
 public static void fDescribe(string childDescription, Action definition)
 {
     SpecHelper.PushDescribe(childDescription, true, false);
     definition();
     SpecHelper.PopDescribe();
 }
Example #7
0
 /// <summary>
 /// Defines logic that will execute after each test. This can be used to clean up
 /// after a test or check some common expectations. The logic contained will only
 /// execute for tests in the current Describe context or any child Describe contexts.
 /// Before eaches can only be defined inside a Describe.
 /// </summary>
 /// <param name="afterEach">The logic to be executed.</param>
 public static void AfterEach(Func <Task> afterEach)
 {
     SpecHelper.AddAfterEach(afterEach);
 }
Example #8
0
 /// <summary>
 /// Describes a context for a test. This should usually be either a member name or
 /// a scenario whose tests are grouped together.
 /// </summary>
 /// <param name="description">The name of the member, the scenario description or similar.</param>
 /// <param name="definition">The definition of the describe.</param>
 public static void Describe(string description, Action definition)
 {
     SpecHelper.PushDescribe(description, false, false);
     definition();
     SpecHelper.PopDescribe();
 }
Example #9
0
        public void SpecHelper_CreateGenerator_Should_ReturnValidResult()
        {
            var result = SpecHelper.CreateGenerator();

            result.Should().NotBeNull();
        }
Example #10
0
 /// <summary>
 /// Defines logic that will execute after each test. This can be used to clean up
 /// after a test or check some common expectations. The logic contained will only
 /// execute for tests in the current Describe context or any child Describe contexts.
 /// Before eaches can only be defined inside a Describe.
 /// </summary>
 /// <param name="afterEach">The logic to be executed.</param>
 public static void AfterEach(Action afterEach)
 {
     SpecHelper.AddAfterEach(afterEach);
 }
            public void ThenTheCorrectUrlIsInvoked()
            {
                var expectedUri = SpecHelper.CreateUri("showUsers", new ApiParameters());

                Assert.That(_httpRequest.RequestUri, Is.EqualTo(expectedUri));
            }
Example #12
0
 /// <summary>
 /// Defines logic that will execute before each test. This is used to initialise
 /// variables, spies and static values that are shared among multiple tests. The
 /// logic contained will only execute for tests in the current Describe context
 /// or any child Describe contexts. Before eaches can only be defined inside a
 /// Describe.
 /// </summary>
 /// <param name="beforeEach">The logic to be executed.</param>
 public static void BeforeEach(Action beforeEach)
 {
     SpecHelper.AddBeforeEach(beforeEach);
 }
Example #13
0
 /// <summary>
 /// Defines logic that will execute before each test. This is used to initialise
 /// variables, spies and static values that are shared among multiple tests. The
 /// logic contained will only execute for tests in the current Describe context
 /// or any child Describe contexts. Before eaches can only be defined inside a
 /// Describe.
 /// </summary>
 /// <param name="beforeEach">The logic to be executed.</param>
 public static void BeforeEach(Func <StringBuilder, Task> beforeEach)
 {
     SpecHelper.AddBeforeEach(beforeEach);
 }
Example #14
0
 /// <summary>
 /// Defines logic that will execute after each test. This can be used to clean up
 /// after a test or check some common expectations. The logic contained will only
 /// execute for tests in the current Describe context or any child Describe contexts.
 /// Before eaches can only be defined inside a Describe.
 /// </summary>
 /// <param name="afterEach">The logic to be executed.</param>
 public static void AfterEach(Action <StringBuilder> afterEach)
 {
     SpecHelper.AddAfterEach(afterEach);
 }
Example #15
0
 /// <summary>
 /// Defines logic that will execute before each test. This is used to initialise
 /// variables, spies and static values that are shared among multiple tests. The
 /// logic contained will only execute for tests in the current Describe context
 /// or any child Describe contexts. Before eaches can only be defined inside a
 /// Describe.
 /// </summary>
 /// <param name="beforeEach">The logic to be executed.</param>
 public static void BeforeEach(Action <StringBuilder> beforeEach)
 {
     SpecHelper.AddBeforeEach(beforeEach);
 }
Example #16
0
 /// <summary>
 /// Focuses the test. Any non-focused tests will be exlcuded from the test runs.
 /// </summary>
 /// <param name="testDescription">The description of the test. The description should start with "should".</param>
 /// <param name="test">The implementation of the test.</param>
 /// <param name="sourceFile">Do not manually specify this parameter.</param>
 /// <param name="lineNumber">Do not manually specify this parameter.</param>
 public static void fIt(string testDescription, Func <StringBuilder, Task> test, [CallerFilePath] string sourceFile = default, [CallerLineNumber] int lineNumber = default)
 {
     SpecHelper.RegisterTest(testDescription, test, true, false, sourceFile, lineNumber);
 }
Example #17
0
        public void SpecHelper_CreateXmlVsParser_Should_ReturnValidResult()
        {
            var result = SpecHelper.CreateXmlVsParser();

            result.Should().NotBeNull();
        }
Example #18
0
 public MarkDownReactor(IOutputWriter writer, IXmlContentReader xmlReader)
 {
     _builder   = new MarkDownBuilder(SpecHelper.CreateGenerator(), SpecHelper.CreateXmlVsParser());
     _writer    = writer;
     _xmlReader = xmlReader;
 }
Example #19
0
 /// <summary>
 /// Defines logic that will execute before each test. This is used to initialise
 /// variables, spies and static values that are shared among multiple tests. The
 /// logic contained will only execute for tests in the current Describe context
 /// or any child Describe contexts. Before eaches can only be defined inside a
 /// Describe.
 /// </summary>
 /// <param name="beforeEach">The logic to be executed.</param>
 public static void BeforeEach(Func <Task> beforeEach)
 {
     SpecHelper.AddBeforeEach(beforeEach);
 }
Example #20
0
 /// <summary>
 /// Defines logic that will execute after each test. This can be used to clean up
 /// after a test or check some common expectations. The logic contained will only
 /// execute for tests in the current Describe context or any child Describe contexts.
 /// Before eaches can only be defined inside a Describe.
 /// </summary>
 /// <param name="afterEach">The logic to be executed.</param>
 public static void AfterEach(Func <StringBuilder, Task> afterEach)
 {
     SpecHelper.AddAfterEach(afterEach);
 }
Example #21
0
 public MarkDownReactor()
 {
     _builder   = new MarkDownBuilder(SpecHelper.CreateGenerator(), SpecHelper.CreateXmlVsParser());
     _writer    = Forge.GetOutputWriter();
     _xmlReader = Forge.GetXmlContentReader();
 }