public void TestInitialize()
        {
            RepositoryTestsHelper.Init("WorkOrders");
            IOdataProvider  odataProvider  = new OdataProvider();
            IModelConverter modelConverter = new ModelConverter(new TypeConverterProvider(), new DateTimeProvider());

            _repository = new WorkOrderReadRepository(new PersistenceContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)), odataProvider, modelConverter);
        }
예제 #2
0
            public static IEnumerable <WorkOrder> GetWorkOrders()
            {
                var odataProvider  = new OdataProvider();
                var modelConverter = new ModelConverter(new TypeConverterProvider(), new DateTimeProvider());
                var repository     = new WorkOrderReadRepository(new PersistenceContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)), odataProvider, modelConverter);
                var result         = repository.ListAsync(null, null, null).Result;

                return(result);
            }
        public void GetFilterPredicateShouldSucceed(string filter)
        {
            // Arrange
            IOdataProvider odataProvider = new OdataProvider();

            // Act
            var result = odataProvider.GetFilterPredicate(filter);

            // Assert
            result.Should().NotBeNull();
        }
예제 #4
0
        public void FilterTransformShouldReturnCorrectResult(string filter, Dictionary <string, string> replacements, string expected)
        {
            // Arrange
            IOdataProvider odataProvider = new OdataProvider();

            // Act
            var result = odataProvider.FilterTransform(filter, replacements);

            // Assert
            result.Should().Be(expected);
        }
예제 #5
0
            public static WorkOrder CreateWorkOrder(Guid id, string userCreated, Order order)
            {
                // prepare
                var odataProvider   = new OdataProvider();
                var modelConverter  = new ModelConverter(new TypeConverterProvider(), new DateTimeProvider());
                var writeRepository = new WorkOrderWriteRepository(new PersistenceContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)), modelConverter);
                var readRepository  = new WorkOrderReadRepository(new PersistenceContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)), odataProvider, modelConverter);

                // create
                var startCreatedOn = new CreatedOn(DateTime.Now.AddHours(-5).ToUniversalTime());

                var operational = new Operational(Status.Open);
                var workOrder   = new WorkOrder(id, true, order, operational, userCreated, startCreatedOn);

                writeRepository.CreateAsync(workOrder).GetAwaiter().GetResult();

                // result
                var result = readRepository.GetAsync(id).Result;

                return(result);
            }