public static void ClassInit(TestContext textContext) { controller = new UserNewsLetterController(UserNewsLetterServiceGenerator.GetMockService().Object); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); AutoMapperInit.BuildMap(); }
public async Task GetUserNewsLetters_ValidUserName_Returns_NoRecords() { // Arrange var userId = UserManagerGenerator.GetDataCollection()[0].UserId; UserNewsLetterServiceGenerator.EmptyUserNewsLetterDataCollection(); // Act var response = controller.GetUserNewsLetters(userId); 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(); }