public static void ClassInit(TestContext textContext) { controller = new NewsLetterController(NewsLetterServiceGenerator.GetMockService().Object); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); AutoMapperInit.BuildMap(); }
public async Task GetNewsLetters_ValidSearchParam_Returns_Records() { // Arrange var userId = UserManagerGenerator.GetDataCollection()[0].UserId; var author = NewsLetterServiceGenerator.GetDataCollection()[0].Author; var searchParam = new Utility.ParamViewModels.SearchNewLetterViewModel { UserId = userId, Author = author }; // Act var response = controller.GetNewsLetters(searchParam); dynamic responseContent = await response.Content.ReadAsAsync <ExpandoObject>(); var selectedItems = responseContent.ViewModels; // Assert Assert.IsTrue(response.StatusCode == System.Net.HttpStatusCode.OK); Assert.IsTrue(selectedItems.Count > 0); }
public void TestInit() { UserNewsLetterServiceGenerator.ResetUserNewsLetterDataCollection(); NewsLetterServiceGenerator.ResetNewsLetterDataCollection(); UserManagerGenerator.ResetDataCollection(); }