Example #1
0
        private static DataAccess CreateDataAccessLayerWithProxy()
        {
            var temporaryDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

            Directory.CreateDirectory(temporaryDirectory);

            var dataAccess = new DataAccess(temporaryDirectory);

            var entity = new ServerEntity
            {
                AutoStart            = false,
                RemoteServerHostName = SampleHostName,
                Port     = 500,
                ServerId = "ABCD",
                UseSsl   = false
            };

            dataAccess.ServerCreate(entity);

            return(dataAccess);
        }
Example #2
0
        public DataAccessTests()
        {
            _sampleProxyServer = new ServerEntity
            {
                AutoStart            = false,
                RemoteServerHostName = SampleHostName,
                Port     = 500,
                ServerId = "ABCD",
                UseSsl   = false
            };

            var originalRequest = new HttpRequestEntity()
            {
                HttpMethod       = "GET",
                BodyResourceName = null,
                Headers          = new List <NameValuePairEntity>(),
                ProtocolVersion  = "1.1",
                RawUrl           = "/"
            };

            var originalResponse = new HttpResponseEntity()
            {
                BodyResourceName = null,
                Headers          = new List <NameValuePairEntity>()
                {
                    new NameValuePairEntity
                    {
                        Name  = "Content-Type",
                        Value = "text/plain"
                    }
                },
                RedirectAddress   = null,
                StatusCode        = 200,
                StatusDescription = "OK"
            };

            var response = new HttpResponseEntity()
            {
                BodyResourceName = null,
                Headers          = new List <NameValuePairEntity>()
                {
                    new NameValuePairEntity
                    {
                        Name  = "Content-Type",
                        Value = "text/plain"
                    }
                },
                RedirectAddress   = null,
                StatusCode        = 200,
                StatusDescription = "OK"
            };

            _sampleStump = new StumpEntity
            {
                OriginalRequest  = originalRequest,
                OriginalResponse = originalResponse,
                Response         = response,
                Rules            = new List <RuleEntity>(),
                StumpCategory    = "Uncategorized",
                StumpId          = "ABCD",
                StumpName        = "MyStump"
            };

            _sampleBytes = new byte[]
            {
                1, 2, 3
            };
        }