Exemplo n.º 1
0
        public void AcquireIgniteTopologyProjections_Success()
        {
            var igniteMock = new IgniteMock();

            DIBuilder.Continue()
            .Add(TRexGridFactory.AddGridFactoriesToDI)

            // Override the main Ignite grid factory method DI'ed from TRexGridFactory.AddGridFactoriesToDI()
            .Add(x => x.AddSingleton <Func <string, IgniteConfiguration, IIgnite> >(factory => (gridName, cfg) => igniteMock.mockIgnite.Object))
            .Complete();

            var ignite = new BaseIgniteClass(TRexGrids.GridName(StorageMutability.Immutable), "TestRole");

            ignite.AcquireIgniteTopologyProjections();
        }
Exemplo n.º 2
0
        public void AcquireIgniteTopologyProjections_FailWithNullIgnite()
        {
            // Ensure any injected IIgnite anf ITRexGridFactory are removed

            DIBuilder.Continue()
            .RemoveSingle <IIgnite>()
            .RemoveSingle <ITRexGridFactory>()
            .Complete();

            var gridName = TRexGrids.GridName(StorageMutability.Immutable);
            var role     = "TestRole";

            Action act = () => _ = new BaseIgniteClass(gridName, role);

            if (DIContext.DefaultIsRequired)
            {
                act.Should().Throw <InvalidOperationException>().WithMessage("No service for type 'VSS.TRex.GridFabric.Grids.ITRexGridFactory' has been registered.");
            }
            else
            {
                act.Should().Throw <TRexException>().WithMessage("Ignite reference is null in AcquireIgniteTopologyProjections");
            }
        }