public void CubesVolumen() { //Arrange var logger = new ConsoleLogger(); double cubeAcoordx = 2, cubeAcoordy = 2, cubeAcoordz = 2, cubeAlength = 2; double cubeBcoordx = 3, cubeBcoordy = 2, cubeBcoordz = 2, cubeBlength = 2; var sut = new CubicEngine(logger, new CubeBuilderService(), new CubeCollisionService(), new CubeVolumeCalculatorService()); sut.cubeA = sut.BuildCube(cubeAcoordx, cubeAcoordy, cubeAcoordz, cubeAlength); sut.cubeB = sut.BuildCube(cubeBcoordx, cubeBcoordy, cubeBcoordz, cubeBlength); //Act var result = sut.CalculateCubesVolume(); //Assert Assert.True(result > 0); }
static void Main(string[] args) { try { var logger = new ConsoleLogger(); var engine = new CubicEngine(logger, new CubeBuilderService(), new CubeCollisionService(), new CubeVolumeCalculatorService()); Console.WriteLine("************************************************************"); Console.WriteLine("*** Welcome to the Cube Collision and Volume Calculator! ***"); Console.WriteLine("************************************************************"); engine.ReadUserInput(); //Calculating Collision if (engine.CalculateCubesCollision()) { Console.WriteLine("Cubes Collide!"); } else { Console.WriteLine("Cubes do not touch each other!"); } //Calculating Volume, if applicable var volume = engine.CalculateCubesVolume(); if (volume == 0) { Console.WriteLine("Cubes do not intersect!"); } else { Console.WriteLine("Cubes Intersection Volume:{0} ", volume); } } catch (Exception ex) { Console.WriteLine("A Problem was found while running the application. Log: " + ex.Message); } }