コード例 #1
0
        public void Setup()
        {
            var mockOptions = MockOptions <WolkConfiguration> .Create(_configuration);

            _handler = new DeleteAttachmentCommandHandler(
                _mockFileService.Object,
                _wolkDbContext,
                mockOptions);
        }
        public void Setup()
        {
            _invitation = new Invitation(
                _plant,
                _projectName,
                "TestInvitation",
                "Description",
                DisciplineType.DP,
                new DateTime(),
                new DateTime(),
                null,
                new List <McPkg> {
                new McPkg(_plant, _projectName, "Comm", "Mc", "d", "1|2")
            },
                null);
            _attachment = new Attachment(_plant, "ExistingFile.txt");
            _attachment.SetProtectedIdForTesting(2);
            _invitation.AddAttachment(_attachment);

            _invitationRepositoryMock = new Mock <IInvitationRepository>();
            _invitationRepositoryMock
            .Setup(x => x.GetByIdAsync(1))
            .Returns(Task.FromResult(_invitation));

            _unitOfWorkMock = new Mock <IUnitOfWork>();

            _blobStorageMock = new Mock <IBlobStorage>();
            var blobStorageOptions = new BlobStorageOptions()
            {
                BlobContainer = "TestContainer"
            };

            _monitorMock = Mock.Of <IOptionsMonitor <BlobStorageOptions> >(x => x.CurrentValue == blobStorageOptions);

            _command = new DeleteAttachmentCommand(1, 2, "AAAAAAAAAAA=");

            _dut = new DeleteAttachmentCommandHandler(
                _invitationRepositoryMock.Object,
                _unitOfWorkMock.Object,
                _blobStorageMock.Object,
                _monitorMock);
        }