Ejemplo n.º 1
0
        private ILabelService CreateServiceWithLabels()
        {
            var valuesToReturn = new List <Label>();

            var danish = new Language("Danish", "da-DK");

            typeof(Entity).GetProperty(nameof(Entity.Id)).SetValue(danish, 1);
            var english = new Language("English", "en-GB");

            typeof(Entity).GetProperty(nameof(Entity.Id)).SetValue(english, 2);

            for (int i = 0; i < 100; i++)
            {
                var label = new Label($"Label Number: {i}");

                var danishValue  = new LabelValue($"Værdi for {i} på dansk", danish);
                var englishValue = new LabelValue($"Value for {i} in english", english);
                label.AddLabelValue(danishValue);
                label.AddLabelValue(englishValue);

                valuesToReturn.Add(label);
            }

            var mock = new Mock <ILabelService>();

            mock.Setup(x => x.Get()).ReturnsAsync(valuesToReturn);
            return(mock.Object);
        }