Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the FactsController class.
 /// It's being called by the StartUp class.
 /// </summary>
 /// <param name="factsService">A required service for the class.</param>
 /// <param name="tagsService">A required service for the class.</param>
 /// <param name="usersService">A required service for the class.</param>
 public FactsController(IFactsService factsService, ITagsService tagsService, IUsersService usersService, IThemesService themesService)
 {
     this.factsService  = factsService;
     this.tagsService   = tagsService;
     this.usersService  = usersService;
     this.themesService = themesService;
 }
        public async Task GetAllFacts_WithZeroData_ShouldReturnEmptyResult()
        {
            string errorMessagePrefix = "FactsService Method GetAllFacts() does not work properly.";

            var context = CDGBulgariaInmemoryFactory.InitializeContext();

            this.factsService = new FactsService(context);

            List <FactServiceModel> actualResults = await this.factsService.GetAllFacts().ToListAsync();

            Assert.True(actualResults.Count == 0, errorMessagePrefix);
        }
        public async Task Create_WithCorrectData_ShouldSuccesfullyCreate()
        {
            string errorMessagePrefix = "FactsService Method CreateEvent() does not work properly.";

            var context = CDGBulgariaInmemoryFactory.InitializeContext();

            this.factsService = new FactsService(context);

            FactServiceModel factus = new FactServiceModel()
            {
                Content = "There are not yet found medicines for this desease.",
                PdfFile = "src/pics/something/sofia.pdf"
            };

            bool actualResult = await this.factsService.Create(factus);

            Assert.True(actualResult, errorMessagePrefix);
        }
        public async Task GetAllFacts_WithInitialData_ShouldReturnCorrectResult()
        {
            string errorMessagePrefix = "FactsService Method GetAllFacts() does not work properly.";

            var context = CDGBulgariaInmemoryFactory.InitializeContext();

            await SeedData(context);

            this.factsService = new FactsService(context);

            List <FactServiceModel> actualResults = await this.factsService.GetAllFacts().ToListAsync();

            List <FactServiceModel> expectedResults = GetInitialData().To <FactServiceModel>().ToList();

            for (int i = 0; i < expectedResults.Count; i++)
            {
                var expectedEntry = expectedResults[i];
                var actualEntry   = actualResults[i];

                Assert.True(expectedEntry.Content == actualEntry.Content, errorMessagePrefix + " " + "Content is not returned properly");
                Assert.True(expectedEntry.PdfFile == actualEntry.PdfFile, errorMessagePrefix + " " + "PdfFile is not returned properly");
            }
        }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the HomeController class.
 /// It's being called by the StartUp class.
 /// </summary>
 /// <param name="themesService">A required service for the class.</param>
 /// <param name="factsService">A required service for the class.</param>
 public HomeController(IThemesService themesService, IFactsService factsService)
 {
     this.themesService = themesService;
     this.factsService  = factsService;
 }
 public FactsController(IFactsService factsService, ICloudinaryService cloudinaryService)
 {
     this.factsService      = factsService;
     this.cloudinaryService = cloudinaryService;
 }
 public FactsController(IFactsService factsService)
 {
     this.factsService = factsService;
 }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the AccountController class.
 /// It's being called by the StartUp class.
 /// </summary>
 /// <param name="userService">A required service for the class.</param>
 /// <param name="factsService">A required service for the class.</param>
 public AccountController(IUsersService userService, IFactsService factsService)
 {
     this.userService  = userService;
     this.factsService = factsService;
 }