/// <summary> /// Builds this instance and returns the underlying instrument associated with the controller /// </summary> /// <returns></returns> public PropertyTransaction Build() { //var equity = UnderlyingEquity.(); var buyerPartyReference = PartyReferenceHelper.Parse(BuyerReference); var sellerPartyReference = PartyReferenceHelper.Parse(SellerReference); var productType = new object[] { ProductTypeHelper.Create("PropertyTransaction") }; //var productId = new ProductId {Value = "BondTransaction"}; var itemName = new[] { ItemsChoiceType2.productType }; //TODO extend this //var productIds = new[] {productId}; var property = XmlSerializerHelper.Clone(PropertyInfo); var purchasePrice = XmlSerializerHelper.Clone(PurchasePrice); var propertyTransaction = new PropertyTransaction { buyerPartyReference = buyerPartyReference, sellerPartyReference = sellerPartyReference, id = Id, //productId = productIds, Items = productType, ItemsElementName = itemName, purchasePrice = purchasePrice, property = property }; return(propertyTransaction); }
public void ShouldNotRollbackUnstartedTransaction() { // arrange var target = new PropertyTransaction( new MockEditableObject() ); // act // assert Assert.Throws<InvalidOperationException>( () => target.Rollback() ); }
private void InitializeDataContext(Configuration configuration) { Buttons[] buttons = Enum.GetValues(typeof(Buttons)) .OfType <Buttons>() .ToArray(); string[] skins = Directory.GetDirectories(BCEnvironment.SkinDirectory) .Select(Path.GetFileName) .ToArray(); var backgrounds = new List <Color>(_defaultBackgrounds); var refreshRates = new List <int>(_defaultRefreshRates); var buttonsTransaction = new PropertyTransaction <Buttons>(configuration, nameof(Configuration.Buttons)); var skinTransaction = new PropertyTransaction <string>(configuration, nameof(Configuration.Skin)); var backgroundTransaction = new PropertyTransaction <Color?>(configuration, nameof(Configuration.Background)); var refreshRateTransaction = new PropertyTransaction <int?>(configuration, nameof(Configuration.RefreshRate)); var topMostTransaction = new PropertyTransaction <bool>(configuration, nameof(Configuration.TopMost)); if (configuration.Background.HasValue && !backgrounds.Contains(configuration.Background.Value)) { backgrounds.Add(configuration.Background.Value); } if (configuration.RefreshRate.HasValue && !refreshRates.Contains(configuration.RefreshRate.Value)) { refreshRates.Add(configuration.RefreshRate.Value); } _displaySettingTransaction = new TransactionGroup( buttonsTransaction, skinTransaction, backgroundTransaction, refreshRateTransaction, topMostTransaction); _model = new SettingWindowModel { Keys = _inputModels[0], CancelCommand = new ActionCommand(OnCancelCommandExecuted), SaveCommand = new ActionCommand(OnSaveCommandExecuted), ButtonItems = buttons, Buttons = buttonsTransaction, SkinItems = skins, Skin = skinTransaction, BackgroundItems = backgrounds, Background = backgroundTransaction, RefreshRateItems = refreshRates, RefreshRate = refreshRateTransaction, TopMostItems = _defaultBooleans, TopMost = topMostTransaction }; DataContext = _model; }
public void ShouldNotSupportBeginNestedTransaction() { // arrange var target = new PropertyTransaction( new MockEditableObject() ); // act target.Begin(); // assert Assert.Throws<InvalidOperationException>( () => target.Begin() ); }
//protected DateTime MarketEntryDate { get; private set; } //protected DateTime MarketExitDate { get; private set; } //protected bool IsOnMarketToday { get; private set; } //protected TimeSpan DaysOnMarket { get => MarketExitDate - MarketEntryDate + TimeSpan.FromDays(1); } //public BasePropertyObject(PropertyType type, PropertyTransaction transaction, string title, string location, string link, int price, DateTime marketEntryDate, DateTime marketExitDate, bool isOnMarketToday) public BasePropertyObject(PropertyType type, PropertyTransaction transaction, string title, string location, string link, int price) { Type = type; Transaction = transaction; Title = title; Location = location; Link = link; Price = price; //MarketEntryDate = marketEntryDate; //MarketExitDate = marketExitDate; //IsOnMarketToday = isOnMarketToday; }
public void ShouldCommitChangesToObject() { // arrange var obj = new MockEditableObject(); var createdDate = obj.CreatedDate; var transaction = new PropertyTransaction( obj ); obj.Id = 1; obj.FirstName = string.Empty; obj.LastName = string.Empty; // act transaction.Begin(); obj.FirstName = "unit"; obj.LastName = "test"; transaction.Commit(); // assert Assert.Equal( 1, obj.Id ); Assert.Equal( "unit", obj.FirstName ); Assert.Equal( "test", obj.LastName ); Assert.Equal( createdDate, obj.CreatedDate ); }
public PageSReality(IWebDriver driver) : base(driver) { string _url = driver.Url; if (_url.Contains("/prodej/")) { transactionType = PropertyTransaction.Sale; } else if (_url.Contains("/pronajem/")) { transactionType = PropertyTransaction.Rent; } else { transactionType = PropertyTransaction.Unknown; Console.WriteLine("Unknown Property Transaction!"); } if (_url.Contains("/byty/")) { propertyType = PropertyType.Apartment; } else if (_url.Contains("/domy/")) { propertyType = PropertyType.House; } else if (_url.Contains("/pozemky/")) { propertyType = PropertyType.Lot; } else { propertyType = PropertyType.Unknown; Console.WriteLine("Unknown Property Type!"); } }
public PropertyTransactionPricer(ILogger logger, ICoreCache cache, string nameSpace, DateTime paymentDate, String referenceContract, IBusinessCalendar settlementCalendar, PropertyTransaction propertyFpML, string basePartyReference, Boolean forecastRateInterpolation) { logger.LogInfo("PropertyType set. Commence to build a property transaction."); if (propertyFpML == null) { return; } // //Set the multiplier // Multiplier = 1.0m; // //Set the trade information // BuyerReference = propertyFpML.buyerPartyReference.href; PaymentCurrencies = new List <string> { propertyFpML.purchasePrice.currency.Value }; SellerReference = propertyFpML.sellerPartyReference.href; BasePartyBuyer = basePartyReference == propertyFpML.buyerPartyReference.href; ForecastRateInterpolation = forecastRateInterpolation; SettlementCalendar = settlementCalendar; PaymentDate = paymentDate; // //Set the issuer information // ReferenceContract = referenceContract; // //Set the notional information // PurchasePrice = MoneyHelper.GetAmount(propertyFpML.purchasePrice.amount, propertyFpML.purchasePrice.currency.Value); PaymentCurrencies = new List <string> { propertyFpML.purchasePrice.currency.Value }; // //Get the instrument configuration information. // var propertyTypeInfo = propertyFpML.property; if (propertyFpML.property != null && propertyTypeInfo != null) { if (SettlementCalendar == null) { SettlementCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, propertyTypeInfo.businessDayAdjustments.businessCenters, nameSpace); } //Pre processes the data for the priceable asset. PropertyInfo = XmlSerializerHelper.Clone(propertyTypeInfo); //This is done because the config data is not stored in the correct way. Need to add a price quote units. //TODO Set other relevant property information //PropertyTypeInfo.Property.faceAmount = NotionalAmount.amount; if (!PaymentCurrencies.Contains(propertyFpML.purchasePrice.currency.Value)) { PaymentCurrencies.Add(propertyFpML.purchasePrice.currency.Value); } logger.LogInfo("Property transaction has been successfully created."); } else { logger.LogInfo("Property type data not available."); } }
public PropertyTransactionPricer(ILogger logger, ICoreCache cache, string nameSpace, DateTime paymentDate, string referenceContract, IBusinessCalendar settlementCalendar, PropertyTransaction propertyFpML, string basePartyReference) : this(logger, cache, nameSpace, paymentDate, referenceContract, settlementCalendar, propertyFpML, basePartyReference, false) { }
public void ShouldRollbackChangesToObject() { // arrange var obj = new MockEditableObject(); var createdDate = obj.CreatedDate; var transaction = new PropertyTransaction( obj, new[] { "FirstName", "LastName" } ); obj.Id = 1; obj.FirstName = string.Empty; obj.LastName = string.Empty; // act transaction.Begin(); obj.Id = 2; obj.FirstName = "unit"; obj.LastName = "test"; transaction.Rollback(); // assert Assert.Equal( 2, obj.Id ); Assert.Equal( string.Empty, obj.FirstName ); Assert.Equal( string.Empty, obj.LastName ); Assert.Equal( createdDate, obj.CreatedDate ); }
//public Apartment(PropertyTransaction transaction, string title, string location, string link, int price, DateTime marketEntryDate, DateTime marketExitDate, bool isOnMarketToday, int size_m2, Rooms rooms, Features features) : base(PropertyType.Apartment, transaction, title, location, link, price, marketEntryDate, marketExitDate, isOnMarketToday) public Apartment(PropertyTransaction transaction, string title, string location, string link, int price, int size_m2, Rooms rooms, Features features) : base(PropertyType.Apartment, transaction, title, location, link, price) { Size_m2 = size_m2; Rooms = rooms; Features = features; }