コード例 #1
0
ファイル: VarMgrFactoryFixture.cs プロジェクト: BgRva/Blob1
        public void Create_Returns_Instance_Of_IVarMgr()
        {
            //Arrange
            var fac = new VarMgrFactory();

            //Act
            IVarMgr mgr = fac.Create();

            //Assert
            Assert.NotNull(mgr);
        }
コード例 #2
0
ファイル: UnpersistMgrFixture.cs プロジェクト: BgRva/Blob1
        //[Theory]
        //[InlineData("<WorkSpace id=\"41e9137f-d51a-4e83-bbcb-6e73c7467004\" mode=\"Single\"><Settings /><Options /><Variables /><Elements /><Pipes /></WorkSpace>" , 0, 0, "41e9137f-d51a-4e83-bbcb-6e73c7467004")]
        //public void Unpersist_ByFragment(string inputStr, int elementCount, int pipeCount, string guidStr0)
        //{
        //    var upMgr = new UnpersistMgr(null);
        //    // cant test
        //    Guid initId = Guid.NewGuid();
        //    IWorkSpace ws = CreateWorkSpaceCore(initId);
        //    Assert.NotNull(ws);
        //    var reader = new XmlTextReader(new StringReader(inputStr));
        //    upMgr.Reader = reader;
        //    upMgr.Format = WorkSpaceFormats.Default;
        //    upMgr.WorkSpace = ws;
        //    upMgr.Unpersist();
        //    Guid expectedId = new Guid(guidStr0);
        //    Assert.Equal(expectedId, ws.Id);
        //    Assert.NotNull(ws.SettingsMgr);
        //    Assert.NotNull(ws.OptionsMgr);
        //    Assert.NotNull(ws.VarMgr);
        //    Assert.NotNull(ws.ElementsMgr);
        //    Assert.NotNull(ws.PipesMgr);
        //    Assert.Equal(elementCount, ws.ElementsMgr.Count);
        //    Assert.Equal(pipeCount, ws.PipesMgr.Count);
        //}
        //[Theory]
        //[InlineData(@"J:\_bsa\source\TestData\wkSpaceTest_0_0.wks", 0, 0, "41e9137f-d51a-4e83-bbcb-6e73c7467004", new string[] { }, new string[] { })]
        //[InlineData(@"J:\_bsa\source\TestData\wkSpaceTest_1_0.wks", 1, 0, "cd1546cc-4177-4e53-bc99-0f757e94e8eb", new string[] { }, new string[] { })]
        //[InlineData(@"J:\_bsa\source\TestData\wkSpaceTest_2_0.wks", 2, 0, "636566ff-e696-407d-81da-c518ec3dc9e4", new string[] { }, new string[] { })]
        //[InlineData(@"J:\_bsa\source\TestData\wkSpaceTest_2_1.wks", 2, 1, "40a9f35f-8bb2-495e-8761-e414414ae03f", new string[] { }, new string[] { })]
        //public void Unpersist_ByFileInput(string fileName, int elementCount, int pipeCount, string guidStr0, string [] elGuidStrs, string [] pipeGuidStrs)
        //{
        //    var upMgr = new UnpersistMgr();
        //    // by mocking
        //    var mockWS = new Mock<IWorkSpace>();
        //    var mockWsUnpersister = new Mock<IWorkSpaceUnpersister>();
        //    using (RecordExpectations recorder = RecorderManager.StartRecording())
        //    {
        //        WorkSpaceUnpersisterProvider wpp = new WorkSpaceUnpersisterProvider();
        //        recorder.ExpectAndReturn(wpp.Create(null, WorkSpaceFormats.Default), mockWsUnpersister);
        //        mockWsUnpersister.UnpersistProgressChanged += null;
        //        mockWsUnpersister.UnpersistCompleted += null;
        //        mockWsUnpersister.UnpersistWorkSpace(mockWS, _reader);
        //        mockWsUnpersister.UnpersistProgressChanged -= null;
        //        mockWsUnpersister.UnpersistCompleted -= null;
        //        mockWsUnpersister.Dispose();
        //    }
        //    upMgr.Reader = _reader;
        //    upMgr.WorkSpace = mockWS;
        //    upMgr.Format = WorkSpaceFormats.Default;
        //    upMgr.FileName = fileName;
        //    upMgr.Unpersist();
        //    MockManager.Verify();
        //}
        //[Theory]
        //[InlineData(@"C:\_bsa\dump\wkSpaceTest_0_0.wks", 0, 0, "41e9137f-d51a-4e83-bbcb-6e73c7467004", new string[] { }, new string[] { })]
        //[InlineData(@"C:\_bsa\dump\wkSpaceTest_1_0.wks", 1, 0, "cd1546cc-4177-4e53-bc99-0f757e94e8eb", new string[] { }, new string[] { })]
        //[InlineData(@"C:\_bsa\dump\wkSpaceTest_2_0.wks", 2, 0, "636566ff-e696-407d-81da-c518ec3dc9e4", new string[] { }, new string[] { })]
        //[InlineData(@"C:\_bsa\dump\wkSpaceTest_2_1.wks", 2, 1, "40a9f35f-8bb2-495e-8761-e414414ae03f", new string[] { }, new string[] { })]
        //[MbUnit.Framework.Ignore("Tests with MySimpleEl will fail as that has not been build for deployment.")]
        //public void Unpersist_ByFileInput_Real(string fileName, int elementCount, int pipeCount, string guidStr0, string [] elGuidStrs, string [] pipeGuidStrs)
        //{
        //    var upMgr = new UnpersistMgr();
        //    Guid initId = Guid.NewGuid();
        //    IWorkSpace ws = CreateWorkSpaceCore(initId);
        //    Assert.NotNull(ws);
        //    upMgr.Format = WorkSpaceFormats.Default;
        //    upMgr.WorkSpace = ws;
        //    upMgr.FileName = fileName;
        //    upMgr.Unpersist();
        //    Guid expectedId = new Guid(guidStr0);
        //    Assert.Equal(expectedId, ws.Id);
        //    Assert.NotNull(ws.SettingsMgr);
        //    Assert.NotNull(ws.OptionsMgr);
        //    Assert.NotNull(ws.VarMgr);
        //    Assert.NotNull(ws.ElementsMgr);
        //    Assert.NotNull(ws.PipesMgr);
        //    Assert.Equal(elementCount, ws.ElementsMgr.Count);
        //    Assert.Equal(pipeCount, ws.PipesMgr.Count);
        //}
        //[Theory]
        //[InlineData(@"C:\_bsa\dump\wkSpaceTest_0_0.wks", 0, 0, "41e9137f-d51a-4e83-bbcb-6e73c7467004", new string[] { }, new string[] { })]
        //[InlineData(@"C:\_bsa\dump\wkSpaceTest_1_0.wks", 1, 0, "cd1546cc-4177-4e53-bc99-0f757e94e8eb", new string[] { }, new string[] { })]
        //[InlineData(@"C:\_bsa\dump\wkSpaceTest_2_0.wks", 2, 0, "636566ff-e696-407d-81da-c518ec3dc9e4", new string[] { }, new string[] { })]
        //[InlineData(@"C:\_bsa\dump\wkSpaceTest_2_1.wks", 2, 1, "40a9f35f-8bb2-495e-8761-e414414ae03f", new string[] { }, new string[] { })]
        //[MbUnit.Framework.Ignore("Tests with MySimpleEl will fail as that has not been build for deployment." )]
        //public void Unpersist_ByFileInput_ReturnsPipeTickets_Real(string fileName, int elementCount, int pipeCount, string guidStr0, string[] elGuidStrs, string[] pipeGuidStrs)
        //{
        //    var upMgr = new UnpersistMgr();
        //    Guid initId = Guid.NewGuid();
        //    IWorkSpace ws = CreateWorkSpaceCore(initId);
        //    Assert.NotNull(ws);
        //    IPipeTicket[] pipeTickets = null;
        //    upMgr.Format = WorkSpaceFormats.Default;
        //    upMgr.WorkSpace = ws;
        //    upMgr.FileName = fileName;
        //    upMgr.Unpersist(out pipeTickets);
        //    Guid expectedId = new Guid(guidStr0);
        //    Assert.Equal(expectedId, ws.Id);
        //    Assert.NotNull(ws.SettingsMgr);
        //    Assert.NotNull(ws.OptionsMgr);
        //    Assert.NotNull(ws.VarMgr);
        //    Assert.NotNull(ws.ElementsMgr);
        //    Assert.NotNull(ws.PipesMgr);
        //    Assert.Equal(elementCount, ws.ElementsMgr.Count);
        //    Assert.Equal(pipeCount, ws.PipesMgr.Count);
        //    Assert.NotNull(pipeTickets);
        //    Assert.Equal(pipeCount, pipeTickets.Length);
        //}
        //Helpers
        public IWorkSpace CreateWorkSpaceCore(Guid id)
        {
            IElements elMgr = new BlueSpider.Common.WorkSpace.Elements();
            IPipes pipeMgr = new BlueSpider.Common.WorkSpace.Pipes();

            IVarMgr vMgr = null;
            using (VarMgrFactory fac = new VarMgrFactory())
            {
                vMgr = fac.Create();
            }

            IWorkSpaceSettingsMgr sMgr = null;
            using (SettingsMgrFactory fac = new SettingsMgrFactory())
            {
                sMgr = fac.CreateWorkSpaceSettingsMgr();
            }

            IWorkSpaceOptionsMgr oMgr = null;
            using (OptionsMgrFactory fac = new OptionsMgrFactory())
            {
                oMgr = fac.CreateWorkSpaceOptionsMgr();
            }

            // TODO  use a DI framework for this
            IWorkSpace ws = null;
            using (WorkSpaceFactory fac = new WorkSpaceFactory())
            {
                ws = fac.Create(id, vMgr, elMgr, pipeMgr, oMgr, sMgr);
            }

            return ws;
        }
コード例 #3
0
        public void CTor()
        {
            IParamVarMapper mapper = _varMapfactory.CreateMapper();
            VarMgrFactory fac = new VarMgrFactory();
            IVarMgr varMgr = fac.Create();
            IdentNodeCoresParamMgr mgr = new IdentNodeCoresParamMgr(_bag, mapper);

            Assert.Same(_bag, mgr.Bag);
        }