コード例 #1
0
ファイル: InboxesTests.cs プロジェクト: infotech-gmbh/socomap
        public void CanGetCreatedInboxes()
        {
            var referenceInbox = new Inbox {
                Id = "PartyA", Email = "PartyE-Mail", ApiKey = "abc123"
            };

            inboxes.CreateInbox(referenceInbox);

            Inbox getResult = inboxes.GetInbox("PartyA");

            Assert.NotNull(getResult);
            Assert.Equal(referenceInbox, getResult);
        }
コード例 #2
0
        Transmission ITransmissionApi.CreateTransmission(string targetInboxId)
        {
            if (targetInboxId == null)
            {
                throw new ArgumentNullException("TargetInboxId");
            }

            var targetInbox = inboxApi.GetInbox(targetInboxId);

            if (targetInbox == null)
            {
                throw new ArgumentException("TargetInbox does not exist."); //TODO: Need an exception infrastructure.
            }
            Transmission transmission = new Transmission {
                Id = Guid.NewGuid(), CreatedOn = DateTime.Now, TargetInbox = targetInbox
            };

            context.Transmissions.Add(transmission);
            context.SaveChanges();  //TODO: Who handles the exceptions?
            return(transmission);
        }