public OrderAgreementTests() { var mockCustomerUsers = MockEntities.MockCustomerUsers(MockEntities.MockCustomers); MockOrder = new Order(mockCustomerUsers[2], null, mockCustomerUsers[2].CustomerOrganisation, new DateTimeOffset(2018, 05, 07, 13, 00, 00, new TimeSpan(02, 00, 00))) { OrderId = 8, CustomerReferenceNumber = "EmptyOrder", OrderNumber = "2018-000008", Status = OrderStatus.Requested, Requests = new List <Request>() }; MockRequest = new Request { Status = RequestStatus.Approved, Order = new Order(MockOrder) { Status = OrderStatus.RequestResponded, }, Ranking = new Ranking { RankingId = 1, Broker = new Broker { Name = "MockBroker", OrganizationNumber = "123123-1234" }, Rank = 1 }, }; MockRequisition = new Requisition { Status = RequisitionStatus.Created, Request = MockRequest }; }
public RequisitionTests() { var mockCustomerUsers = MockEntities.MockCustomerUsers(MockEntities.MockCustomers); MockOrder = new Order(mockCustomerUsers[2], null, mockCustomerUsers[2].CustomerOrganisation, new DateTimeOffset(2018, 05, 07, 13, 00, 00, new TimeSpan(02, 00, 00))) { OrderId = 8, CustomerReferenceNumber = "EmptyOrder", OrderNumber = "2018-000008", Status = OrderStatus.Requested, Requests = new List <Request>() }; MockRequisition = new Requisition { Status = RequisitionStatus.Created, Request = new Request { Status = RequestStatus.Approved, Order = new Order(MockOrder) { Status = OrderStatus.RequestResponded, }, }, }; MockRequisition.Request.Order.Requests.Add(MockRequisition.Request); //when a requisition is created order get status Delivered MockRequisition.Request.Order.Status = OrderStatus.Delivered; MockRequisition.RequisitionStatusConfirmations = new List <RequisitionStatusConfirmation>(); }
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); }
public OrderTests() { var mockLanguages = MockEntities.MockLanguages; var mockRankings = MockEntities.MockRankings; var mockCustomerUsers = MockEntities.MockCustomerUsers(MockEntities.MockCustomers); MockOrders = MockEntities.MockOrders(mockLanguages, mockRankings, mockCustomerUsers); }
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); }
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()); }
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); }
public OrderGroupTests() { MockOrderGroups = MockEntities.MockOrderGroups(MockEntities.MockLanguages, MockEntities.MockRankings, MockEntities.MockCustomerUsers(MockEntities.MockCustomers)); }
private TolkDbContext GetContext(string name, bool customerHasOrderAgreementSetting = true) { var tolkDbContext = CreateTolkDbContext(name); var mockCustomerUsers = MockEntities.MockCustomerUsers(MockEntities.MockCustomers); var mockOrder = new Order(mockCustomerUsers[0], null, mockCustomerUsers[0].CustomerOrganisation, new DateTimeOffset(2018, 05, 07, 13, 00, 00, new TimeSpan(02, 00, 00))) { OrderId = 8, CustomerReferenceNumber = "EmptyOrder", OrderNumber = "2018-000008", Status = OrderStatus.Requested, Requests = new List <Request>() }; var mockCustomerSettings = new CustomerSetting { CustomerOrganisationId = 1, CustomerSettingType = CustomerSettingType.UseOrderAgreements, Value = customerHasOrderAgreementSetting }; var mockRequest = new Request { RequestId = 1, Status = RequestStatus.Delivered, Order = new Order(mockOrder) { CustomerOrganisationId = 1, OrderNumber = OrderNumber, Status = OrderStatus.RequestResponded, EndAt = DateTime.Parse("2018-12-10 10:00:00").ToDateTimeOffsetSweden() }, Ranking = new Ranking { RankingId = 1, Broker = new Broker { Name = "MockBroker", OrganizationNumber = "123123-1234" }, Rank = 1 }, }; var mockRequisition = new Requisition { RequisitionId = 1, Status = RequisitionStatus.Created, SessionStartedAt = new DateTime(2018, 12, 10, 10, 10, 10), SessionEndedAt = new DateTime(2018, 12, 10, 12, 10, 10), Request = mockRequest }; if (!tolkDbContext.Requisitions.Any(r => r.RequisitionId == mockRequisition.RequisitionId)) { tolkDbContext.Add(mockRequisition); } if (!tolkDbContext.Requests.Any(r => r.RequestId == mockRequest.RequestId)) { tolkDbContext.Add(mockRequest); } if (!tolkDbContext.CustomerSettings.Any(r => r.CustomerOrganisationId == mockCustomerSettings.CustomerOrganisationId)) { tolkDbContext.Add(mockCustomerSettings); } else { tolkDbContext.CustomerSettings.Where(r => r.CustomerOrganisationId == mockCustomerSettings.CustomerOrganisationId && r.CustomerSettingType == mockCustomerSettings.CustomerSettingType).Single().Value = customerHasOrderAgreementSetting; } tolkDbContext.AddRange(MockEntities.MockRequisitionPriceRows.Where(pr => !tolkDbContext.RequisitionPriceRows.Select(r => r.RequisitionPriceRowId).Contains(pr.RequisitionPriceRowId))); tolkDbContext.AddRange(MockEntities.MockRequestPriceRows.Where(pr => !tolkDbContext.RequestPriceRows.Select(r => r.RequestPriceRowId).Contains(pr.RequestPriceRowId))); tolkDbContext.OrderAgreementPayloads.FromSqlRaw("delete from OrderAgreementPayloads"); tolkDbContext.SaveChanges(); return(tolkDbContext); }
public ComplaintFilterModelTests() { var mockCustomerUsers = MockEntities.MockCustomerUsers(MockEntities.MockCustomers); complaints = new[] { new Complaint { Request = new Request { Order = new Order(mockCustomerUsers[0], null, mockCustomerUsers[0].CustomerOrganisation, DateTimeOffset.Now) { OrderNumber = "2018-000000" } }, Status = ComplaintStatus.Confirmed }, new Complaint { Request = new Request { Order = new Order(mockCustomerUsers[0], null, mockCustomerUsers[0].CustomerOrganisation, DateTimeOffset.Now) { OrderNumber = "2018-000011" } }, Status = ComplaintStatus.Confirmed }, new Complaint { Request = new Request { Order = new Order(mockCustomerUsers[0], null, mockCustomerUsers[0].CustomerOrganisation, DateTimeOffset.Now) { OrderNumber = "2018-000305" } }, Status = ComplaintStatus.DisputePendingTrial }, new Complaint { Request = new Request { Order = new Order(mockCustomerUsers[0], null, mockCustomerUsers[0].CustomerOrganisation, DateTimeOffset.Now) { OrderNumber = "2018-000104" } }, Status = ComplaintStatus.TerminatedTrialConfirmedComplaint }, new Complaint { Request = new Request { Order = new Order(mockCustomerUsers[0], null, mockCustomerUsers[0].CustomerOrganisation, DateTimeOffset.Now) { OrderNumber = "2018-000331" } }, Status = ComplaintStatus.Created }, new Complaint { Request = new Request { Order = new Order(mockCustomerUsers[0], null, mockCustomerUsers[0].CustomerOrganisation, DateTimeOffset.Now) { OrderNumber = "2018-000502" } }, Status = ComplaintStatus.Created }, new Complaint { Request = new Request { Order = new Order(mockCustomerUsers[0], null, mockCustomerUsers[0].CustomerOrganisation, DateTimeOffset.Now) { OrderNumber = "2018-000971" } }, Status = ComplaintStatus.Created }, }; }