示例#1
0
文件: FindFixture.cs 项目: masums/BoC
        public FindFixture()
        {
            repository       = new Mock <IRepository <DummyModel> >();
            validator        = new Mock <IModelValidator>();
            eventAggregator  = new Mock <IEventAggregator>();
            service          = new Mock <BaseModelService <DummyModel> >(validator.Object, eventAggregator.Object, repository.Object);
            service.CallBase = true;

            dummy1 = new DummyModel()
            {
                Id = 1
            };
            dummy2 = new DummyModel()
            {
                Id = 2
            };
            dummy3 = new DummyModel()
            {
                Id = 3
            };
            dummy4 = new DummyModel()
            {
                Id = 4
            };
            items = new[]
            {
                dummy1,
                dummy2,
                dummy3,
                dummy4
            };
            repository.Setup(r => r.Query()).Returns(items.AsQueryable());
        }
        public BaseModelServiceBaseFixture()
        {
            repository = new Mock<IRepository<DummyModel>>();
            validator = new Mock<IModelValidator>();
            eventAggregator = new Mock<IEventAggregator>();
            service = new Mock<BaseModelService<DummyModel>>(validator.Object, eventAggregator.Object, repository.Object);
            service.CallBase = true;

            dummy1 = new DummyModel() { Id = 1 };
            dummy2 = new DummyModel() { Id = 2 };
            dummy3 = new DummyModel() { Id = 3 };
            dummy4 = new DummyModel() { Id = 4 };
            items = new[]
                            {
                                dummy1,
                                dummy2,
                                dummy3,
                                dummy4
                            };
            repository.Setup(r => r.Query()).Returns(items.AsQueryable());
        }