public void NormalTransform_SellGreaterThanZero_TransformsAsRate(int rate) { StockItem item = new StockItem() { Name = "test", SellIn = 1, Quality = new StockQuality(10) }; var transform = new NormalTransform(rate); transform.Transform(item); Assert.AreEqual(0, item.SellIn); Assert.AreEqual(10 - rate, item.Quality.Value); }
private Matrix SetModelVisualizationProjection(int leg) { Vector3 cameraPosition = Distance * new Vector3( (float)(Math.Cos(HorizantalAngle) * Math.Cos(VerticalAngle)), (float)(Math.Sin(HorizantalAngle) * Math.Cos(VerticalAngle)), (float)(Math.Sin(VerticalAngle))); Matrix Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(20f), XDevice.DisplayMode.AspectRatio, 0.001f, 5); Matrix View = Matrix.CreateLookAt( cameraPosition, Vector3.Zero, Vector3.UnitZ); Matrix World = Matrix.CreateRotationX(-MathHelper.PiOver2) * Matrix.CreateRotationZ(-MathHelper.PiOver2) * Matrix.CreateScale(-1f, 1f, 1f); Matrix MainWorld = World; World *= (leg == 2 ? Matrix.CreateTranslation(0f, 0f, -(ProjectionYMax + ProjectionYMin) / 2f) : Matrix.CreateTranslation(CoreX * (leg == 0 ? -1f : 1f), CoreY, -(ProjectionYMax + ProjectionYMin) / 2f)); LightPosition.SetValue(cameraPosition); CameraPosition.SetValue(cameraPosition); WorldTransform.SetValue(World); ModelTransform.SetValue(World * View * Projection); NormalTransform.SetValue(Matrix.Transpose(Matrix.Invert(World))); return(MainWorld * View * Projection); }