예제 #1
0
    void ProcessAssembly(List <TypeDefinition> types)
    {
        var isDebug = IncludeDebugAssert && DefineConstants.Any(c => c == "DEBUG") && ReferenceFinder.DebugAssertMethod != null;

        var methodProcessor   = new MethodProcessor(ValidationFlags, isDebug);
        var propertyProcessor = new PropertyProcessor(ValidationFlags, isDebug);

        foreach (var type in types)
        {
            if (type.IsInterface || type.ContainsAllowNullAttribute() || type.IsGeneratedCode() || type.HasInterface("Windows.UI.Xaml.Markup.IXamlMetadataProvider"))
            {
                continue;
            }

            foreach (var method in type.MethodsWithBody())
            {
                methodProcessor.Process(method);
            }

            foreach (var property in type.ConcreteProperties())
            {
                propertyProcessor.Process(property);
            }
        }
    }
        public void ProduceOfferReturnsCorrectResult(
            string street,
            string postalCode,
            string country,
            int price,
            int size)
        {
            var sut         = new PropertyMortgageApplicationProcessor();
            var application = new MortgageApplication
            {
                Property = new Property
                {
                    Address = new Address
                    {
                        Street     = street,
                        PostalCode = postalCode,
                        Country    = country
                    },
                    Price = price,
                    Size  = size
                }
            };

            var actual = sut.ProduceOffer(application);

            var expected =
                new PropertyProcessor
            {
                PriceText = "Asking price"
            }
            .ProduceRenderings(application.Property);

            Assert.Equal(expected, actual);
        }
예제 #3
0
        public void AddToFav(string propertyid)
        {
            string uname = Thread.CurrentPrincipal.Identity.Name;
            string x     = Usersecurity.getIdByName(uname);

            PropertyProcessor.AddToFav(propertyid, x);
        }
예제 #4
0
        public void SutDoesNotEqualAnonymousObject()
        {
            var sut       = new PropertyProcessor();
            var anonymous = new object();

            var actual = sut.Equals(anonymous);

            Assert.False(actual);
        }
예제 #5
0
        public async Task <HttpResponseMessage> AddProperty(Property property)
        {
            // Check if the request contains multipart/form-data.

            /*if (!Request.Content.IsMimeMultipartContent())
             * {
             *   throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
             * }*/
            if (property == null)
            {
                //return false;
                throw new HttpResponseException(HttpStatusCode.NoContent);
            }
            property.PropetyId = string.Format("{0:HH:mm:ss tt}", DateTime.Now);
            property.OwnerId   = "3";
            // return PropetyProcessor.ProcessProperty(prop);
            PropertyProcessor.ProcessProperty(property);
            return(new HttpResponseMessage(HttpStatusCode.OK));
            //string root = HttpContext.Current.Server.MapPath("~/App_Data");
            //var provider = new MultipartFormDataStreamProvider(root);
            //try
            //{
            //    StringBuilder sb = new StringBuilder(); // Holds the response body
            //                                            // Read the form data and return an async task.
            //    await Request.Content.ReadAsMultipartAsync(provider);
            //    // This illustrates how to get the form data.
            //    foreach (var key in provider.FormData.AllKeys)
            //    {
            //        foreach (var val in provider.FormData.GetValues(key))
            //        {
            //            sb.Append(string.Format("{0}: {1}\n", key, val));
            //        }
            //    }
            //    // This illustrates how to get the file names for uploaded files.
            //    foreach (var file in provider.FileData)
            //    {
            //        FileInfo fileInfo = new FileInfo(file.LocalFileName);
            //        sb.Append(string.Format("Uploaded file: {0} ({1} bytes)\n", fileInfo.Name, fileInfo.Length));
            //    }
            //    return new HttpResponseMessage()
            //    {
            //        Content = new StringContent(sb.ToString())
            //    };
            //}
            //catch (System.Exception e)
            //{
            //    return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e);
            //}
        }
		private String CallProcessLine(String line)
		{
			using (var stream = new MemoryStream())
			using (var writer = new IndentStreamWriter(stream, Encoding.UTF8))
			using (var propertyProcessor = new PropertyProcessor(line))
			{
				propertyProcessor.WriteProperty(writer);
				writer.Flush();
				stream.Flush();
				var processed = Encoding.UTF8.GetString(stream.ToArray());
				Console.WriteLine(processed);
				Console.WriteLine();
				return processed;
			}
		}
예제 #7
0
        public void SutEqualsOtherReturnsCorrectResult(
            string priceTextSut,
            string priceTextOther,
            bool expected)
        {
            var sut = new PropertyProcessor {
                PriceText = priceTextSut
            };
            var other = new PropertyProcessor {
                PriceText = priceTextOther
            };

            var actual = sut.Equals(other);

            Assert.Equal(expected, actual);
        }
예제 #8
0
        public void ProduceRenderingsReturnsCorrectResult(
            string street,
            string postalCode,
            string country,
            int price,
            int size,
            string priceText)
        {
            var sut = new PropertyProcessor
            {
                PriceText = priceText
            };
            var property = new Property
            {
                Address = new Address
                {
                    Street     = street,
                    PostalCode = postalCode,
                    Country    = country
                },
                Price = price,
                Size  = size
            };

            IEnumerable <IRendering> actual = sut.ProduceRenderings(property);

            var expected = new IRendering[]
            {
                new BoldRendering("Address:"),
                new TextRendering(
                    " " +
                    street + ", " +
                    postalCode + ", " +
                    country + ". "),
                new LineBreakRendering(),
                new BoldRendering(priceText + ":"),
                new TextRendering(" " + price),
                new LineBreakRendering(),
                new BoldRendering("Size:"),
                new TextRendering(" " + size + " square meters"),
                new LineBreakRendering()
            };

            Assert.Equal(expected, actual);
        }
    private bool ProcessProperties(PropertyProcessor processor) {
        var levelNames = GetLevelNames();
        if (propertyName == null || propertyName.Length == 0) {
            Debug.LogError("Missing SelectProperty() directive");
            return false;
        }

        for (int i = 0; i < levelNames.Count; ++i) {
            var ln = levelNames[i];
            for (int j = 0; j < propertyName.Length; ++j) {
                var pn = propertyName[j];
                if (!MadLevelProfile.IsLevelPropertySet(ln, pn)) {
                    processor(ln, pn, null);
                } else {
                    processor(ln, pn, MadLevelProfile.GetLevelAny(ln, pn));
                }
            }
        }

        return true;
    }
예제 #10
0
    void ProcessAssembly(List<TypeDefinition> types)
    {
        var isDebug = IncludeDebugAssert && DefineConstants.Any(c => c == "DEBUG") && ReferenceFinder.DebugAssertMethod != null;

        var methodProcessor = new MethodProcessor(ValidationFlags, isDebug);
        var propertyProcessor = new PropertyProcessor(ValidationFlags, isDebug);

        foreach (var type in types)
        {
            if (type.IsInterface || type.ContainsAllowNullAttribute() || type.IsGeneratedCode() || type.HasInterface("Windows.UI.Xaml.Markup.IXamlMetadataProvider"))
                continue;

            foreach (var method in type.MethodsWithBody())
                methodProcessor.Process(method);

            foreach (var property in type.ConcreteProperties())
                propertyProcessor.Process(property);
        }
    }
예제 #11
0
 public List <Property> GetPropertiesByFilter(int rooms, string area, string type)
 {
     return(PropertyProcessor.ProcessGetPropertyByFilter(rooms, area, type));
 }
예제 #12
0
 public List <Property> GetPropertiesByArea(string area)
 {
     return(PropertyProcessor.ProcessGetPropertyByArea(area));
 }
예제 #13
0
 public List <Property> GetPropertiesByRent(string rent)
 {
     return(PropertyProcessor.ProcessGetPropertyByRent(rent));
 }
예제 #14
0
 public List <Property> GetPropertiesByRoom(int rooms)
 {
     return(PropertyProcessor.ProcessGetPropertyByRooms(rooms));
 }
예제 #15
0
 public List <Property> GetAllProperties()
 {
     // return PropetyProcessor.ProcessProperty(prop);
     return(PropertyProcessor.ProcessGetProperty());
 }
예제 #16
0
    private bool ProcessProperties(PropertyProcessor processor) {
        var levelNames = GetLevelNames();
        if (propertyName == null || propertyName.Length == 0) {
            Debug.LogError("Missing SelectProperty() directive");
            return false;
        }

        for (int i = 0; i < levelNames.Count; ++i) {
            var ln = levelNames[i];
            for (int j = 0; j < propertyName.Length; ++j) {
                var pn = propertyName[j];
                if (!MadLevelProfile.IsLevelPropertySet(ln, pn)) {
                    processor(ln, pn, null);
                } else {
                    processor(ln, pn, MadLevelProfile.GetLevelAny(ln, pn));
                }
            }
        }

        return true;
    }