public void GivenRequestWithoutQueryString_DoesNotTrackMetric() { var controller = new ErrorController(Db, Metrics); var request = new HttpRequest(string.Empty, "http://example.com/", string.Empty); var response = new HttpResponse(TextWriter.Null); var httpContext = new HttpContextWrapper(new HttpContext(request, response)); controller.ControllerContext = new ControllerContext(httpContext, new RouteData(), controller); controller.InvalidPage(); MetricsMock.Verify(x => x.Increment(Metric.Error_404), Times.Never()); }
public void GivenAnonymousPostRequest_WithValidId_IncrementsMetric() { var expectedObject = new PasswordRetrieval { Token = Guid.NewGuid(), UserId = User.Id }; Db.Save(expectedObject); var model = new ResetPassword { Token = expectedObject.Token, Password = "******" + GetRandom.String(10), }; model.PasswordConfirm = model.Password; var result = Controller.ResetPassword(model) as ViewResult; result.Should().Not.Be.Null(); MetricsMock.Verify(x => x.Increment(Metric.Users_ResetPassword), Times.Once()); }