Beispiel #1
0
        public virtual async Task TestComplexTypeWithOData()
        {
            using (BitOwinTestEnvironment testEnvironment = new BitOwinTestEnvironment(new TestEnvironmentArgs {
                UseRealServer = true
            }))
            {
                Token token = await testEnvironment.Server.LoginWithCredentials("ValidUserName", "ValidPassword", clientId : "TestResOwner");

                using (RemoteWebDriver driver = testEnvironment.Server.BuildWebDriver(new RemoteWebDriverOptions {
                    Token = token
                }))
                {
                    await driver.ExecuteTest("testComplexTypeWithOData");
                }

                TestComplexController controllerForInsert = testEnvironment.GetObjects <TestComplexController>()
                                                            .ElementAt(0);

                TestComplexController controllerForUpdate = testEnvironment.GetObjects <TestComplexController>()
                                                            .ElementAt(2);

                TestComplexController controllerForAction = testEnvironment.GetObjects <TestComplexController>()
                                                            .ElementAt(3);

                A.CallTo(() => controllerForInsert.Create(A <TestComplexDto> .That.Matches(dto => dto.ComplexObj.Name == "Test?"), A <CancellationToken> .Ignored))
                .MustHaveHappenedOnceExactly();

                A.CallTo(() => controllerForUpdate.PartialUpdate(1, A <Delta <TestComplexDto> > .That.Matches(dto => dto.GetInstance().ComplexObj.Name == "Test?"), A <CancellationToken> .Ignored))
                .MustHaveHappenedOnceExactly();

                A.CallTo(() => controllerForAction.DoSomeThingWithComplexObj(A <TestComplexDto> .That.Matches(complexDto => complexDto.ComplexObj.Name == "Test??")))
                .MustHaveHappenedOnceExactly();
            }
        }
Beispiel #2
0
        public virtual void TestComplexTypeWithOData()
        {
            using (TestEnvironment testEnvironment = new TestEnvironment(new TestEnvironmentArgs {
                UseRealServer = true
            }))
            {
                OAuthToken token = testEnvironment.Server.Login("ValidUserName", "ValidPassword");

                using (RemoteWebDriver driver = testEnvironment.Server.GetWebDriver(new RemoteWebDriverOptions {
                    Token = token
                }))
                {
                    driver.ExecuteTest("testComplexTypeWithOData");
                }

                TestComplexController controllerForInsert = TestDependencyManager.CurrentTestDependencyManager.Objects
                                                            .OfType <TestComplexController>()
                                                            .ElementAt(0);

                TestComplexController controllerForUpdate = TestDependencyManager.CurrentTestDependencyManager.Objects
                                                            .OfType <TestComplexController>()
                                                            .ElementAt(2);

                TestComplexController controllerForAction = TestDependencyManager.CurrentTestDependencyManager.Objects
                                                            .OfType <TestComplexController>()
                                                            .ElementAt(3);

                A.CallTo(() => controllerForInsert.Create(A <TestComplexDto> .That.Matches(dto => dto.ComplexObj.Name == "Test?"), A <CancellationToken> .Ignored))
                .MustHaveHappened(Repeated.Exactly.Once);

                A.CallTo(() => controllerForUpdate.PartialUpdate(1, A <Delta <TestComplexDto> > .That.Matches(dto => dto.GetInstance().ComplexObj.Name == "Test?"), A <CancellationToken> .Ignored))
                .MustHaveHappened(Repeated.Exactly.Once);

                A.CallTo(() => controllerForAction.DoSomeThingWithComplexObj(A <ODataActionParameters> .That.Matches(parameters => ((TestComplexDto)parameters["complexDto"]).ComplexObj.Name == "Test??")))
                .MustHaveHappened(Repeated.Exactly.Once);
            }
        }