Ejemplo n.º 1
0
            public async Task SmokeTest()
            {
                AccessControl accessControl = SetupVotableAccessControl(2);

                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                accessControl.RegisterVote(token, SetupVotedEntry());

                Assert.Equal(1, await accessControl.ObserveRemainingVotes(token).FirstAsync());
            }
Ejemplo n.º 2
0
        public void RegisteredVoteUnregistersAutomaticallyWhenEntryvoteCountIsReset()
        {
            var settings = new CoreSettings { MaxVoteCount = 2 };
            var accessControl = new AccessControl(settings);
            Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

            var entry = new PlaylistEntry(0, Helpers.SetupSongMock());
            entry.Vote();

            var votes = accessControl.ObserveRemainingVotes(token).CreateCollection();
            accessControl.RegisterVote(token, entry);

            entry.ResetVotes();

            Assert.Equal(new int?[] { 2, 1, 2 }, votes);
        }
Ejemplo n.º 3
0
            public void SmokeTest()
            {
                var settings = new CoreSettings();
                var accessControl = new AccessControl(settings);
                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                var votes = accessControl.ObserveRemainingVotes(token).CreateCollection();

                accessControl.RegisterVote(token, SetupVotedEntry());
                accessControl.RegisterVote(token, SetupVotedEntry());

                Assert.Equal(new int?[] { 2, 1, 0 }, votes);
            }
Ejemplo n.º 4
0
            public async Task SmokeTest()
            {
                var settings = new CoreSettings
                {
                    EnableVotingSystem = true,
                    MaxVoteCount = 2
                };
                var accessControl = new AccessControl(settings);
                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                accessControl.RegisterVote(token, SetupVotedEntry());

                Assert.Equal(settings.MaxVoteCount - 1, await accessControl.ObserveRemainingVotes(token).FirstAsync());
            }
Ejemplo n.º 5
0
            public async Task ReturnsCurrentValueImmediately()
            {
                var settings = new CoreSettings();
                var accessControl = new AccessControl(settings);
                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                Assert.Equal(settings.MaxVoteCount, await accessControl.ObserveRemainingVotes(token).FirstAsync());
            }