public void GetNewsContents_SuccessResult() { List <AdvertisementEntity> expected = new List <AdvertisementEntity>(); var pageId = 0; _dataAccess.Setup(service => service.RegisterNewsSource(It.IsAny <NewsProviderEntity>())).Returns(false); _advertisement.Setup(service => service.GetAdvertisements()).Returns(expected); var accountModelService = new NewsPublisherModelService(_dataAccess.Object, _advertisement.Object); var result = accountModelService.GetNewsContents(pageId); Assert.IsNotNull(result); }
public void RegisterNewsSource_AddedSuccessfully() { // Arrange bool expected = true; var request = new NewsSourceProvider { Name = "GoogleNews", Email = "*****@*****.**", Contact = "5454545555" }; _dataAccess.Setup(service => service.RegisterNewsSource(It.IsAny <NewsProviderEntity>())).Returns(expected); var accountModelService = new NewsPublisherModelService(_dataAccess.Object, null); //Act var result = accountModelService.RegisterNewsSource(request); // Assert Assert.AreSame("News provider added successfully.", result.Message); }
public void RegisterNewsSource_SomethingWentWrong() { // Arrange bool expected = false; var request = new NewsSourceProvider { Name = "GoogleNews", Email = "*****@*****.**", Contact = "5454545555" }; _dataAccess.Setup(service => service.RegisterNewsSource(It.IsAny <NewsProviderEntity>())).Returns(expected); var accountModelService = new NewsPublisherModelService(_dataAccess.Object, null); //Act var result = accountModelService.RegisterNewsSource(request); //Assert Assert.AreSame("Something went wrong", result.ErrorMessage); }