Пример #1
0
        public void AddMoreThanOneDataSourceConfig_Test()
        {
            CubeBuilder builder = new CubeBuilder();

            builder.SetName("hello")
            .SetSourceMappings((sourcebuild) => sourcebuild.SetSource("xpto"))
            .AddDataSource(dsbuild =>
            {
                dsbuild.SetName("xpto")
                .SetSourceType(DataSourceType.CSV)
                .SetCSVConfig(csvbuild =>
                {
                    csvbuild.SetFilePath("xpto.csv");
                });
            })
            .AddDataSource(dsbuild =>
            {
                dsbuild.SetName("xtable")
                .SetSourceType(DataSourceType.CSV)
                .SetCSVConfig(csvbuild =>
                {
                    csvbuild.SetFilePath("xtable.csv");
                });
            });

            Cube <int> cube = builder.Create <int>();

            Assert.AreEqual("xpto", cube.Config.DataSources["xpto"].Name);
            Assert.AreEqual("xtable", cube.Config.DataSources["xtable"].Name);
        }
Пример #2
0
        public void DataSourceFieldsSetupConfig_Test()
        {
            CubeBuilder builder = new CubeBuilder();

            builder.SetName("hello")
            .SetSourceMappings((sourcebuild) => sourcebuild.SetSource("xpto"))
            .AddDataSource(dsbuild =>
            {
                dsbuild.SetName("xpto")
                .SetSourceType(DataSourceType.CSV)
                .SetCSVConfig(csvbuild =>
                {
                    csvbuild.SetFilePath("xpto.csv");
                })
                .AddField("xval", 0, typeof(int))
                .AddField("yval", 1, typeof(int));
            });

            Cube <int> cube = builder.Create <int>();

            Assert.AreEqual("xval", cube.Config.DataSources["xpto"].Fields["xval"].Name);
            Assert.AreEqual(0, cube.Config.DataSources["xpto"].Fields["xval"].Index);
            Assert.AreEqual(typeof(int), cube.Config.DataSources["xpto"].Fields["xval"].FieldType);
            Assert.AreEqual("yval", cube.Config.DataSources["xpto"].Fields["yval"].Name);
            Assert.AreEqual(1, cube.Config.DataSources["xpto"].Fields["yval"].Index);
            Assert.AreEqual(typeof(int), cube.Config.DataSources["xpto"].Fields["yval"].FieldType);
        }
Пример #3
0
        public void AddMoreThanOneDimensionConfig_Test()
        {
            CubeBuilder builder = new CubeBuilder();

            builder.SetName("hello")
            .SetSourceMappings((sourcebuild) => sourcebuild.SetSource("xpto"))
            .MetaData(mbuild =>
            {
                mbuild.AddDimension("x", (dimbuild) =>
                {
                    dimbuild.Source("xtable")
                    .ValueField("xkey")
                    .DescField("xdesc");
                })
                .AddDimension("y", (dimbuild) =>
                {
                    dimbuild.Source("ytable")
                    .ValueField("ykey")
                    .DescField("ydesc");
                });
            });

            Cube <int> cube = builder.Create <int>();

            Assert.AreEqual("x", cube.Config.MetaData.Dimensions[0].Name);
            Assert.AreEqual("x", cube.Config.MetaData.Dimensions["x"].Name);
            Assert.AreEqual("y", cube.Config.MetaData.Dimensions[1].Name);
            Assert.AreEqual("y", cube.Config.MetaData.Dimensions["y"].Name);
        }
        public void CalculateParallelCubeIntersectionFigureTest(double x1, double y1, double z1, double edge1,
                                                                double x2, double y2, double z2, double edge2,
                                                                double rwidth, double rlength, double rdepth)
        {
            // En los parámetros no se puede poner el sufijo m de decimal
            decimal cx1, cy1, cz1, ce1, cx2, cy2, cz2, ce2;

            FromDoubleToDecimal(x1, y1, z1, edge1, x2, y2, z2, edge2, out cx1, out cy1, out cz1, out ce1, out cx2, out cy2, out cz2, out ce2);

            var width  = (decimal)rwidth;
            var length = (decimal)rlength;
            var depth  = (decimal)rdepth;

            IIntersectionCalculator intersectionCalculator = new IntersectionCalculator();
            Cube firstCube = CubeBuilder.CreateCube()
                             .CenteredAt(cx1, cy1, cz1)
                             .WithEdgeLength(ce1)
                             .Build();

            Cube secondCube = CubeBuilder.CreateCube()
                              .CenteredAt(cx2, cy2, cz2)
                              .WithEdgeLength(ce2)
                              .Build();

            Ortoedro result = intersectionCalculator.CalculateParallelCubeIntersectionFigure(firstCube, secondCube);

            Assert.IsTrue(result.Width == width && result.Length == length && result.Depth == depth, "The resultant ortoedro dimensions are not the expected.");
        }
Пример #5
0
        public void Build_ShouldBuildCubeSuccessfully()
        {
            // Arrange
            var builder = CubeBuilder.CreateEmpty();

            builder.AddPiece((0, 0, 0), Pieces.YellowRedGreen, Orientation.YellowWhite, Orientation.RedOrange, Orientation.GreenBlue);
            builder.AddPiece((1, 0, 0), Pieces.YellowRed, Orientation.YellowWhite, Orientation.RedOrange);
            builder.AddPiece((2, 0, 0), Pieces.YellowRedBlue, Orientation.YellowWhite, Orientation.RedOrange, Orientation.GreenBlue);
            builder.AddPiece((0, 1, 0), Pieces.RedGreen, Orientation.RedOrange, Orientation.GreenBlue);
            builder.AddPiece((2, 1, 0), Pieces.RedBlue, Orientation.RedOrange, Orientation.GreenBlue);
            builder.AddPiece((0, 2, 0), Pieces.RedGreenWhite, Orientation.RedOrange, Orientation.GreenBlue, Orientation.YellowWhite);
            builder.AddPiece((1, 2, 0), Pieces.RedWhite, Orientation.RedOrange, Orientation.YellowWhite);
            builder.AddPiece((2, 2, 0), Pieces.RedBlueWhite, Orientation.RedOrange, Orientation.GreenBlue, Orientation.YellowWhite);

            builder.AddPiece((0, 0, 1), Pieces.YellowGreen, Orientation.YellowWhite, Orientation.GreenBlue);
            builder.AddPiece((2, 0, 1), Pieces.YellowBlue, Orientation.YellowWhite, Orientation.GreenBlue);
            builder.AddPiece((0, 0, 2), Pieces.YellowGreenOrange, Orientation.YellowWhite, Orientation.GreenBlue, Orientation.RedOrange);
            builder.AddPiece((1, 0, 2), Pieces.YellowOrange, Orientation.YellowWhite, Orientation.RedOrange);
            builder.AddPiece((1, 2, 2), Pieces.OrangeWhite, Orientation.RedOrange, Orientation.YellowWhite);
            builder.AddPiece((2, 0, 2), Pieces.YellowBlueOrange, Orientation.YellowWhite, Orientation.GreenBlue, Orientation.RedOrange);

            builder.AddPiece((0, 1, 2), Pieces.GreenOrange, Orientation.GreenBlue, Orientation.RedOrange);
            builder.AddPiece((0, 2, 2), Pieces.GreenOrangeWhite, Orientation.GreenBlue, Orientation.RedOrange, Orientation.YellowWhite);
            builder.AddPiece((0, 2, 1), Pieces.GreenWhite, Orientation.GreenBlue, Orientation.YellowWhite);

            builder.AddPiece((2, 2, 1), Pieces.BlueWhite, Orientation.GreenBlue, Orientation.YellowWhite);
            builder.AddPiece((2, 2, 2), Pieces.BlueOrangeWhite, Orientation.GreenBlue, Orientation.RedOrange, Orientation.YellowWhite);
            builder.AddPiece((2, 1, 2), Pieces.BlueOrange, Orientation.GreenBlue, Orientation.RedOrange);

            Cube cube = builder.Build();
        }
        public void CubesIntersectionDoNotCollideTest(double x1, double y1, double z1, double edge1,
                                                      double x2, double y2, double z2, double edge2)
        {
            // En los parámetros no se puede poner el sufijo m de decimal
            decimal cx1, cy1, cz1, ce1, cx2, cy2, cz2, ce2;

            FromDoubleToDecimal(x1, y1, z1, edge1, x2, y2, z2, edge2, out cx1, out cy1, out cz1, out ce1, out cx2, out cy2, out cz2, out ce2);


            #region .: Configure mocks :.

            _intersectionCalculatorMock.Expects.AtLeastOne.Method(m => m.FindParallelCubeIntersection(null, null)).WithAnyArguments().WillReturn(false);
            _intersectionCalculatorMock.Expects.AtLeastOne.Method(m => m.CalculateParallelCubeIntersectionFigure(null, null)).WithAnyArguments().WillReturn(new Ortoedro());
            _volumeCalculatorMock.Expects.AtLeastOne.Method(m => m.CalculateOrtoedroVolume(null)).WithAnyArguments().WillReturn(1);

            #endregion .: Configure mocks :.

            ICubesIntersection cubesIntersection = new CubesIntersection(_intersectionCalculatorMock.MockObject, _volumeCalculatorMock.MockObject);
            Cube firstcube  = CubeBuilder.CreateCube().CenteredAt(cx1, cy1, cz1).WithEdgeLength(ce1).Build();
            Cube secondCube = CubeBuilder.CreateCube().CenteredAt(cx2, cy2, cz2).WithEdgeLength(ce2).Build();

            Tuple <bool, decimal> result = cubesIntersection.GetCubesIntersection(firstcube, secondCube);
            Assert.IsFalse(result.Item1, "Intersection should not have been found.");
            Assert.IsTrue(result.Item2 == 0, "Wrong volume.");
        }
Пример #7
0
        public VoxelEffect(GraphicsDevice graphicsDevice)
            : base(graphicsDevice, EffectHelper.LoadShaderBytes("voxelShader"))
        {
            BatchTechnique                = Techniques["Batch"];
            InstancingTechnique           = Techniques["Instancing"];
            MeshTechnique                 = Techniques["Mesh"];
            InstancingDepthTechnique      = Techniques["InstancingDepth"];
            InstancingWithShadowTechnique = Techniques["InstancingWithShadow"];
            InstancingShadowMapTechnique  = Techniques["InstancingShadowMap"];

            _paletteParam = Parameters["Palette"];

            _positionParam   = Parameters["ChunkPosition"];
            _viewParam       = Parameters["View"];
            _projectionParam = Parameters["Projection"];

            _dirLightMatrixParam = Parameters["DirectionalLightMatrix"];
            _lightDirParam       = Parameters["LightDirection"];
            _diffuseLightParam   = Parameters["DiffuseLight"];
            _ambientLightParam   = Parameters["AmbientLight"];

            _shadowMapParam = Parameters["ShadowMap"];

            Parameters["Normals"].SetValue(CubeBuilder.GetNormals());
        }
Пример #8
0
    static void CreateCube()
    {
        //
        BrushBuilder builder = new CubeBuilder();

        builder.Build();
    }
Пример #9
0
    void Awake()
    {
        _gameManager = FindObjectOfType <GameManager>();
        if (_gameManager == null)
        {
            Debug.LogError("OOPSALA we have an ERROR!");
        }

        _locationManager = _gameManager._locationManager;
        if (_locationManager == null)
        {
            Debug.LogError("OOPSALA we have an ERROR!");
        }


        _worldBuilder = GetComponentInChildren <WorldBuilder>();
        if (_worldBuilder == null)
        {
            Debug.LogError("OOPSALA we have an ERROR!");
        }

        _gridBuilder = GetComponentInChildren <GridBuilder>();
        if (_gridBuilder == null)
        {
            Debug.LogError("OOPSALA we have an ERROR!");
        }

        _cubeBuilder = GetComponentInChildren <CubeBuilder>();
        if (_cubeBuilder == null)
        {
            Debug.LogError("OOPSALA we have an ERROR!");
        }

        _mapPieceBuilder = GetComponentInChildren <MapPieceBuilder>();
        if (_mapPieceBuilder == null)
        {
            Debug.LogError("OOPSALA we have an ERROR!");
        }

        _outerZoneBuilder = GetComponentInChildren <OuterZoneBuilder>();
        if (_outerZoneBuilder == null)
        {
            Debug.LogError("OOPSALA we have an ERROR!");
        }

        _nodeBuilder = GetComponentInChildren <NodeBuilder>();
        if (_nodeBuilder == null)
        {
            Debug.LogError("OOPSALA we have an ERROR!");
        }



        _mapSettings = GetComponent <MapSettings>();
        if (_mapSettings == null)
        {
            Debug.LogError("OOPSALA we have an ERROR!");
        }
    }
Пример #10
0
        public void Given_TwoRandom_Cubes_GetIntersectionVolumeFromTwoCubesMethod_ShoulBe_Commutative_Operation()
        {
            var cubeA = CubeBuilder.Create().CenteredAt(0, 0, 0).WithEdgeLength(3).Build();
            var cubeB = CubeBuilder.Create().CenteredAt(2, 2, 2).WithEdgeLength(2).Build();

            _service.AreCubesColliding(cubeA, cubeB).Should().BeTrue();
            _service.GetIntersectionVolumeFromTwoCubes(cubeA, cubeB).Should().Be(_service.GetIntersectionVolumeFromTwoCubes(cubeB, cubeA));
        }
Пример #11
0
        public void MolapAddDateDimensionInit_Test()
        {
            CubeBuilder builder = new CubeBuilder();

            builder.SetName("hello2")
            .SetSourceMappings((sourcebuild) => sourcebuild.SetSource("sales"))
            .AddDataSource(dsbuild =>
            {
                dsbuild.SetName("sales")
                .SetSourceType(DataSourceType.CSV)
                .SetCSVConfig(csvbuild =>
                {
                    csvbuild.SetFilePath("TestData//tableWithDate.csv")
                    .SetHasHeader();
                })
                .AddField("category", 0, typeof(int))
                .AddField("sex", 1, typeof(int))
                .AddField("place", 2, typeof(int))
                .AddDateField("date", 3, "yyyy-MM-dd")
                .AddField("expenses", 4, typeof(double))
                .AddField("items", 5, typeof(int));
            })
            .AddDataSource(dsbuild =>
            {
                dsbuild.SetName("categories")
                .SetSourceType(DataSourceType.CSV)
                .AddField("id", 0, typeof(int))
                .AddField("description", 1, typeof(string))
                .SetCSVConfig(csvbuild =>
                {
                    csvbuild.SetFilePath("TestData//dimension1.csv")
                    .SetHasHeader();
                });
            })
            .MetaData(mbuild =>
            {
                mbuild.AddDimension("category", (dimbuild) =>
                {
                    dimbuild.Source("categories")
                    .ValueField("id")
                    .DescField("description");
                })
                .AddDimension("date", dimbuild =>
                {
                    dimbuild
                    .SetToDateSource(DateTimeLevels.YEAR, DateTimeLevels.MONTH_WITH_YEAR, DateTimeLevels.MONTH, DateTimeLevels.DAY)
                    .SetLevelDimensions("Year", "Year Month", "Month", "Day");
                });
            });

            Cube <int> cube = builder.Create <int>();

            cube.Initialize();

            Assert.AreEqual("Year", cube.Schema.Dimensions["Year"].Name);
            Assert.AreEqual(ItemType.Dimension, cube.Schema.Dimensions["Year"].ItemType);
            Assert.Greater(cube.Schema.Dimensions["Year"].ID, 1);
        }
Пример #12
0
        public void Given_Two_Cubes_Overlapped_With_Similar_Edge_Side_Should_Collide()
        {
            var cubeA = CubeBuilder.Create().CenteredAt(2, 2, 2).WithEdgeLength(2).Build();
            var cubeB = CubeBuilder.Create().CenteredAt(3, 2, 2).WithEdgeLength(2).Build();

            _service.AreEdgesColliding(cubeA.Width, cubeB.Width).Should().BeTrue();
            _service.AreEdgesColliding(cubeA.Height, cubeB.Height).Should().BeTrue();
            _service.AreEdgesColliding(cubeA.Height, cubeB.Depth).Should().BeTrue();
        }
Пример #13
0
 private void InitializeBuilders()
 {
     platformBuilder = new PlatformBuilder(platformParent, platformsStats.Platform, platformsStats.Corner, platformsStats.Finish,
                                           platformsStats.LengthOfPlatform, platformsStats.WidthOfPlatform);
     coinBuilder = new CoinBuilder(coinsParent, coinsStats.CoinsPrefab, maxLengthAmountCoins,
                                   maxWidthAmountCoins, coinsStats.CoinsSide, PositionToSpawn.AfterObstacles);
     obstacleBuilder = new ObstacleBuilder(obstaclesParent, obstaclesStats.ObstaclesPrefab, obstaclesStats.SideOfObstacles);
     cubeBuilder     = new CubeBuilder(cubesParent, cubesStats.CubesPrefab, cubesStats.SideCubes, PositionToSpawn.BeforeObstacles);
 }
Пример #14
0
        internal static CubeConfig GetConfig()
        {
            CubeBuilder builder = new CubeBuilder();

            builder.SetName("New_Cube")
            .Storage(store => { store.SetStoreType(StorageType.Molap); });

            return(builder.CreateConfig());
        }
Пример #15
0
        public void SetNameConfig_Test()
        {
            CubeBuilder builder = new CubeBuilder();

            builder.SetName("hello");

            Cube <int> cube = builder.Create <int>();

            Assert.AreEqual("hello", cube.Name);
        }
Пример #16
0
        [InlineData(1, 1, 0)] // center
        public void AddThreeCornerPiece_ThrowsArgumentException_WhenCoordinateIsInvalid(int x, int y, int z)
        {
            // Arrange
            var builder    = CubeBuilder.CreateEmpty();
            var coordinate = new CubeCoordinates(x, y, z);

            // Act & Assert
            Assert.Throws <ArgumentException>(
                () => builder.AddPiece(coordinate, Pieces.RedBlueWhite));
        }
Пример #17
0
        public void SetSourceConfig_Test()
        {
            CubeBuilder builder = new CubeBuilder();

            builder.SetName("hello")
            .SetSourceMappings((sourcebuild) => sourcebuild.SetSource("xpto"));

            Cube <int> cube = builder.Create <int>();

            Assert.AreEqual("xpto", cube.Source);
        }
Пример #18
0
        void Awake()
        {
            _mapSettings = FindObjectOfType <MapSettings> ();

            _GridManager = FindObjectOfType <GridManager> ();
            _TerrainDataSimple_Builder = FindObjectOfType <TerrainDataSimple_Builder> ();
            _TerrainDataFull_Builder   = FindObjectOfType <TerrainDataFull_Builder> ();
            _TerrainCubes_Builder      = FindObjectOfType <TerrainCubes_Builder> ();
            _CubeBuilder = FindObjectOfType <CubeBuilder> ();
            _CubeSocial  = FindObjectOfType <CubeSocial> ();
        }
    ////////////////////////////////////////////////
    ////////////////////////////////////////////////

    void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            _instance = this;
        }
    }
Пример #20
0
        internal BlenderAxis(Game game, EditorCamera camera) : base(game)
        {
            this.camera = camera;
            float size     = 0.3f;
            float distance = 0.5f;

            cubes.Add(CubeBuilder.MakeBasicCube(game.GraphicsDevice, Vector3.Zero, Vector3.UnitX * size, -Vector3.UnitY * size, Vector3.UnitZ * size), Color.White);
            cubes.Add(CubeBuilder.MakeBasicCube(game.GraphicsDevice, Vector3.UnitX * distance, Vector3.UnitX * size, -Vector3.UnitY * size, Vector3.UnitZ * size), Color.Red);
            cubes.Add(CubeBuilder.MakeBasicCube(game.GraphicsDevice, Vector3.UnitY * distance, Vector3.UnitX * size, -Vector3.UnitY * size, Vector3.UnitZ * size), Color.Green);
            cubes.Add(CubeBuilder.MakeBasicCube(game.GraphicsDevice, Vector3.UnitZ * distance, Vector3.UnitX * size, -Vector3.UnitY * size, Vector3.UnitZ * size), Color.Blue);
        }
Пример #21
0
        public static Model3DGroup CreateSelection()
        {
            var cubeBuilder = new CubeBuilder(MovementConstants.ScaleFactor + 0.01D);
            var cube        = cubeBuilder.Create(System.Windows.Media.Colors.Red, 0, 0, 0);

            var group = new Model3DGroup();

            @group.Children.Add(cube);

            return(@group);
        }
Пример #22
0
        public void GetFirstCubeMatrixPosition_withCorrectOriginpoint_should_return_true()
        {
            //Arrange
            var cube  = new CubeBuilder().WithSize(4).WithCenterX(4).WithCenterY(4).WithCenterZ(4).Build();
            var point = new PointBuilder().WithX(2).WithY(2).WithZ(2).Build();

            //Act
            var result = cubeManager.GetFirstCubeMatrixPosition(cube);

            //Assert
            Assert.IsTrue(ComparePoints(result, point));
        }
Пример #23
0
        public void HasCollision_collideWithOtherCube_should_return_true()
        {
            //Arrange
            var cube1 = new CubeBuilder().WithSize(4).WithCenterX(4).WithCenterY(4).WithCenterZ(4).Build();
            var cube2 = new CubeBuilder().WithSize(4).WithCenterX(6).WithCenterY(6).WithCenterZ(4).Build();

            //Act
            var result = cubeManager.HasCollision(cube1, cube2);

            //Assert
            Assert.IsTrue(result);
        }
Пример #24
0
        public void HasCollision_notCollideWithOtherCube_should_return_false()
        {
            //Arrange
            var cube1 = new CubeBuilder().WithSize(2).WithCenterX(2).WithCenterY(2).WithCenterZ(2).Build();
            var cube2 = new CubeBuilder().WithSize(3).WithCenterX(5).WithCenterY(4).WithCenterZ(4).Build();

            //ACT
            var result = cubeManager.HasCollision(cube1, cube2);

            //Assert
            Assert.IsFalse(result);
        }
        public void MolapAddDimensionInit_Test()
        {
            CubeBuilder builder = new CubeBuilder();

            builder.SetName("hello")
            .SetSourceMappings((sourcebuild) => sourcebuild.SetSource("sales"))
            .AddDataSource(dsbuild =>
            {
                dsbuild.SetName("sales")
                .SetSourceType(DataSourceType.CSV)
                .SetCSVConfig(csvbuild =>
                {
                    csvbuild.SetFilePath("TestData//table.csv")
                    .SetHasHeader();
                })
                .AddField("category", 0, typeof(int))
                .AddField("sex", 1, typeof(int))
                .AddField("place", 2, typeof(int))
                .AddField("expenses", 3, typeof(double))
                .AddField("items", 4, typeof(int));
            })
            .AddDataSource(dsbuild =>
            {
                dsbuild.SetName("categories")
                .SetSourceType(DataSourceType.CSV)
                .AddField("id", 0, typeof(int))
                .AddField("description", 1, typeof(string))
                .SetCSVConfig(csvbuild =>
                {
                    csvbuild.SetFilePath("TestData//dimension1.csv")
                    .SetHasHeader();
                });
            })
            .MetaData(mbuild =>
            {
                mbuild.AddDimension("category", (dimbuild) =>
                {
                    dimbuild.Source("categories")
                    .ValueField("id")
                    .DescField("description");
                });
            });

            Cube <int> cube = builder.Create <int>();

            cube.Initialize();

            Assert.AreEqual("category", cube.Schema.Dimensions["category"].Name);
            Assert.AreEqual("categories", cube.Schema.Dimensions["category"].DataSource.Name);
            Assert.AreEqual(ItemType.Dimension, cube.Schema.Dimensions["category"].ItemType);
            Assert.Greater(cube.Schema.Dimensions["category"].ID, 0);
        }
Пример #26
0
        public void GetIntersectionVolume_withCorrectResult_should_return_true()
        {
            //Arrange
            var   cube1          = new CubeBuilder().WithSize(4).WithCenterX(4).WithCenterY(4).WithCenterZ(4).Build();
            var   cube2          = new CubeBuilder().WithSize(4).WithCenterX(6).WithCenterY(6).WithCenterZ(4).Build();
            float expectedResult = 16;

            //Act
            var result = cubeManager.GetIntersectionVolume(cube1, cube2);

            //Assert
            Assert.AreEqual(result, expectedResult);
        }
Пример #27
0
        public void AddTwoCornerPiece_AddsThePieceToTheRightPlace()
        {
            // Arrange
            var builder    = CubeBuilder.CreateEmpty();
            var coordinate = new CubeCoordinates(1, 2, 0);

            // Act
            builder.AddPiece(coordinate, Pieces.RedWhite);

            // Assert
            Assert.Equal(27 - 1 - 6 - 1, builder.EmptyPieceSpaces);
            Assert.Equal(Pieces.RedWhite, builder.GetPiece((1, 2, 0)));
        }
Пример #28
0
        public void AddThreeCornerPiece_AddsThePieceToTheRightPlace()
        {
            // Arrange
            var builder    = CubeBuilder.CreateEmpty();
            var coordinate = new CubeCoordinates(0, 0, 0);

            // Act
            builder.AddPiece(coordinate, Pieces.RedBlueWhite, Orientation.RedOrange, Orientation.GreenBlue, Orientation.YellowWhite);

            // Assert
            Assert.Equal(27 - 1 - 6 - 1, builder.EmptyPieceSpaces);
            Assert.Equal(Pieces.RedBlueWhite, builder.GetPiece((0, 0, 0)));
        }
Пример #29
0
        // GET: Home
        public ActionResult Index()
        {
            var firstRequest  = repository.GetResultForFirstYear();
            var secondRequest = repository.GetResultForYear(2012);
            var thirdRequest  = repository.GetInternetSalesAmount();
            var fourthRequest = repository.TestExecuteReader();
            var fifthRequest  = repository.TestExecuteXmlReader();
            var dmvQuery      = repository.TestDmv();

            var viewModel = CubeBuilder.BuildViewModel(thirdRequest);

            return(View(viewModel));
        }
        public void MolapAddMeasureInit_Test()
        {
            CubeBuilder builder = new CubeBuilder();

            builder.SetName("hello")
            .SetSourceMappings((sourcebuild) => sourcebuild.SetSource("xpto"))
            .AddDataSource(dsbuild =>
            {
                dsbuild.SetName("xpto")
                .SetSourceType(DataSourceType.CSV)
                .AddField("x", 0, typeof(int))
                .AddField("varx1", 2, typeof(int))
                .SetCSVConfig(csvbuild =>
                {
                    csvbuild.SetFilePath("xpto.csv");
                });
            })
            .AddDataSource(dsbuild =>
            {
                dsbuild.SetName("xtable")
                .SetSourceType(DataSourceType.CSV)
                .AddField("xkey", 0, typeof(int))
                .AddField("xdesc", 1, typeof(string))
                .SetCSVConfig(csvbuild =>
                {
                    csvbuild.SetFilePath("xtable.csv");
                });
            })
            .MetaData(mbuild =>
            {
                mbuild.AddDimension("x", (dimbuild) =>
                {
                    dimbuild.Source("xtable")
                    .ValueField("xkey")
                    .DescField("xdesc");
                })
                .AddMeasure("var1", mesbuild =>
                {
                    mesbuild.ValueField("varx1")
                    .SetType(typeof(int));
                });
            });

            Cube <int> cube = builder.Create <int>();

            cube.Initialize();

            Assert.AreEqual("var1", cube.Schema.Measures["var1"].Name);
            Assert.AreEqual(ItemType.Measure, cube.Schema.Measures["var1"].ItemType);
            Assert.AreEqual(typeof(int), cube.Schema.Measures["var1"].DataType);
        }
Пример #31
0
    static void CreateCube () {
		// 
		BrushBuilder builder = new CubeBuilder();
		builder.Build();
    }