Beispiel #1
0
        public void ProcessSetsSameCreateAndUpdateInfoForAllLanguages(
            string statisticField,
            SetStatistics sut,
            [Frozen] DbItem item,
            AddDbItemArgs args,
            ID id1,
            ID id2,
            string value1,
            string value2)
        {
            var statisticFieldId = ID.Parse(statisticField);
            var fieldEn          = new DbField(id1)
            {
                { "en", value1 }
            };
            var fieldDa = new DbField(id2)
            {
                { "da", value2 }
            };

            item.Fields.Add(fieldEn);
            item.Fields.Add(fieldDa);

            sut.Process(args);
            var valueEn = item.Fields[statisticFieldId].GetValue("en", 0);
            var valueDa = item.Fields[statisticFieldId].GetValue("da", 0);

            valueEn.Should().Be(valueDa);
        }
Beispiel #2
0
        public void ProcessSetsUniqueRevisionsForAllLanguages(
            SetStatistics sut,
            [Frozen] DbItem item,
            AddDbItemArgs args,
            ID id1,
            ID id2,
            string value1,
            string value2)
        {
            var fieldEn = new DbField(id1)
            {
                { "en", value1 }
            };
            var fieldDa = new DbField(id2)
            {
                { "da", value2 }
            };

            item.Fields.Add(fieldEn);
            item.Fields.Add(fieldDa);

            sut.Process(args);
            var revisionEn = item.Fields[FieldIDs.Revision].GetValue("en", 0);
            var revisionDa = item.Fields[FieldIDs.Revision].GetValue("da", 0);

            revisionEn.Should().NotBeNullOrEmpty();
            revisionDa.Should().NotBeNullOrEmpty();
            revisionEn.Should().NotBe(revisionDa);
        }
Beispiel #3
0
        public void ProcessSetsStatisticsForItemWithoutFieldsInDefaultLanguage(
            string statisticField,
            SetStatistics sut,
            [Frozen] DbItem item,
            AddDbItemArgs args)
        {
            var statisticFieldId = ID.Parse(statisticField);

            sut.Process(args);
            var value = item.Fields[statisticFieldId].GetValue("en", 0);

            value.Should().NotBeNullOrEmpty();
        }
Beispiel #4
0
        public void ProcessSetsValidRevision(
            SetStatistics sut,
            [Frozen] DbItem item,
            AddDbItemArgs args,
            ID id,
            string value)
        {
            var field = new DbField(id)
            {
                { "en", value }
            };

            item.Fields.Add(field);

            sut.Process(args);
            var actual = item.Fields[FieldIDs.Revision].GetValue("en", 0);

            Assert.True(ID.IsID(actual));
        }