PageRenderTime 56ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/V1/trunk/Source/StockTraderRI/StockTraderRI.Modules.Position.Tests/AccountPositionModelFixture.cs

#
C# | 89 lines | 20 code | 16 blank | 53 comment | 0 complexity | d0b0e478e52709bcaf0d2887634b98d1 MD5 | raw file
  1. //===============================================================================
  2. // Microsoft patterns & practices
  3. // Composite Application Guidance for Windows Presentation Foundation
  4. //===============================================================================
  5. // Copyright (c) Microsoft Corporation. All rights reserved.
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
  7. // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
  8. // LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  9. // FITNESS FOR A PARTICULAR PURPOSE.
  10. //===============================================================================
  11. // The example companies, organizations, products, domain names,
  12. // e-mail addresses, logos, people, places, and events depicted
  13. // herein are fictitious. No association with any real company,
  14. // organization, product, domain name, email address, logo, person,
  15. // places, or events is intended or should be inferred.
  16. //===============================================================================
  17. using System;
  18. using System.Text;
  19. using System.Collections.Generic;
  20. using System.Linq;
  21. using Microsoft.VisualStudio.TestTools.UnitTesting;
  22. using StockTraderRI.Infrastructure.Models;
  23. using StockTraderRI.Modules.Position.Services;
  24. namespace StockTraderRI.Modules.Position.Tests
  25. {
  26. /// <summary>
  27. /// Summary description for AccountPositionModelFixture
  28. /// </summary>
  29. [TestClass]
  30. public class AccountPositionModelFixture
  31. {
  32. [TestMethod]
  33. public void ShouldReturnDefaultPositions()
  34. {
  35. AccountPositionService model = new AccountPositionService();
  36. Assert.IsTrue(model.GetAccountPositions().Count > 0, "No account positions returned");
  37. }
  38. //[TestMethod]
  39. //public void AddingPositionFiresUpdatedEvent()
  40. //{
  41. // AccountPositionService model = new AccountPositionService();
  42. // bool modelUpdated = false;
  43. // AccountPosition testAccountPosition = null;
  44. // model.Updated += delegate(object sender, AccountPositionModelEventArgs e)
  45. // {
  46. // modelUpdated = true;
  47. // testAccountPosition = e.AcctPosition;
  48. // };
  49. // AccountPosition newAccountPosition = new AccountPosition("test", 1.00m, 1);
  50. // model.AddPosition(newAccountPosition);
  51. // Assert.IsTrue(modelUpdated);
  52. // Assert.AreSame(testAccountPosition, newAccountPosition);
  53. //}
  54. //[TestMethod]
  55. //public void UpdatingPositionFiresUpdatedEvent()
  56. //{
  57. // AccountPositionService model = new AccountPositionService();
  58. // AccountPosition accountPosition = new AccountPosition("test", 1.00m, 1);
  59. // model.AddPosition(accountPosition);
  60. // bool modelUpdated = false;
  61. // AccountPosition updatedAccountPosition = null;
  62. // model.Updated += delegate(object sender, AccountPositionModelEventArgs e)
  63. // {
  64. // modelUpdated = true;
  65. // updatedAccountPosition = e.AcctPosition;
  66. // };
  67. // accountPosition.Shares += 1;
  68. // accountPosition.CostBasis += .50m;
  69. // Assert.IsTrue(modelUpdated);
  70. // Assert.AreSame(updatedAccountPosition, accountPosition);
  71. //}
  72. }
  73. }