-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAuthenticationTest.cs
45 lines (37 loc) · 1.45 KB
/
AuthenticationTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using LetsBuyLocal.SDK.Models;
using LetsBuyLocal.SDK.Services;
using LetsBuyLocal.SDK.Tests.Shared;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace LetsBuyLocal.SDK.Tests
{
[TestClass]
public class AuthenticationTest
{
[TestMethod]
public void AuthenticateTest()
{
var svc = new AuthenticationService();
//Create a new user for this test.
var user = TestingHelper.CreateNewTestUserInMemory();
var userSvc = new UserService();
var testUser = userSvc.CreateUser(user).Object;
//Verify that only two properties are required for an existing user .
var minUser = new User {Email = testUser.Email, Password = testUser.Password};
var resp = svc.Authenticate(minUser);
Assert.IsNotNull(resp.Object);
}
[TestMethod]
public void RequestPasswordResetTest()
{
var svc = new AuthenticationService();
//Create a new user for this test.
var user = TestingHelper.CreateNewTestUserInMemory();
var userSvc = new UserService();
var testUser = userSvc.CreateUser(user).Object;
//Verify that only email is required for an existing user.
var minUser = new User { Email = testUser.Email };
var isSuccessResp = svc.RequestPasswordReset(minUser);
Assert.IsTrue(isSuccessResp.Success);
}
}
}