public void Init() { announcementRepository = Substitute.For <IAnnouncementRepository>(); var mapper = new MapperConfiguration(x => x.AddProfile(new MappingProfile())).CreateMapper(); log = Substitute.For <ILog>(); config = Substitute.For <IConfigProvider>(); blobStorageService = Substitute.For <IBlobStorageService>(); fileProcesingService = Substitute.For <IFileProcesingService>(); announcementService = new AnnouncementService(announcementRepository, blobStorageService, fileProcesingService, config, mapper, log); file = Substitute.For <IFormFile>(); var content = "pruebaimagen"; var fileName = "test.png"; var memoryStreamFile = new MemoryStream(); var writer = new StreamWriter(memoryStreamFile); writer.Write(content); writer.Flush(); memoryStreamFile.Position = 0; file.OpenReadStream().Returns(memoryStreamFile); file.FileName.Returns(fileName); announcementDto = new AnnouncementDto { IdAnnouncement = 0, Description = "Auncio prueba", DescriptionCallToAction = "", ImageId = "", Order = 0, State = true, ThumbnailImageId = "", Title = "Auncio prueba", UrlCallToAction = "", UrlImage = "", UrlThumbnailImage = "" }; announcement = new Announcement { IdAnnouncement = 0, Description = "Auncio prueba", DescriptionCallToAction = "", ImageId = "", Order = 0, State = true, ThumbnailImageId = "", Title = "Auncio prueba", UrlCallToAction = "", UrlImage = "", UrlThumbnailImage = "" }; }
public AnnouncementService(IAnnouncementRepository announcementRepository, IBlobStorageService blobStorageService, IFileProcesingService fileProcesingService, IConfigProvider config, IMapper mapper, ILog log) : base(announcementRepository, log, mapper) { this.announcementRepository = announcementRepository; this.blobStorageService = blobStorageService; this.fileProcesingService = fileProcesingService; this.mapper = mapper; this.config = config; }