public void CastVote_WithNonExistentUser_ThrowsException()
        {
            // Arrange
            var couchDbMock = new Mock<ICouchDBService>();
            couchDbMock.Setup(c => c.FindByUsername<User>(It.IsAny<string>())).Returns(new List<User>());

            // Act
            var votingService = new VotingService(couchDbMock.Object);
            votingService.CastVote("*****@*****.**", 1, 2);
        }
        public void CastVote_WithValidUser_SetsVote()
        {
            // Arrange
            var couchDbMock = new Mock<ICouchDBService>();
            couchDbMock.Setup(c => c.FindByUsername<User>(It.IsAny<string>())).Returns(new[]
            {
                new User { Username = "******" }
            });
            couchDbMock.Setup(c => c.FindByUsername<Vote>(It.IsAny<string>())).Returns(new List<Vote>());

            // Act
            var votingService = new VotingService(couchDbMock.Object);
            votingService.CastVote("*****@*****.**", 1, 2);

            // Assert
            couchDbMock.Verify(c => c.Set<Vote>(It.IsAny<Vote>()), Times.Once);
        }