Пример #1
0
        public override void Given()
        {
            base.Given();



            messageMap = New.MessageMap_v2("Change Order Attributes")
                         .Fields(x => x.Label("Ref.").Value("PO001"),
                                 x => x.Label("Order Date").Value(new DateTime(2010, 1, 12))).Build();
            var fieldV2s = messageMap.Fields.ToList();

            fieldViewModelLocator = Moq.Mock <IFieldViewModelLocator>();
            fieldViewModelLocator.Setup(x => x.GetViewModel(fieldV2s[0]))
            .Returns((IField_v2 x) => new MessageValueFieldViewModel <string>(x));
            fieldViewModelLocator.Setup(x => x.GetViewModel(fieldV2s[1]))
            .Returns((IField_v2 x) => new MessageValueFieldViewModel <DateTime>(x));
        }
        public override void Given()
        {
            base.Given();

            messageMap = New.MessageMap_v2("Supplier")
                .Fields(x => x.Label("Supplier Name")
                                .Value(new Supplier() { Name = "Elgar" })
                            ).Build();
            var fieldV2s = messageMap.Fields.ToList();

            var lookUpDataProvider = Moq.Mock<ILookUpDataProvider>();
            lookUpDataProvider.Setup(x => x.GetLookupData<Supplier>())
                .Returns(new[]
                             {
                                 new Supplier() {Name = "Elgar"},
                                 new Supplier() {Name = "Supplier2"},
                                 new Supplier() {Name = "Supplier3"}
                             });

            fieldViewModelLocator = Moq.Mock<IFieldViewModelLocator>();
            fieldViewModelLocator.Setup(x => x.GetViewModel(fieldV2s[0]))
                .Returns((IField_v2 x) => new MessageReferenceFieldViewModel<Supplier>(x, lookUpDataProvider));
        }
        public override void Given()
        {
            base.Given();

            messageMap = New.MessageMap_v2("Supplier")
                         .Fields(x => x.Label("Supplier Name")
                                 .Value(new Supplier()
            {
                Name = "Elgar"
            })
                                 ).Build();
            var fieldV2s = messageMap.Fields.ToList();

            var lookUpDataProvider = Moq.Mock <ILookUpDataProvider>();

            lookUpDataProvider.Setup(x => x.GetLookupData <Supplier>())
            .Returns(new[]
            {
                new Supplier()
                {
                    Name = "Elgar"
                },
                new Supplier()
                {
                    Name = "Supplier2"
                },
                new Supplier()
                {
                    Name = "Supplier3"
                }
            });

            fieldViewModelLocator = Moq.Mock <IFieldViewModelLocator>();
            fieldViewModelLocator.Setup(x => x.GetViewModel(fieldV2s[0]))
            .Returns((IField_v2 x) => new MessageReferenceFieldViewModel <Supplier>(x, lookUpDataProvider));
        }