public void TestListTransactionsByInstrumentId() { var hundredRuppees = new Price(100); var relianceMutuals = new Symbol("RELTICK"); Instrument instrument = new MutualFund(relianceMutuals, hundredRuppees, "Test Fund", "SUNMF", "SUN Magma", "Growth"); repository.Save(instrument); Transaction buyTransaction = new BuyTransaction(DateTime.Now, instrument, 10, new Price(1000), 100, 100); repository.Save(buyTransaction); IList<Transaction> translist=repository.ListTransactionsByInstrumentId<Transaction>(instrument.Id); Assert.AreEqual(1,repository.ListTransactionsByInstrumentId<Transaction>(instrument.Id).Count); }
public void TestListAllSymbols() { var hundredRuppees = new Price(100); var relianceMutuals = new Symbol("RELTICK"); Instrument instrument = new MutualFund(relianceMutuals, hundredRuppees, "Test Fund", "SUNMF", "SUN Magma", "Growth"); repository.Save(instrument); IList<Symbol> list = repository.ListAllSymbols<Symbol>(); Assert.AreEqual(1,list.Count); Assert.AreEqual("RELTICK",list[0].Value); }
public void TestLookupAfterSave() { var hundredRuppees = new Price(100); var relianceMutuals = new Symbol("RELTICK"); Instrument instrument = new MutualFund(relianceMutuals, hundredRuppees, "Test Fund", "SUNMF", "SUN Magma", "Growth"); repository.Save(instrument); var actual = repository.Lookup<Instrument>(instrument.Id); Assert.AreEqual(typeof(MutualFund), actual.GetType()); Instrument expectedMutualFund = new MutualFund(relianceMutuals, hundredRuppees, "Test Fund", "SUNMF", "SUN Magma", "Growth") {Id = actual.Id}; Assert.AreEqual(expectedMutualFund, actual); Assert.AreNotEqual(0, instrument.Id); Assert.True(instrument.Id > 0); }
public Stock(Symbol symbol, Price currentPrice, string description) : base(symbol, currentPrice, description) { }
public TermDeposit(Term term, Price investedAmount, Symbol symbol, string description, InterestRate interestRate, int interestPayoutFrequency) : base(symbol, investedAmount, description) { Term = term; InterestRate = interestRate; InvestedAmount = investedAmount; InterestPayoutFrequency = interestPayoutFrequency; Validate(); }
public bool Equals(Symbol other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Value, Value); }
public Price CurrentMarketValue(Symbol symbol) { Instrument instrument = Repository.LookupBySymbol<Instrument>(symbol); IList<Transaction> list = Repository.ListTransactionsByInstrumentId<Transaction>(instrument.Id); return instrument.CurrentMarketValue(list); }
public SinglePayOut(Term term, Price investedAmount, Symbol symbol, string description, InterestRate interestRate) : base(term, investedAmount, symbol, description, interestRate, 0) { }
public void TestLookupBySymbol() { var hundredRuppees = new Price(100); var relianceMutuals = new Symbol("RELTICK"); Instrument instrument = new MutualFund(relianceMutuals, hundredRuppees, "Test Fund", "SUNMF", "SUN Magma", "Growth"); repository.Save(instrument); var symbol = new Symbol("RELTICK"); Instrument resultInstrument = repository.LookupBySymbol<Instrument>(symbol); Assert.AreEqual(instrument, resultInstrument); }
public void TestSave() { var hundredRuppees = new Price(100); var relianceMutuals = new Symbol("RELTICK"); Instrument instrument = new MutualFund(relianceMutuals, hundredRuppees, "Test Fund", "SUNMF", "SUN Magma", "Growth"); Assert.AreEqual(0, instrument.Id); repository.Save(instrument); Assert.AreNotEqual(0, instrument.Id); Assert.IsNotNull(instrument.Id); }
protected Instrument(Symbol symbol, Price price, string description) { Symbol = symbol; CurrentPrice = price; Description = description; }