Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. [TestMethod]
  2.         public void CreateLampTest()
  3.         {
  4.             // Arrange
  5.             MockImageRepo = new Mock<IImageRepository>();
  6.             MockLampRepo = new Mock<ILampRepository>();
  7.             LampController = new LampsController(MockLampRepo.Object, MockImageRepo.Object);
  8.             var lamp = new Lamp
  9.             {
  10.                 LampName = "meh lamp",
  11.                 Author = "meh author",
  12.                 ImageId = 1,
  13.                 Likes = 420
  14.             };
  15.             LampController.Create(lamp);
  16.             IEnumerable<Lamp> lamps = new List<Lamp>();
  17.             MockLampRepo.Setup(x => x.GetAll("")).Returns(lamps);
  18.             // Act
  19.  
  20.             // Assert
  21.             int count = 0;
  22.             foreach (Lamp element in lamps)
  23.             {
  24.                 count++;
  25.             }
  26.             Assert.AreEqual(1, count);
  27.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement