Ejemplo n.º 1
0
        public void SetupTest()
        {
            var workRepositoryMock = new Mock<IWorkRepository>();
            var work = new Work() { Description = "xyz" };
            workRepositoryMock.Setup(x => x.Get(1)).Returns(work);
            var workRepository = workRepositoryMock.Object;

            var result = workRepository.Get(1);

            Assert.NotNull(result);
            Assert.AreEqual("xyz", result.Description);
        }
Ejemplo n.º 2
0
        public void VerifyTimesTest()
        {
            var workRepositoryMock = new Mock<IWorkRepository>();

            var work = new Work() { Description = "xyz" };

            var workRepository = workRepositoryMock.Object;

            workRepository.Save(work);
            workRepository.Save(work);
            workRepository.Save(work);

            workRepositoryMock.Verify(x => x.Save(work), Times.Exactly(3));
            workRepositoryMock.Verify(x => x.Save(It.IsAny<Work>()), Times.Exactly(3));
        }
Ejemplo n.º 3
0
 public void Save(Work entity)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 4
0
 public void Save(Work entity)
 {
     // save
 }