public void GenerateTokenHtmlEncodesValues() { // Arrange var generator = new Mock <RandomNumberGenerator>(MockBehavior.Strict); var generatedBytes = Encoding.Default.GetBytes("|aÿx§#½oÿ↨îA8Eµ"); generator.Setup(g => g.GetBytes(It.IsAny <byte[]>())).Callback((byte[] array) => Array.Copy(generatedBytes, array, generatedBytes.Length)); // Act var result = SimpleMembershipProvider.GenerateToken(generator.Object); // Assert Assert.Equal("fGH/eKcjvW//P+5BOEW1", Convert.ToBase64String(generatedBytes)); Assert.Equal("fGH_eKcjvW__P-5BOEW1AA2", result); }