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); }
public void AddToFav(string propertyid) { string uname = Thread.CurrentPrincipal.Identity.Name; string x = Usersecurity.getIdByName(uname); PropertyProcessor.AddToFav(propertyid, x); }
public void SutDoesNotEqualAnonymousObject() { var sut = new PropertyProcessor(); var anonymous = new object(); var actual = sut.Equals(anonymous); Assert.False(actual); }
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; } }
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); }
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; }
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 List <Property> GetPropertiesByFilter(int rooms, string area, string type) { return(PropertyProcessor.ProcessGetPropertyByFilter(rooms, area, type)); }
public List <Property> GetPropertiesByArea(string area) { return(PropertyProcessor.ProcessGetPropertyByArea(area)); }
public List <Property> GetPropertiesByRent(string rent) { return(PropertyProcessor.ProcessGetPropertyByRent(rent)); }
public List <Property> GetPropertiesByRoom(int rooms) { return(PropertyProcessor.ProcessGetPropertyByRooms(rooms)); }
public List <Property> GetAllProperties() { // return PropetyProcessor.ProcessProperty(prop); return(PropertyProcessor.ProcessGetProperty()); }