Exemplo n.º 1
0
 public UserService(CaffStoreDbContext context, IHttpRequestContext requestContext, UserManager <User> userManager, IMapper mapper)
 {
     _context        = context;
     _requestContext = requestContext;
     _userManager    = userManager;
     _mapper         = mapper;
 }
 public CaffItemService(CaffStoreDbContext context, IHttpRequestContext requestContext, IFileService fileService, IMapper mapper)
 {
     _context        = context;
     _requestContext = requestContext;
     _fileService    = fileService;
     _mapper         = mapper;
 }
Exemplo n.º 3
0
        public FileService(CaffStoreDbContext context, IConfiguration configuration)
        {
            _context = context;

            var blobStorageOptions = new BlobStorageOptions();

            configuration.Bind(nameof(BlobStorageOptions), blobStorageOptions);

            _sasTokenLifetimeSeconds = blobStorageOptions.SasTokenLifetimeSeconds;

            _sharedKeyCredential = new StorageSharedKeyCredential(blobStorageOptions.StorageAccountName, blobStorageOptions.StorageAccountKey);

            var blobServiceClient = new BlobServiceClient(blobStorageOptions.StorageAccountUri, _sharedKeyCredential);

            _caffBlobContainerClient    = blobServiceClient.GetBlobContainerClient(blobStorageOptions.CaffContainerName);
            _previewBlobContainerClient = blobServiceClient.GetBlobContainerClient(blobStorageOptions.PreviewContainerName);
        }
Exemplo n.º 4
0
 public CaffService(CaffStoreDbContext context, IFileSettings fileSettings, ICAFFparserSettings parserSettings)
 {
     _context        = context;
     _fileSettings   = fileSettings;
     _parserSettings = parserSettings;
 }
Exemplo n.º 5
0
 public CommentService(CaffStoreDbContext context, IHttpRequestContext requestContext, IMapper mapper)
 {
     _context        = context;
     _requestContext = requestContext;
     _mapper         = mapper;
 }
Exemplo n.º 6
0
 public AdminCaffItemService(CaffStoreDbContext context, IFileService fileService, IMapper mapper)
 {
     _context     = context;
     _fileService = fileService;
     _mapper      = mapper;
 }
 public AdminUserService(CaffStoreDbContext context, UserManager <User> userManager, IMapper mapper)
 {
     _context     = context;
     _userManager = userManager;
     _mapper      = mapper;
 }
Exemplo n.º 8
0
 public AdminCommentService(CaffStoreDbContext context)
 {
     _context = context;
 }
Exemplo n.º 9
0
        public DatabaseFixture(ITimeService timeService, IHttpRequestContext requestContext)
        {
            var options = new DbContextOptionsBuilder <CaffStoreDbContext>()
                          .UseInMemoryDatabase("CaffStore" + Guid.NewGuid())
                          .Options;

            Context = new CaffStoreDbContext(options, timeService, requestContext);

            Context.Users.Add(new User
            {
                Id                   = 1,
                Email                = "test@test",
                EmailConfirmed       = false,
                PhoneNumberConfirmed = false,
                TwoFactorEnabled     = false,
                LockoutEnabled       = false,
                AccessFailedCount    = 0,
                FirstName            = "Test",
                LastName             = "Name",
                IsDeleted            = false
            });

            var caffItem = new CaffItem
            {
                Id          = 1,
                Title       = "Test Title",
                Description = "Test Description",
                CaffData    = new CaffData
                {
                    Creation   = DateTime.Now,
                    Creator    = "Test Creator",
                    Animations = new List <CaffAnimationData>
                    {
                        new CaffAnimationData
                        {
                            Order    = 0,
                            Duration = 100,
                            CiffData = new CiffData
                            {
                                Width   = 300,
                                Height  = 500,
                                Caption = "Test Caption",
                                Tags    = new List <CiffDataTag>
                                {
                                    new CiffDataTag {
                                        Tag = new Tag {
                                            Text = "Test Tag"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };

            var deletedCaffItem = new CaffItem
            {
                Id          = 2,
                Title       = "Deleted Test Title",
                Description = "Deleted Test Description",
                CaffData    = new CaffData
                {
                    Creation   = DateTime.Now.AddDays(-1),
                    Creator    = "Deleted Test Creator",
                    Animations = new List <CaffAnimationData>
                    {
                        new CaffAnimationData
                        {
                            Order    = 0,
                            Duration = 100,
                            CiffData = new CiffData
                            {
                                Width   = 300,
                                Height  = 500,
                                Caption = "Deleted Test Caption",
                                Tags    = new List <CiffDataTag>
                                {
                                    new CiffDataTag {
                                        Tag = new Tag {
                                            Text = "Test Tag"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };

            Context.CaffItems.Add(caffItem);
            Context.CaffItems.Add(deletedCaffItem);

            Context.CaffItemComments.Add(new CaffItemComment
            {
                CaffItem = caffItem,
                Comment  = new Comment
                {
                    Id   = 1,
                    Text = "Test comment",
                }
            });

            Context.SaveChanges();
        }