public StatisticsServiceTests()
        {
            _tolkDbContext = CreateTolkDbContext();
            _clock         = new StubSwedishClock(DateTimeOffset.Now.ToString());

            var mockLanguages     = MockEntities.MockLanguages;
            var mockRankings      = MockEntities.MockRankings;
            var mockCustomers     = MockEntities.MockCustomers;
            var mockCustomerUsers = MockEntities.MockCustomerUsers(mockCustomers);
            var mockOrders        = MockEntities.MockOrders(mockLanguages, mockRankings, mockCustomerUsers);
            var mockRequisitions  = MockEntities.MockRequisitions(mockOrders);
            var mockComplaints    = MockEntities.MockComplaints(mockOrders);
            var regions           = Region.Regions;

            //Initialize data if not already initialized
            if (!_tolkDbContext.CustomerOrganisations.Any())
            {
                _tolkDbContext.AddRange(mockCustomers);
                _tolkDbContext.AddRange(mockCustomerUsers);
                _tolkDbContext.AddRange(mockLanguages);
                _tolkDbContext.AddRange(mockRankings);
                _tolkDbContext.AddRange(mockOrders);
                _tolkDbContext.AddRange(mockRequisitions);
                _tolkDbContext.AddRange(mockComplaints);
                _tolkDbContext.AddRange(regions);
            }
            _tolkDbContext.SaveChanges();
            _statService = new StatisticsService(_tolkDbContext, _clock);
        }
Beispiel #2
0
        public OrderTests()
        {
            var mockLanguages     = MockEntities.MockLanguages;
            var mockRankings      = MockEntities.MockRankings;
            var mockCustomerUsers = MockEntities.MockCustomerUsers(MockEntities.MockCustomers);

            MockOrders = MockEntities.MockOrders(mockLanguages, mockRankings, mockCustomerUsers);
        }
Beispiel #3
0
        public RequestFilterModelTests()
        {
            var mockRankings      = MockEntities.MockRankings;
            var mockCustomerUsers = MockEntities.MockCustomerUsers(MockEntities.MockCustomers);
            var mockOrders        = MockEntities.MockOrders(mockLanguages, mockRankings, mockCustomerUsers);

            requests = MockEntities.MockRequests(mockOrders);
        }
        public EntityExtensionsTests()
        {
            var mockLanguages = MockEntities.MockLanguages;
            var mockRankings  = MockEntities.MockRankings;

            MockCustomerUsers = MockEntities.MockCustomerUsers(MockEntities.MockCustomers);
            MockOrders        = MockEntities.MockOrders(mockLanguages, mockRankings, MockCustomerUsers);
        }
Beispiel #5
0
        public RequisitionFilterModelTests()
        {
            mockLanguages = MockEntities.MockLanguages;
            var mockRankings      = MockEntities.MockRankings;
            var mockCustomerUsers = MockEntities.MockCustomerUsers(MockEntities.MockCustomers);
            var mockOrders        = MockEntities.MockOrders(mockLanguages, mockRankings, mockCustomerUsers);

            mockRequisitions = MockEntities.MockRequisitions(mockOrders);
        }
        public OrderFilterModelTests()
        {
            var mockRankings = MockEntities.MockRankings;

            mockLanguages     = MockEntities.MockLanguages;
            MockCustomerUsers = MockEntities.MockCustomerUsers(MockEntities.MockCustomers);
            mockOrders        = MockEntities.MockOrders(mockLanguages, mockRankings, MockCustomerUsers);

            // Modify request statuses
            mockOrders[0].Requests[0].Status = RequestStatus.DeniedByCreator;
            mockOrders[5].Requests[0].Status = RequestStatus.CancelledByBroker;
            mockOrderListRows = MockEntities.MockOrderListRows(mockOrders.ToList());
        }
Beispiel #7
0
        public AssignmentFilterModelTests()
        {
            _clock = new StubSwedishClock("2018-09-03 12:57:14");

            mockLanguages = MockEntities.MockLanguages;
            var mockRankings      = MockEntities.MockRankings;
            var mockCustomerUsers = MockEntities.MockCustomerUsers(MockEntities.MockCustomers);
            var mockOrders        = MockEntities.MockOrders(mockLanguages, mockRankings, mockCustomerUsers);
            var mockRequisitions  = MockEntities.MockRequisitions(mockOrders);

            mockOrders   = MockEntities.LinkRequisitionsInOrdersRequests(mockOrders, mockRequisitions);
            mockRequests = MockEntities.GetRequestsFromOrders(mockOrders);
        }