Exemplo n.º 1
0
        public void Init()
        {
            //Arrange
            _repo = new Mock <IRepository <ExpandoObject> >();
            dynamic entityDynamicOne = new ExpandoObject();

            entityDynamicOne.id   = 3;
            entityDynamicOne.name = "Person";
            entityDynamicOne.x    = 150.0;
            entityDynamicOne.y    = 120.0;

            dynamic entityDynamicTwo = new ExpandoObject();

            entityDynamicTwo.id   = 4;
            entityDynamicTwo.name = "Employee";
            entityDynamicTwo.x    = 20.0;
            entityDynamicTwo.y    = 400.0;

            dynamic entityDynamicReturnAdd = new ExpandoObject();

            entityDynamicReturnAdd.id   = 1;
            entityDynamicReturnAdd.name = "Shape";
            entityDynamicReturnAdd.x    = 111.0;
            entityDynamicReturnAdd.y    = 222.0;

            _repo.Setup(x => x.All()).Returns(
                new List <ExpandoObject>()
            {
                entityDynamicOne, entityDynamicTwo
            });
            _repo.Setup(x => x.Add(It.IsAny <string>(), It.IsAny <double>(), It.IsAny <double>()))
            .Returns((ExpandoObject)entityDynamicReturnAdd);
            _entityStore = new EntityStoreService(_repo.Object);
        }
Exemplo n.º 2
0
        public MainViewModel(IRepository <ExpandoObject> entityRepository)
        {
            EntityStore = new EntityStoreService(entityRepository);

            EntityStore.Load();

            EntitiesBinding = new Binding {
                Source = EntityStore
            };
        }