Пример #1
0
        public void ReturnProper_AddClub_ResultFromCommitMethod()
        {
            // Arrange
            var clubsRepoMock   = new Mock <IEfRepository <Club> >();
            var cityServiceMock = new Mock <ICityService>();
            var uowMock         = new Mock <ISaveContext>();

            clubsRepoMock.Setup(c => c.Add(It.IsAny <Club>())).Verifiable();
            uowMock.Setup(u => u.Commit()).Returns(1);

            var clubService = new ClubService(clubsRepoMock.Object, cityServiceMock.Object, uowMock.Object);

            // Act
            var result = clubService.Add(It.IsAny <Club>());

            // Assert
            Assert.That(result.Equals(1));
        }