예제 #1
0
        public void Test21_FwAddsEntryCAndComment([ValueSource(typeof(ModelVersionValue), nameof(ModelVersionValue.GetValues))] int dbVersion)
        {
            // Setup
            _FieldWorks.ApplyPatches(dbVersion, 7);
            _webwork.ApplyPatches(dbVersion, 6);
            _LanguageForge.RestoreDatabase(dbVersion, 6);

            // Exercise
            LfMergeHelper.Run($"--project {Settings.DbName} --action=Synchronize");

            // Verify
            Assert.That(TestHelper.SRState, Is.EqualTo("IDLE"));

            // language=json
            const string expected = @"[ { 'lexicon': [
				{ 'lexeme': { 'fr' : { 'value' : 'B' } },
					'senses' : [ {
						'definition' : { 'en' : { 'value' : 'B' } }
				} ] },
				{ 'lexeme': { 'fr' : { 'value' : 'C' } },
					'senses' : [ {
						/* no definition */
						'gloss' : { 'en' : { 'value' : 'C' } }
				} ] },
				{ 'lexeme': { 'fr' : { 'value' : 'A' } },
					'senses' : [ {
						/* no definition */
						'gloss' : { 'en' : { 'value' : 'A' } }
				} ] }
			]}, { 'notes': [
				{ 'class' : 'question',
					'ref' : 'A',
					'messages': [
						{ 'message' : {
						'status': '',
						'value': 'FW comment on word A'
					}}]
				}, { 'class' : 'question',
					'ref' : 'B',
					'messages': [
					{ 'message' : {
						'status': 'open',
						'value': 'Comment on word B'
					}}]
				}, { 'class' : 'question',
					'ref' : 'C',
					'messages': [
					{ 'message' : {
						'status': '',
						'value': 'Comment about new word C'
					}}]
				}
			]}]"            ;

            VerifyMongo.AssertData(expected);

            var expectedXml = JsonToXml.Convert(expected);

            VerifyLanguageDepot.AssertFilesContain(expectedXml);
        }
예제 #2
0
        public void Test11_LfAddsCommentOnF_FwResolves_LfReopens([ValueSource(typeof(ModelVersionValue), nameof(ModelVersionValue.GetValues))] int dbVersion)
        {
            // Setup
            _webwork.ApplyPatches(dbVersion, 25);
            _LanguageForge.RestoreDatabase(dbVersion, 26);
            _FieldWorks.ApplyPatches(dbVersion, 25);

            // Exercise
            LfMergeHelper.Run($"--project {Settings.DbName} --action=Synchronize");

            // Verify
            Assert.That(TestHelper.SRState, Is.EqualTo("IDLE"));

            var expected = $"[ {{ 'notes': [ {CommentsA_D}, {CommentE}, " +
                           // language=json
                           @"{ 'class' : 'question',
				'ref' : 'F',
				'messages': [
					{ 'message' : {
						'status': 'open',
						'value': 'LF comment on F'
					}}, { 'message': {
						'status': 'resolved'
					}}, { 'message': {
						'status': 'open'
					}}
				] }
			]}]"            ;

            VerifyMongo.AssertData(expected);

            var expectedXml = JsonToXml.Convert(expected);

            VerifyLanguageDepot.AssertFilesContain(expectedXml);
        }
        public void EditWinsOverDelete([ValueSource(typeof(ModelVersionValue), nameof(ModelVersionValue.GetValues))] int dbVersion)
        {
            // Setup
            _mongo.RestoreDatabase(dbVersion, 4);
            _languageDepot.ApplyPatches(dbVersion, 4);
            _webWork.ApplyPatches(dbVersion, 3);

            // Exercise
            LfMergeHelper.Run($"--project {Settings.DbName} --action=Synchronize");

            // Verify
            Assert.That(TestHelper.SRState, Is.EqualTo("IDLE"));

            // language=json
            const string expected = @"[ { 'lexicon': [
				{ 'lexeme': { 'fr' : { 'value' : 'lf1modified' } },
					'senses' : [ {
						'definition' : { 'en' : { 'value' : 'Word added by LF' } },
						'partOfSpeech' : { 'value' : 'n1' }
					} ] },
				{ 'lexeme': { 'fr' : { 'value' : 'flexmodified' } },
					'senses' : [ {
						/* no definition */
						'gloss' : { 'en' : { 'value' : 'created in FLEx' } },
						'partOfSpeech' : { 'value' : 'adv1' }
					} ] },
				]}]"                ;

            VerifyMongo.AssertData(expected);

            var expectedXml = JsonToXml.Convert(expected);

            VerifyLanguageDepot.AssertFilesContain(expectedXml);
        }
예제 #4
0
        public void Test08_FwAddsCommentOnA_LfAddsCommentOnB_LfSyncsFirst([ValueSource(typeof(ModelVersionValue), nameof(ModelVersionValue.GetValues))] int dbVersion)
        {
            // Setup
            _webwork.ApplyPatches(dbVersion, 4);
            // apply patch 6 without 4
            _webwork.ApplySinglePatch(dbVersion, 6, false);
            _webwork.RemoveNodeFromFile("Lexicon.fwstub.ChorusNotes",
                                        "/notes/annotation[message='FW comment on word A']",
                                        "Patch 6 without 4 (Add comment on B)");
            _FieldWorks.ApplyPatches(dbVersion, 4);
            _FieldWorks.MergeWith(_webwork);

            _LanguageForge.RestoreDatabase(dbVersion, 5);

            // Exercise
            LfMergeHelper.Run($"--project {Settings.DbName} --action=Synchronize");

            // Verify
            Assert.That(TestHelper.SRState, Is.EqualTo("IDLE"));

            // language=json
            const string expected = @"[ { 'lexicon': [
				{ 'lexeme': { 'fr' : { 'value' : 'B' } },
					'senses' : [ {
						'definition' : { 'en' : { 'value' : 'B' } }
					} ] },
				{ 'lexeme': { 'fr' : { 'value' : 'A' } },
					'senses' : [ {
						/* no definition */
						'gloss' : { 'en' : { 'value' : 'A' } }
					} ] }
			]}, { 'notes': [
				{ 'class' : 'question',
					'ref' : 'B',
					'messages': [
						{'message' : {
						'status': 'open',
						'value': 'Comment on word B'
					}}]
				}, { 'class' : 'question',
					'ref' : 'A',
					'messages': [
						{'message' : {
						'status': '',
						'value': 'FW comment on word A'
					}}]
				}
			]}]"            ;

            VerifyMongo.AssertData(expected);

            var expectedXml = JsonToXml.Convert(expected);

            VerifyLanguageDepot.AssertFilesContain(expectedXml);
        }
예제 #5
0
        public void Test09a_FwAddsCommentOnE_LfReplies([ValueSource(typeof(ModelVersionValue), nameof(ModelVersionValue.GetValues))] int dbVersion)
        {
            // Setup
            _webwork.ApplyPatches(dbVersion, 17);
            _FieldWorks.ApplyPatches(dbVersion, 17);
            _LanguageForge.RestoreDatabase(dbVersion, 18);

            // Exercise
            LfMergeHelper.Run($"--project {Settings.DbName} --action=Synchronize");

            // Verify
            Assert.That(TestHelper.SRState, Is.EqualTo("IDLE"));

            // NOTE: although Chorus stores a status on every comment when we have replies,
            // only the last status determines the overall status of the comment!

            var expected = $"[ {{ 'notes': [ {CommentsA_D}, " +
                           // language=json
                           @"{ 'class' : 'question',
				'ref' : 'E',
				'messages': [
					{'message' : {
						'status': '',
						'value': 'FW comment on E'
					} },
					{ 'message': {
						'status': 'open',
						'value': 'LF reply on E'
					} }
				] }
			]}]"            ;

            VerifyMongo.AssertData(expected);

            var expectedXml = JsonToXml.Convert(expected);

            VerifyLanguageDepot.AssertFilesContain(expectedXml);
        }