public void ItShouldThrowExceptionWhenCreatingAnExistingPlan() { var dataService = new Mock <IForecastDataAccessService>(); dataService.Setup(x => x.PlanExist("Plan")).Returns(true); var service = new ForecastService <decimal>(dataService.Object); Assert.Throws(typeof(ForecastServiceException), () => service.CreatePlan("Plan", "Plan", 1, "userName", 1, 12)); }