Esempio n. 1
0
        public override void SetUp()
        {
            base.SetUp();

            values = new[]
            {
                new KeyValuePair <int, string>(0, "Zero"),
                new KeyValuePair <int, string>(1, "One"),
                new KeyValuePair <int, string>(2, "Two"),
                new KeyValuePair <int, string>(3, "Three"),
            };

            valuesWithNull = new[]
            {
                new KeyValuePair <int?, string>(null, String.Empty),
                new KeyValuePair <int?, string>(0, "Zero"),
                new KeyValuePair <int?, string>(1, "One"),
                new KeyValuePair <int?, string>(2, "Two"),
                new KeyValuePair <int?, string>(3, "Three"),
            };

            valueModelMock = new Mock <Models.IEnumerationValueModel>(MockBehavior.Strict);
            // ignore Error handling for now
            valueModelMock.SetupGet <string>(o => o.Error).Returns(String.Empty);
            valueModelMock.SetupProperty(o => o.Value);
            valueModelMock.SetupGet(o => o.Label).Returns("ValueLabel");
            valueModelMock.SetupGet(o => o.AllowNullInput).Returns(true);

            valueModelMock
            .Setup <IEnumerable <KeyValuePair <int, string> > >(o => o.GetEntries())
            .Returns(values);

            obj = new EnumerationValueViewModel(scope.Resolve <IViewModelDependencies>(), scope.Resolve <BaseMemoryContext>(), null, valueModelMock.Object);
        }
Esempio n. 2
0
        public override void SetUp()
        {
            base.SetUp();

            values = new[]
            {
                new KeyValuePair<int, string>(0, "Zero"),
                new KeyValuePair<int, string>(1, "One"),
                new KeyValuePair<int, string>(2, "Two"),
                new KeyValuePair<int, string>(3, "Three"),
            };

            valuesWithNull = new[]
            {
                new KeyValuePair<int?, string>(null, String.Empty),
                new KeyValuePair<int?, string>(0, "Zero"),
                new KeyValuePair<int?, string>(1, "One"),
                new KeyValuePair<int?, string>(2, "Two"),
                new KeyValuePair<int?, string>(3, "Three"),
            };

            valueModelMock = new Mock<Models.IEnumerationValueModel>(MockBehavior.Strict);
            // ignore Error handling for now
            valueModelMock.SetupGet<string>(o => o.Error).Returns(String.Empty);
            valueModelMock.SetupProperty(o => o.Value);
            valueModelMock.SetupGet(o => o.Label).Returns("ValueLabel");
            valueModelMock.SetupGet(o => o.AllowNullInput).Returns(true);
            valueModelMock.SetupGet(o => o.ReportErrors).Returns(true);

            valueModelMock
                .Setup<IEnumerable<KeyValuePair<int, string>>>(o => o.GetEntries())
                .Returns(values);

            obj = new EnumerationValueViewModel(scope.Resolve<IViewModelDependencies>(), scope.Resolve<BaseMemoryContext>(), null, valueModelMock.Object);
        }