PageRenderTime 59ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/V2.2/trunk/RI/Desktop/StockTraderRI.Infrastructure.Tests/Converters/TransactionTypeToStringConverterFixture.cs

#
C# | 53 lines | 29 code | 8 blank | 16 comment | 0 complexity | a8cd35d9c017fcb7d815f3bdbe94825e MD5 | raw file
  1. //===================================================================================
  2. // Microsoft patterns & practices
  3. // Composite Application Guidance for Windows Presentation Foundation and Silverlight
  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 Microsoft.VisualStudio.TestTools.UnitTesting;
  18. using StockTraderRI.Infrastructure.Converters;
  19. namespace StockTraderRI.Infrastructure.Tests.Converters
  20. {
  21. [TestClass]
  22. public class TransactionTypeToStringConverterFixture
  23. {
  24. [TestMethod]
  25. public void ShouldConvertTransactionTypeValuesToString()
  26. {
  27. TransactionTypeToStringConverter converter = new TransactionTypeToStringConverter();
  28. var convertedValue = converter.Convert(TransactionType.Buy, null, null, null) as string;
  29. Assert.IsNotNull(convertedValue);
  30. Assert.AreEqual("BUY ", convertedValue);
  31. convertedValue = converter.Convert(TransactionType.Sell, null, null, null) as string;
  32. Assert.IsNotNull(convertedValue);
  33. Assert.AreEqual("SELL ", convertedValue);
  34. }
  35. [TestMethod]
  36. public void ShouldReturnNullIfValueToConvertIsNullOrNotTransactionType()
  37. {
  38. TransactionTypeToStringConverter converter = new TransactionTypeToStringConverter();
  39. var convertedValue = converter.Convert(null, null, null, null) as string;
  40. Assert.IsNull(convertedValue);
  41. convertedValue = converter.Convert("NotATransactionType", null, null, null) as string;
  42. Assert.IsNull(convertedValue);
  43. }
  44. }
  45. }