Пример #1
0
        public async Task GetProducerEeeDataCsvHandler_ComplianceYear_B2C_ReturnsFileContent()
        {
            // Arrange
            int complianceYear = 2016;

            IWeeeAuthorization authorization = AuthorizationBuilder.CreateUserWithAllRights();

            GetProducerEeeDataCsvHandler handler = new GetProducerEeeDataCsvHandler(
                authorization,
                A.Dummy <IGetProducerEeeDataCsvDataAccess>(),
                A.Dummy <CsvWriterFactory>());

            GetProducerEeeDataCsv request = new GetProducerEeeDataCsv(complianceYear, null, ObligationType.B2C);

            // Act
            CSVFileData data = await handler.HandleAsync(request);

            // Assert
            Assert.NotEmpty(data.FileContent);
        }
        public async Task GetProducerEeeDataCsvHandler_ComplianceYear_B2C_ReturnsFileContent()
        {
            // Arrange
            int complianceYear = 2016;

            IWeeeAuthorization authorization = AuthorizationBuilder.CreateUserWithAllRights();

            GetProducerEeeDataCsvHandler handler = new GetProducerEeeDataCsvHandler(
                authorization,
                A.Dummy<IGetProducerEeeDataCsvDataAccess>(),
                A.Dummy<CsvWriterFactory>());

            GetProducerEeeDataCsv request = new GetProducerEeeDataCsv(complianceYear, null, ObligationType.B2C);

            // Act
            CSVFileData data = await handler.HandleAsync(request);

            // Assert
            Assert.NotEmpty(data.FileContent);
        }
Пример #3
0
        public async Task GetProducerEeeDataCsvHandler_NotInternalUser_ThrowsSecurityException()
        {
            // Arrange
            int complianceYear = 2016;

            IWeeeAuthorization authorization = new AuthorizationBuilder().DenyInternalAreaAccess().Build();

            GetProducerEeeDataCsvHandler handler = new GetProducerEeeDataCsvHandler(
                authorization,
                A.Dummy <IGetProducerEeeDataCsvDataAccess>(),
                A.Dummy <CsvWriterFactory>());

            GetProducerEeeDataCsv request = new GetProducerEeeDataCsv(complianceYear, null, ObligationType.B2B);

            // Act
            Func <Task> action = async() => await handler.HandleAsync(request);

            // Assert
            await Assert.ThrowsAsync <SecurityException>(action);
        }
        public async Task GetProducerEeeDataCsvHandler_NotInternalUser_ThrowsSecurityException()
        {
            // Arrange
            int complianceYear = 2016;

            IWeeeAuthorization authorization = new AuthorizationBuilder().DenyInternalAreaAccess().Build();

            GetProducerEeeDataCsvHandler handler = new GetProducerEeeDataCsvHandler(
                authorization,
                A.Dummy<IGetProducerEeeDataCsvDataAccess>(),
                A.Dummy<CsvWriterFactory>());

            GetProducerEeeDataCsv request = new GetProducerEeeDataCsv(complianceYear, null, ObligationType.B2B);

            // Act
            Func<Task> action = async () => await handler.HandleAsync(request);

            // Assert
            await Assert.ThrowsAsync<SecurityException>(action);
        }