public void MakePublic_SetsInvalidActionBenefit_IsPublic_ToValue_ThrowException() { DbContextInMemory testData = new DbContextInMemory(); MyDbContext context = testData._context; ActionBenefitService actionBenefitService = new ActionBenefitService(new MySqlActionBenefitRepository(context), new MySqlPharmacyRepo(context)); var rabbitServiceMock = new Mock <IRabbitMqActionBenefitService>(); var controller = new ActionBenefitServiceController(actionBenefitService, rabbitServiceMock.Object); Assert.Throws <ArgumentException>(() => controller.SetPublic(new SetPublicRequest() { Id = 5, IsPublic = true })); }
public void MakePublic_SetsActionBenefit_IsPublic_ToValue() { DbContextInMemory testData = new DbContextInMemory(); MyDbContext context = testData._context; ActionBenefitService actionBenefitService = new ActionBenefitService(new MySqlActionBenefitRepository(context), new MySqlPharmacyRepo(context)); var rabbitServiceMock = new Mock <IRabbitMqActionBenefitService>(); var controller = new ActionBenefitServiceController(actionBenefitService, rabbitServiceMock.Object); Assert.False(actionBenefitService.GetActionBenefitById(1).IsPublic); controller.SetPublic(new SetPublicRequest() { Id = 1, IsPublic = true }); Assert.True(actionBenefitService.GetActionBenefitById(1).IsPublic); }