public void Given_User_In_Registered_Users_When_Called_Returns_URL() { string expectedURL = String.Format("{0}/{1}={2}", ConfigurationManager.AppSettings["RegistrationEmailURL"], "uid", TestData.AspNetUsers[0].Id); var query = new GetClientEntryPointQuery() { CAN = TestData.TestRegisteredCAN }; var handler = new GetClientEntryPointQueryHandler(_mockDbContext.Object); EntryPointURLModel model = handler.Execute(query); Assert.IsNotNull(model); Assert.IsNotNull(model.URL); Assert.IsFalse(String.IsNullOrEmpty(model.URL)); Assert.AreEqual(expectedURL, model.URL); }
public void Given_CAN_When_Query_Is_Valid_then_return_ClientEntryPointURL() { string dummyUrl = "http://dummyurl"; _mockQueryDispatcher .Setup(m => m.Dispatch<EntryPointURLModel>(It.IsAny<IQuery<EntryPointURLModel>>())) .Returns(new EntryPointURLModel(dummyUrl)); AccountController controller = new AccountController(_mockCommandDispatcher.Object, _mockQueryDispatcher.Object); GetClientEntryPointQuery qry = new GetClientEntryPointQuery(); qry.CAN = "DEMO002"; IHttpActionResult actionResult = controller.GetEntryPointForClient( qry ); Assert.IsInstanceOf<OkNegotiatedContentResult<EntryPointURLModel>>(actionResult); var contentResult = actionResult as OkNegotiatedContentResult<EntryPointURLModel>; Assert.IsNotNull(contentResult); Assert.IsNotNull(contentResult.Content); Assert.AreEqual( dummyUrl, contentResult.Content.URL ); }