示例#1
0
            public async Task ClearsEmailConfirmationToken()
            {
                var user = new User {
                    Username = "******", EmailConfirmationToken = Guid.NewGuid().ToString(), UnconfirmedEmailAddress = "*****@*****.**", EmailAddress = "*****@*****.**"
                };
                var service = new TestableUserServiceWithDBFaking
                {
                    Users = new[] { user }
                };

                await service.CancelChangeEmailAddress(user);

                Assert.Equal("*****@*****.**", user.EmailAddress);
                Assert.Null(user.EmailConfirmationToken);
                service.FakeEntitiesContext.VerifyCommitChanges();
            }
示例#2
0
            public async Task WritesAuditRecord()
            {
                // Arrange
                var user = new User {
                    Username = "******", EmailConfirmationToken = Guid.NewGuid().ToString(), UnconfirmedEmailAddress = "*****@*****.**", EmailAddress = "*****@*****.**"
                };
                var service = new TestableUserServiceWithDBFaking
                {
                    Users = new[] { user }
                };

                // Act
                await service.CancelChangeEmailAddress(user);

                // Assert
                Assert.True(service.Auditing.WroteRecord <UserAuditRecord>(ar =>
                                                                           ar.Action == AuditedUserAction.CancelChangeEmail &&
                                                                           ar.AffectedEmailAddress == "*****@*****.**" &&
                                                                           ar.EmailAddress == "*****@*****.**"));
            }
            public async Task WritesAuditRecord()
            {
                // Arrange
                var user = new User { Username = "******", EmailConfirmationToken = Guid.NewGuid().ToString(), UnconfirmedEmailAddress = "*****@*****.**", EmailAddress = "*****@*****.**" };
                var service = new TestableUserServiceWithDBFaking
                {
                    Users = new[] { user }
                };

                // Act
                await service.CancelChangeEmailAddress(user);

                // Assert
                Assert.True(service.Auditing.WroteRecord<UserAuditRecord>(ar =>
                    ar.Action == AuditedUserAction.CancelChangeEmail &&
                    ar.AffectedEmailAddress == "*****@*****.**" &&
                    ar.EmailAddress == "*****@*****.**"));
            }
            public async Task ClearsEmailConfirmationToken()
            {
                var user = new User { Username = "******", EmailConfirmationToken = Guid.NewGuid().ToString() ,UnconfirmedEmailAddress = "*****@*****.**", EmailAddress = "*****@*****.**" };
                var service = new TestableUserServiceWithDBFaking
                {
                    Users = new[] { user }
                };

                await service.CancelChangeEmailAddress(user);

                Assert.Equal("*****@*****.**", user.EmailAddress);
                Assert.Null(user.EmailConfirmationToken);
                service.FakeEntitiesContext.VerifyCommitChanges();
            }