예제 #1
0
        public void TestSignInPassesArguments()
        {
            const uint   ExpectedUserId          = TestUserId;
            const string ExpectedEmailAddress    = TestEmailAddress;
            const string ExpectedGamerTag        = TestGamertag;
            const string ExpectedPassword        = "******";
            const bool   ExpectedIsSignedInValue = true;

            bool expectedStorePassword = false;

            XboxUser user = new XboxUser(this.xboxConsole, ExpectedUserId, ExpectedEmailAddress, ExpectedGamerTag, !ExpectedIsSignedInValue);

            ShimXboxConsoleAdapterBase.AllInstances.SignInUserStringXboxUserDefinitionStringBoolean = (adapter, systemIpAddress, userDefinition, password, storePassword) =>
            {
                Assert.AreSame(user.Definition, userDefinition, "The passed in XboxUserDefinition was not the same as the expected user definition.");
                Assert.AreEqual(ExpectedPassword, password, "The passed in password string was not the same as the expected password string.");
                Assert.AreEqual(expectedStorePassword, storePassword, "The passed in storePassword value was not the same as the expected storePassword value.");

                return(new XboxUserDefinition(userDefinition.UserId, userDefinition.EmailAddress, userDefinition.Gamertag, ExpectedIsSignedInValue));
            };

            user.SignIn(ExpectedPassword, expectedStorePassword);
            Assert.AreEqual(ExpectedIsSignedInValue, user.IsSignedIn, "The SignOut method didn't set the users IsSignedIn property based on return value.");

            expectedStorePassword = true;
            user.SignIn(ExpectedPassword, expectedStorePassword);
        }
예제 #2
0
        public void TestSignInHandlesIncorrectReturn()
        {
            XboxUser user = this.CreateTestUser();

            ShimXboxConsoleAdapterBase.AllInstances.SignInUserStringXboxUserDefinitionStringBoolean = (adapter, systemIpAddress, userDefinition, password, storePassword) =>
            {
                return(new XboxUserDefinition(TestUserId, "DifferentEmail", null, false));
            };

            user.SignIn(null, false);
        }
예제 #3
0
        public void TestSignInCallsAdapterSignIn()
        {
            XboxUser user = this.CreateTestUser();

            bool isCorrectMethodCalled = false;

            ShimXboxConsoleAdapterBase.AllInstances.SignInUserStringXboxUserDefinitionStringBoolean = (adapter, systemIpAddress, userDefinition, password, storePassword) =>
            {
                isCorrectMethodCalled = true;
                return(this.CreateTestUserDefinition());
            };

            user.SignIn(null, false);
            Assert.IsTrue(isCorrectMethodCalled, "The SignIn method didn't call the adapter's SignInUser(systemIpAddress, userDefinition, password, storePassword).");
        }