コード例 #1
0
        public Model.Party AddSongToParty(int partyId, string songId)
        {
            var party = FakePartyDb.GetParty(partyId);

            party.SongList.Add(songId);
            hostService.SendMessage(party.HostId, $"add:{songId}");

            return(party);
        }
コード例 #2
0
        public Model.Party CreateParty(string name)
        {
            var party = new Model.Party()
            {
                Name     = name,
                HostId   = -1,
                SongList = new List <string>()
            };

            return(FakePartyDb.CreateParty(party));
        }
コード例 #3
0
        public void CanCreateParty()
        {
            FakePartyDb.Reset();
            var partyService = new PartyService();
            var createdParty = partyService.CreateParty("test");

            var party = partyService.GetParty(createdParty.Id);

            Assert.AreEqual(-1, party.HostId);
            Assert.AreEqual("test", party.Name);
        }
コード例 #4
0
        public void CanAddSongToParty()
        {
            FakePartyDb.Reset();
            var partyService = new PartyService();
            var createdParty = partyService.CreateParty("test");

            partyService.AddSongToParty(createdParty.Id, "abc");
            partyService.AddSongToParty(createdParty.Id, "def");
            partyService.AddSongToParty(createdParty.Id, "hij");

            var party = partyService.GetParty(createdParty.Id);

            Assert.AreEqual("abc", party.SongList[0]);
            Assert.AreEqual("def", party.SongList[1]);
            Assert.AreEqual("hij", party.SongList[2]);
        }
コード例 #5
0
 public IHttpActionResult Register(string hostId, string partyId)
 {
     hostService.Register(int.Parse(hostId), int.Parse(partyId));
     FakePartyDb.UpdatePartyHost(int.Parse(hostId), int.Parse(partyId));
     return(Ok());
 }
コード例 #6
0
 public IList <Model.Party> GetAllParties()
 {
     return(FakePartyDb.GetAllParties());
 }
コード例 #7
0
 public Model.Party GetParty(int partyId)
 {
     return(FakePartyDb.GetParty(partyId));
 }
コード例 #8
0
 public Model.Party DeleteSongFromParty(int partyId, string songId)
 {
     return(FakePartyDb.DeleteSongFromParty(partyId, songId));
 }