Пример #1
0
        public void Init()
        {
            _itemToPage = 5;

            _modelCollarRecords = new List<COLLAR2>();
            _modelRecordsEmpty = new List<COLLAR2>();
            _modelAssaysRecords = new List<ASSAYS2>();

            for (int i = 0 ; i < 15 ; i++)
            {
                COLLAR2 newCollar2 = new COLLAR2();
                newCollar2.ID = i;
                newCollar2.BHID = "bhid" + i.ToString();
                newCollar2.HOLE_ID =  i;
                newCollar2.GORIZONT = new GORIZONT();
                newCollar2.RL_EXPLO2 = new RL_EXPLO2();
                newCollar2.DRILLING_TYPE = new DRILLING_TYPE();
                _modelCollarRecords.Add(newCollar2);
                ASSAYS2 newAssays2 = new ASSAYS2();
                newAssays2.BHID = newCollar2.ID;
                newAssays2.COLLAR2 = newCollar2;
                newAssays2.REESTR_VEDOMOSTEI = new REESTR_VEDOMOSTEI();
                newAssays2.BLOCK_ZAPASOV = new BLOCK_ZAPASOV();
                newAssays2.GEOLOGIST1 = new GEOLOGIST();
                newAssays2.JOURNAL1 = new JOURNAL();
                newAssays2.LITOLOGY = new LITOLOGY();
                newAssays2.RANG1 = new RANG();
                _modelAssaysRecords.Add(newAssays2);

            }

            _view = Substitute.For<IViewDrillHoles2>();
            _view.CollarList = new Dictionary<int, ICollar2VmFull>();
            _view.AssaysList = new Dictionary<int, IAssays2VmFull>();
            _viewEmpty = Substitute.For<IViewDrillHoles2>();
            _viewEmpty.CollarList = new Dictionary<int, ICollar2VmFull>();
            _viewEmpty.AssaysList = new Dictionary<int, IAssays2VmFull>();

            _modelCollar = Substitute.For<IBaseService<COLLAR2>>();
            _modelCollar.Get().Returns(_modelCollarRecords);
            _modelCollar.Count().Returns(_modelCollarRecords.Count);

            _modelAssays = Substitute.For<IBaseService<ASSAYS2>>();
            _modelAssays.Get().Returns(_modelAssaysRecords);
            _modelAssays.GetByBhid(Arg.Any<int>()).Returns(a=>_modelAssaysRecords.Where(x=>x.BHID==(int)a[0]));
            _modelAssays.Count().Returns(_modelAssaysRecords.Count);

            _modelGeologist = Substitute.For<IBaseService<GEOLOGIST>>();
            _modelGeologist.Get().Returns(new List<GEOLOGIST>());
            _modelGeologist.Count().Returns(0);

            _modelEmpty = Substitute.For<IBaseService<COLLAR2>>();
            _modelEmpty.Get().Returns(_modelRecordsEmpty);
            _modelEmpty.Count().Returns(_modelRecordsEmpty.Count);

            _browseCollar = new BrowseCollar(_modelCollar, _modelGeologist, _itemToPage);
            _browseAssays = new BrowseAssay(_modelAssays, _modelGeologist, _itemToPage);
        }