PageRenderTime 37ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/Test/SystemWebMvcTest/Mvc/Test/ViewEngineCollectionTest.cs

https://bitbucket.org/markhneedham/aspnet-mvc
C# | 43 lines | 29 code | 8 blank | 6 comment | 0 complexity | 4f4ea816f7ec81480feecd36769a876a MD5 | raw file
  1. namespace System.Web.Mvc.Test {
  2. using System.Collections.Generic;
  3. using System.Web.TestUtil;
  4. using Microsoft.VisualStudio.TestTools.UnitTesting;
  5. using Moq;
  6. [TestClass]
  7. public class ViewEngineCollectionTest {
  8. [TestMethod]
  9. public void ListWrappingConstructor() {
  10. // Arrange
  11. List<IViewEngine> list = new List<IViewEngine>() { new Mock<IViewEngine>().Object, new Mock<IViewEngine>().Object };
  12. // Act
  13. ViewEngineCollection collection = new ViewEngineCollection(list);
  14. // Assert
  15. Assert.AreEqual(2, collection.Count);
  16. Assert.AreSame(list[0], collection[0]);
  17. Assert.AreSame(list[1], collection[1]);
  18. }
  19. [TestMethod]
  20. public void ListWrappingConstructorThrowsIfListIsNull() {
  21. // Act & Assert
  22. ExceptionHelper.ExpectArgumentNullException(
  23. delegate {
  24. new ViewEngineCollection(null);
  25. }, "list");
  26. }
  27. [TestMethod]
  28. public void DefaultConstructor() {
  29. // Act
  30. ViewEngineCollection collection = new ViewEngineCollection();
  31. // Assert
  32. Assert.AreEqual(0, collection.Count);
  33. }
  34. }
  35. }