public void AddData(string answerSyncUserId1, string answerSyncUserId2, string commentSyncUserId1,
                     string commentSyncUserId2, bool useAudioResponses = false)
 {
     RealtimeService.AddRepository("questions", OTType.Json0, new MemoryRepository <Question>(new[]
     {
         new Question
         {
             Id       = "project01:question01",
             DataId   = "question01",
             VerseRef = new VerseRefData(40, 1, 1),
             Text     = useAudioResponses ? "" : "Test question?",
             Answers  =
             {
                 new Answer
                 {
                     DataId      = "answer01",
                     OwnerRef    = "user02",
                     SyncUserRef = answerSyncUserId1,
                     DateCreated = new DateTime(2019, 1, 1, 8, 0, 0, DateTimeKind.Utc),
                     Text        = useAudioResponses ? "" : "Test answer 1.",
                     Comments    =
                     {
                         new Comment
                         {
                             DataId      = "comment01",
                             OwnerRef    = "user03",
                             SyncUserRef = commentSyncUserId1,
                             DateCreated = new DateTime(2019, 1, 1, 9, 0, 0, DateTimeKind.Utc),
                             Text        = "Test comment 1."
                         }
                     }
                 },
                 new Answer
                 {
                     DataId        = "answer02",
                     OwnerRef      = "user04",
                     SyncUserRef   = answerSyncUserId2,
                     DateCreated   = new DateTime(2019, 1, 2, 8, 0, 0, DateTimeKind.Utc),
                     Text          = "Test answer 2.",
                     VerseRef      = new VerseRefData(40, 1, "2-3"),
                     ScriptureText = "This is some scripture.",
                     Comments      =
                     {
                         new Comment
                         {
                             DataId      = "comment02",
                             OwnerRef    = "user02",
                             SyncUserRef = commentSyncUserId2,
                             DateCreated = new DateTime(2019, 1, 2, 9, 0, 0, DateTimeKind.Utc),
                             Text        = "Test comment 2."
                         }
                     }
                 }
             }
         }
     }));
 }
Ejemplo n.º 2
0
        // The SetupSFData method was copied from ParatextSyncRunnerTests.cs, trimmed, and modified.
        public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled)
        {
            RealtimeService.AddRepository("users", OTType.Json0, new MemoryRepository <User>(new[]
            {
                new User
                {
                    Id         = "user01",
                    ParatextId = "pt01"
                },
                new User
                {
                    Id         = "user02",
                    ParatextId = "pt02"
                },
                new User
                {
                    Id         = "user03",
                    ParatextId = "pt03"
                }
            }));
            RealtimeService.AddRepository("sf_projects", OTType.Json0, new MemoryRepository <SFProject>(
                                              new[]
            {
                new SFProject
                {
                    Id        = "project01",
                    Name      = "project01",
                    ShortName = "P01",
                    UserRoles = new Dictionary <string, string>
                    {
                        { "user01", SFProjectRole.Administrator },
                        { "user02", SFProjectRole.Translator },
                        { "user03", SFProjectRole.Administrator }
                    },
                    ParatextId      = "target01",
                    TranslateConfig = new TranslateConfig
                    {
                        TranslationSuggestionsEnabled = translationSuggestionsEnabled,
                        Source = new TranslateSource
                        {
                            ParatextId    = "source01",
                            Name          = "Source",
                            ShortName     = "SRC",
                            WritingSystem = new WritingSystem
                            {
                                Tag = "en"
                            }
                        }
                    },
                    CheckingConfig = new CheckingConfig
                    {
                        CheckingEnabled = checkingEnabled
                    },
                    Sync = new Sync
                    {
                        QueuedCount = 1
                    }
                },
                new SFProject
                {
                    Id        = "project02",
                    Name      = "project02",
                    ShortName = "P02",
                    UserRoles = new Dictionary <string, string>
                    {
                        { "user01", SFProjectRole.Administrator },
                        { "user02", SFProjectRole.Translator },
                        { "user03", SFProjectRole.Administrator }
                    },
                    ParatextId      = "target02",
                    TranslateConfig = new TranslateConfig
                    {
                        TranslationSuggestionsEnabled = translationSuggestionsEnabled,
                        Source = new TranslateSource
                        {
                            ParatextId    = "source02",
                            Name          = "Source",
                            ShortName     = "SR2",
                            WritingSystem = new WritingSystem
                            {
                                Tag = "en"
                            }
                        }
                    },
                    CheckingConfig = new CheckingConfig
                    {
                        CheckingEnabled = checkingEnabled
                    },
                    Sync = new Sync
                    {
                        QueuedCount = 1
                    }
                }
            }));

            RealtimeService.AddRepository("texts", OTType.RichText, new MemoryRepository <TextData>());
            RealtimeService.AddRepository("questions", OTType.Json0, new MemoryRepository <Question>());
        }