public async Task HandleAsync_WithSchemeSpecified_GeneratesCorrectFileName()
        {
            IWeeeAuthorization authorization = AuthorizationBuilder.CreateUserWithAllRights();

            IStoredProcedures storedProcedures = A.Fake <IStoredProcedures>();

            SpgSchemeWeeeCsvResult storedProcedureResult = new SpgSchemeWeeeCsvResult();

            storedProcedureResult.Schemes.Add(new SpgSchemeWeeeCsvResult.SchemeResult()
            {
                SchemeId       = new Guid("C5AD2FF9-941D-4D6F-B68B-9805DD7E1FD1"),
                ApprovalNumber = "WEE/AA1111AA/SCH"
            });

            A.CallTo(() => storedProcedures.SpgSchemeWeeeCsvAsync(A <int> ._, A <Guid?> ._, A <string> ._))
            .Returns(storedProcedureResult);

            GetSchemeWeeeCsvHandler handler = new GetSchemeWeeeCsvHandler(
                storedProcedures,
                authorization,
                A.Dummy <CsvWriterFactory>());

            GetSchemeWeeeCsv request = new GetSchemeWeeeCsv(2016, new Guid("C5AD2FF9-941D-4D6F-B68B-9805DD7E1FD1"), ObligationType.B2C);

            // Act
            SystemTime.Freeze(new DateTime(2016, 12, 31, 23, 59, 0));
            FileInfo result = await handler.HandleAsync(request);

            SystemTime.Unfreeze();

            // Assert
            Assert.Equal("2016_WEEAA1111AASCH_B2C_schemeWEEE_31122016_2359.csv", result.FileName);
        }
Пример #2
0
 public GetSchemeWeeeCsvHandler(
     IStoredProcedures storedProcedures,
     IWeeeAuthorization authorization,
     CsvWriterFactory csvWriterFactory)
 {
     this.storedProcedures = storedProcedures;
     this.authorization    = authorization;
     this.csvWriterFactory = csvWriterFactory;
 }
        public GetAllAatfSentOnDataCsvHandlerTests()
        {
            context          = A.Fake <WeeeContext>();
            commonDataAccess = A.Fake <ICommonDataAccess>();
            storedProcedures = A.Fake <IStoredProcedures>();
            fixture          = new Fixture();

            A.CallTo(() => context.StoredProcedures).Returns(storedProcedures);

            handler = new GetAllAatfSentOnDataCsvHandler(new AuthorizationBuilder().AllowInternalAreaAccess().Build(), context, commonDataAccess);
        }
Пример #4
0
        public WeeeContext(IUserContext userContext, IEventDispatcher dispatcher)
            : base("name=Weee.DefaultConnection")
        {
            this.userContext = userContext;
            this.dispatcher  = dispatcher;

            Database.SetInitializer <WeeeContext>(null);

            StoredProcedures = new StoredProcedures(this);

            // Set internal db sets
            AllRegisteredProducers = Set <RegisteredProducer>();
            AllProducerSubmissions = Set <ProducerSubmission>();
        }
        public GetUkNonObligatedWeeeReceivedDataCsvHandlerTests()
        {
            context          = A.Fake <WeeeContext>();
            csvWriterFactory = A.Fake <CsvWriterFactory>();
            storedProcedures = A.Fake <IStoredProcedures>();
            fixture          = new Fixture();

            A.CallTo(() => context.StoredProcedures).Returns(storedProcedures);

            handler = new GetUkNonObligatedWeeeReceivedDataCsvHandler(
                new AuthorizationBuilder().AllowInternalAreaAccess().Build(),
                context,
                csvWriterFactory);
        }
Пример #6
0
        public GetReturnNonObligatedCsvHandlerTests()
        {
            context          = A.Fake <WeeeContext>();
            csvWriterFactory = A.Fake <CsvWriterFactory>();
            dataAccess       = A.Fake <IGenericDataAccess>();
            storedProcedures = A.Fake <IStoredProcedures>();
            fixture          = new Fixture();

            A.CallTo(() => context.StoredProcedures).Returns(storedProcedures);

            var authorization = new AuthorizationBuilder().AllowInternalAreaAccess().Build();

            handler = new GetReturnNonObligatedCsvHandler(authorization, context, dataAccess, csvWriterFactory);
        }
Пример #7
0
        public GetPcsAatfComparisonDataHandlerTests()
        {
            context          = A.Fake <WeeeContext>();
            csvWriterFactory = A.Fake <CsvWriterFactory>();
            fixture          = new Fixture();
            storedProcedures = A.Fake <IStoredProcedures>();
            commonDataAccess = A.Fake <ICommonDataAccess>();

            A.CallTo(() => context.StoredProcedures).Returns(storedProcedures);

            handler = new GetPcsAatfComparisonDataHandler(new AuthorizationBuilder().AllowInternalAreaAccess().Build(),
                                                          context,
                                                          csvWriterFactory,
                                                          commonDataAccess);
        }
Пример #8
0
 public MainWindow()
 {
     InitializeComponent();
     switch (ConfigurationManager.AppSettings["dbtype"])
     {
         case "pg":
             readData = new PgSqlServer(ConfigurationManager.AppSettings["conn"]);
             break;
         case "sqlserver":
         default:
             readData = new SqlServer(ConfigurationManager.AppSettings["conn"]);
             break;
     }
     SearchText.ItemsSource = readData.GetRoutines().ToArray();
 }
Пример #9
0
        public DatabaseWrapper()
        {
            // Create test user(context auditing requires a valid user id)
            var userId = string.Empty;

            using (var model = new Entities())
            {
                var testUserName = "******";
                var testUser     = model.AspNetUsers.FirstOrDefault(u => u.UserName == testUserName);

                if (testUser == null)
                {
                    testUser = new AspNetUser
                    {
                        Id             = Guid.NewGuid().ToString(),
                        FirstName      = "Test",
                        Surname        = "LastName",
                        Email          = "[email protected]",
                        EmailConfirmed = true,
                        UserName       = testUserName
                    };

                    model.AspNetUsers.Add(testUser);
                    model.SaveChanges();
                }

                userId = testUser.Id;
            }

            transactionScope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);

            Model = new Entities();

            IUserContext userContext = A.Fake <IUserContext>();

            A.CallTo(() => userContext.UserId)
            .ReturnsLazily(() => Guid.Parse(userId));

            IEventDispatcher eventDispatcher = A.Fake <IEventDispatcher>();

            WeeeContext = new WeeeContext(userContext, eventDispatcher);

            StoredProcedures = new StoredProcedures(WeeeContext);
        }
        public RegistrationParticipantController(
            IInfoAboutParticipant iinfoParticipant,
            IOfficeEntities iOfficeEntities,
            IStoredProcedures istoredP
            )
        {
            this.iinfoParticipant = iinfoParticipant;
            this.ikartoteka2      = new Kartoteka2Info();
            this.idystans         = new DystansFiltr();
            this.iOfficeEntities  = iOfficeEntities;
            this.istoredP         = istoredP;

            this.icheck             = new CheckWerification();
            this.inewRec            = new NewRecord();
            this.iaddZaw            = new AddZawodnik(icheck);
            this.iplayer            = new PlayerVerification();
            this.isimpleAdd         = new SimpleAddingParticipant(inewRec, iaddZaw, iplayer);
            this.ireport            = new ParticipantResult();
            this.iresultParticipant = new ParticipantResultList();
        }
Пример #11
0
 public SqlDbService(IStoredProcedures storedProcedures)
 {
     _storedProcedures = storedProcedures;
 }
Пример #12
0
 public ParticipantStart()
 {
     this.ipartipantStart   = new ParticipantStart();
     this.istoredprocedures = new StoredProceduresOfficeMarathon();
 }
 public AEntityRepository(IUnitOfWork unitOfWork, IStoredProcedures storedProcedures)
 {
 }
Пример #14
0
 public SqlDbService(IStoredProcedures storedProcedures)
 {
     _storedProcedures = storedProcedures;
 }
Пример #15
0
        public DatabaseWrapper()
        {
            // Create test user(context auditing requires a valid user id)
            var userId = string.Empty;
            using (var model = new Entities())
            {
                var testUserName = "******";
                var testUser = model.AspNetUsers.FirstOrDefault(u => u.UserName == testUserName);

                if (testUser == null)
                {
                    testUser = new AspNetUser
                    {
                        Id = Guid.NewGuid().ToString(),
                        FirstName = "Test",
                        Surname = "LastName",
                        Email = "[email protected]",
                        EmailConfirmed = true,
                        UserName = testUserName
                    };

                    model.AspNetUsers.Add(testUser);
                    model.SaveChanges();
                }

                userId = testUser.Id;
            }

            transactionScope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);

            Model = new Entities();

            IUserContext userContext = A.Fake<IUserContext>();
            A.CallTo(() => userContext.UserId)
                .ReturnsLazily(() => Guid.Parse(userId));

            IEventDispatcher eventDispatcher = A.Fake<IEventDispatcher>();

            WeeeContext = new WeeeContext(userContext, eventDispatcher);

            StoredProcedures = new StoredProcedures(WeeeContext);
        }
Пример #16
0
        public WeeeContext(IUserContext userContext, IEventDispatcher dispatcher)
            : base("name=Weee.DefaultConnection")
        {
            this.userContext = userContext;
            this.dispatcher = dispatcher;

            Database.SetInitializer<WeeeContext>(null);

            StoredProcedures = new StoredProcedures(this);

            // Set internal db sets
            AllRegisteredProducers = Set<RegisteredProducer>();
            AllProducerSubmissions = Set<ProducerSubmission>();
        }