コード例 #1
0
        public void Register_WhenSuppliedWithEmailThatIsAlreadyRegistered_ReturnsAnError(WireDataFormat format)
        {
            var client = TestContext.CreateClientInvalidCredentials(format);
			var accountClient = new AccountApi(client.HttpChannel);
            var email = Guid.NewGuid() + "@tempuri.org";
            var request = CreateValidRegisterAccountRequest(email);
            accountClient.Create(request);

            var exception = Assert.Throws<ErrorResponseException>(() => accountClient.Create(request));

            Assert.AreEqual(1, exception.Errors.Count);
            Assert.That(exception.Errors[0].Description, Is.StringContaining("email address is already in use"));
        }
コード例 #2
0
        public void Register_WhenSuppliedEmailIsUnused_AccountIsCreatedAndEmailAddressReturned(WireDataFormat format)
        {
            var client = TestContext.CreateClientInvalidCredentials(format);
			var accountClient = new AccountApi(client.HttpChannel);
            var email = Guid.NewGuid() + "@tempuri.org";
            var request = CreateValidRegisterAccountRequest(email);

            var registeredUsersEmail = accountClient.Create(request);

            Assert.AreEqual(email, registeredUsersEmail);
        }
コード例 #3
0
        public void Register_WhenSuppliedPasswordFormatInvalid_ReturnsAnError(WireDataFormat format)
        {
            const string invalidPassowordValue = "abc"; //Password to short
            var client = TestContext.CreateClientNoCredentials(format);
			var accountClient = new AccountApi(client.HttpChannel);
            var email = Guid.NewGuid() + "@tempuri.org";
            var request = CreateValidRegisterAccountRequest(email);
            request.Password = invalidPassowordValue;
            
            var exception = Assert.Throws<ErrorResponseException>(() => accountClient.Create(request));

            Assert.AreEqual(1, exception.Errors.Count);
            Assert.That(exception.Errors[0].Description, Is.StringContaining("value provided is not valid for password"));
        }