コード例 #1
0
 private void AssertPoemRequestsAreEqual(PoemRequest poemRequest, PoemRequest actualPoemRequest)
 {
     Assert.AreEqual(poemRequest.Id, actualPoemRequest.Id);
     Assert.AreEqual(poemRequest.DateSent, actualPoemRequest.DateSent);
     Assert.AreEqual(poemRequest.IsArchived, actualPoemRequest.IsArchived);
     Assert.AreEqual(poemRequest.PoemId, actualPoemRequest.PoemId);
     Assert.AreEqual(poemRequest.RequestedProfileId, actualPoemRequest.RequestedProfileId);
     Assert.AreEqual(poemRequest.SentById, actualPoemRequest.SentById);
 }
コード例 #2
0
        public void SuccessfulCreateAndInsert()
        {
            IPoemRequestRepository repository = GetRepositoryWithEnrolledUnitOfWork();
            var preparedTupple = PreparePoem<LegendAuthorityType, HaikuPoem>();
            var requestedProfile = CreateAndRegisterUserProfile<NoviceAuthorityType>();
            PoemRequest poemRequest = new PoemRequest
                                      {
                                          PoemId = preparedTupple.Item2.Id,
                                          SentById = preparedTupple.Item1.Id,
                                          RequestedProfileId = requestedProfile.Id,
                                          IsArchived = false,
                                          DateSent = DateTime.UtcNow
                                      };
            RegisterDataStoreObject(poemRequest);
            var actualPoemRequest = repository.GetById(poemRequest.Id);

            AssertPoemRequestsAreEqual(poemRequest, actualPoemRequest);
        }
コード例 #3
0
        public IEnumerable<PoemRequest> InsertPoemRequests(long fromUserId, long aboutPoemId, IEnumerable<long> toPlayers)
        {
            List<PoemRequest> poemRequests = new List<PoemRequest>();
            foreach (var player in toPlayers)
            {
                var request = new PoemRequest
                    {
                        RequestedProfileId = player,
                        SentById = fromUserId,
                        IsArchived = false,
                        PoemId = aboutPoemId,
                        DateSent = DateTime.UtcNow
                    };
                poemRequestRepository.Insert(request);
                poemRequests.Add(request);
            }

            poemRequestRepository.Commit();
            return poemRequests;
        }