//[Test] public void NewUserEntersWrongPinAndIsBlocked() { var chatId = "667"; var client = new BotTestClient(chatId); client .Send("hey") .CheckResponse(TelegramNotifier.RequestEmailMessage) .Send("*****@*****.**") .CheckResponse(s => Assert.IsTrue(s.StartsWith("Email address is set to [email protected]"))) // 1st attempt .Send("1111") .CheckResponse(s => Assert.AreEqual(s, "Your account could not be verified.")) // 2nd attempt .Send("2222") .CheckResponse(s => Assert.AreEqual(s, "Your account could not be verified.")) // 3rd attempt .Send("3333") .CheckResponse(s => Assert.AreEqual(s, "Your account could not be verified.")) // User is locked and cannot use the correct pin .Send(FakePingGenerator.Pin.ToString()) .CheckResponse( s => Assert.AreEqual(s, "Your account could not be verified.")) // User is not verified and cannot request reports .Send("/day") .CheckResponse(s => Assert.AreEqual(s, "Your account could not be verified.")); //.DeleteAccount(); }
// 2. new user sets email // 3. new user confirms email //[Test] public void NewUser_RegistersAndVerifies() { // todo: clean db from this user // todo: fix fluent api to async pattern // todo: call DeleteAccount() in case of an error var chatId = "666"; var client = new BotTestClient(chatId); client .Send("hey") .CheckResponse(TelegramNotifier.RequestEmailMessage) .Send("*****@*****.**") .CheckResponse(s => Assert.IsTrue(s.StartsWith("Email address is set to [email protected]"))) .Send("4567") .CheckResponse(s => Assert.AreEqual(s, "Your account could not be verified.")) .Send(FakePingGenerator.Pin.ToString()) .CheckResponse(s => Assert.AreEqual(s, "Your account is verified. Now you are able to request reports.")) .Send("/delete") .CheckResponse("Account is deleted"); //// request report /day //request = GetRequest(chatId, "/day"); //await _target.Run(request, _logger); //reply = _messages.Pop(); //Assert.IsTrue(reply.StartsWith("Your stats since")); //// request report /week //request = GetRequest(chatId, "/week"); //await _target.Run(request, _logger); //reply = _messages.Pop(); //Assert.IsTrue(reply.StartsWith("Your stats since")); //// request report /month //request = GetRequest(chatId, "/month"); //await _target.Run(request, _logger); //reply = _messages.Pop(); //Assert.IsTrue(reply.StartsWith("Your stats since")); //request = GetRequest(chatId, "/delete"); //await _target.Run(request, _logger); }
//[Test] public void NewUserCanVerifyAccountOnLastAttempt() { var chatId = "668"; var client = new BotTestClient(chatId); client .Send("hey") .CheckResponse(TelegramNotifier.RequestEmailMessage) .Send("*****@*****.**") .CheckResponse(s => Assert.IsTrue(s.StartsWith("Email address is set to [email protected]"))) // 1st attempt .Send("1111") .CheckResponse(s => Assert.AreEqual(s, "Your account could not be verified.")) // 2nd attempt .Send("2222") .CheckResponse(s => Assert.AreEqual(s, "Your account could not be verified.")) // 3rd attempt .Send(FakePingGenerator.Pin.ToString()) .CheckResponse(s => Assert.AreEqual(s, "Your account is verified.Now you are able to request reports.")); //.DeleteAccount(); }