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 async Task SimpleArrayValuesTest()
        {
            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("simpleArrayValuesTest");
                }

                TestComplexController controllerForSimpleValuesArray = testEnvironment.GetObjects <TestComplexController>()
                                                                       .Single();

                A.CallTo(() => controllerForSimpleValuesArray.GetValues(A <IEnumerable <int> > .That.Matches(values => values != null), A <CancellationToken> .Ignored))
                .MustHaveHappenedOnceExactly();
            }
        }
Beispiel #3
0
        public virtual void SimpleArrayValuesTest()
        {
            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("simpleArrayValuesTest");
                }

                TestComplexController controllerForSimpleValuesArray = TestDependencyManager.CurrentTestDependencyManager.Objects
                                                                       .OfType <TestComplexController>()
                                                                       .Single();

                A.CallTo(() => controllerForSimpleValuesArray.GetValues(A <ODataActionParameters> .That.Matches(parameters => parameters.ContainsKey("values")), A <CancellationToken> .Ignored))
                .MustHaveHappened(Repeated.Exactly.Once);
            }
        }
Beispiel #4
0
        public virtual async Task SimpleArrayValuesTest()
        {
            using (BitOwinTestEnvironment testEnvironment = new BitOwinTestEnvironment(new TestEnvironmentArgs {
                UseRealServer = true
            }))
            {
                TokenResponse token = await testEnvironment.Server.Login("ValidUserName", "ValidPassword", clientId : "TestResOwner");

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

                TestComplexController controllerForSimpleValuesArray = TestDependencyManager.CurrentTestDependencyManager.Objects
                                                                       .OfType <TestComplexController>()
                                                                       .Single();

                A.CallTo(() => controllerForSimpleValuesArray.GetValues(A <TestComplexController.GetValuesParameters> .That.Matches(parameters => parameters.values != null), A <CancellationToken> .Ignored))
                .MustHaveHappenedOnceExactly();
            }
        }
Beispiel #5
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);
            }
        }