Esempio n. 1
0
        public void ThrowArgumentNullException_WhenNullUserEntitiePassed()
        {
            // Arrange
            var userRepositoryMock = new UserRepositoryMock();

            // Act && Assert
            Assert.ThrowsException <ArgumentNullException>(() => userRepositoryMock.Add(null));
        }
Esempio n. 2
0
        public void AddUserEntitieToDatabase_WhenValidUserEntitiePassed()
        {
            // Arrange
            var userRepositoryMock = new UserRepositoryMock();

            var userMock = new Mock <IUserEntitie>();

            userMock.SetupGet(u => u.Username).Returns("Ivan");
            userMock.SetupGet(u => u.Password).Returns("12356");

            // Act
            userRepositoryMock.Add(userMock.Object);

            // Assert
            Assert.AreEqual(userRepositoryMock.FakeLiteDb.Count(), 1);
        }