public async Task RegisterEmailConfirmationCode_Ok() { IStorage storage = new InMemoryStaticStorage(); User u = new User() { Email = "*****@*****.**", Password = "******" }; AccountService svc = new AccountService(storage); string code = await svc.RegisterEmailConfirmationCodeAsync(u); string res = await storage.GetEmailByConfirmationCodeAsync(code); Assert.AreEqual(u.Email, res); }
public async Task GetUserByEmailConfirmationCode_Ok() { IStorage storage = new InMemoryStaticStorage(); await storage.Prepare(); User u = new User() { Email = "*****@*****.**", Password = "******" }; AccountService svc = new AccountService(storage); string code = await svc.RegisterEmailConfirmationCodeAsync(u); User res = await svc.GetUserByEmailConfirmationCodeAsync(code); //now should return null as code already used var code2 = await storage.GetEmailByConfirmationCodeAsync(code); Assert.AreEqual(u.Email, res.Email); Assert.IsNull(code2); }