BlocksContentTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    Blocks.Tests BlocksContentTests

Namespace: Blocks.Tests
Assembly: Blocks.Tests (in Blocks.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class BlocksContentTests : TestWithMocksOrVisually

The BlocksContentTests type exposes the following members.

Constructors

  NameDescription
Public methodBlocksContentTests
Initializes a new instance of the BlocksContentTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodAreFiveBrickBlocksAllowed
Public methodContentWithPrefixSet
Public methodDoBlocksStartInARandomColumn
Public methodDoBricksSplitInHalfOnExit
Public methodGetFilenameWithoutPrefix
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodLoadContentWithNoPrefixSet
Public methodLoadContentWithPrefixSet
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test, CloseAfterFirstFrame]
public void DoBricksSplitInHalfOnExit()
{
    var content = new JewelBlocksContent();
    Assert.IsFalse(content.DoBricksSplitInHalfWhenRowFull);
    content.DoBricksSplitInHalfWhenRowFull = true;
    Assert.IsTrue(content.DoBricksSplitInHalfWhenRowFull);
}
[Test, CloseAfterFirstFrame]
public void AreFiveBrickBlocksAllowed()
{
    var content = new JewelBlocksContent();
    Assert.IsTrue(content.AreFiveBrickBlocksAllowed);
    content.AreFiveBrickBlocksAllowed = false;
    Assert.IsFalse(content.AreFiveBrickBlocksAllowed);
}
[Test, CloseAfterFirstFrame]
public void DoBlocksStartInARandomColumn()
{
    var content = new JewelBlocksContent();
    Assert.IsFalse(content.DoBlocksStartInARandomColumn);
    content.DoBlocksStartInARandomColumn = true;
    Assert.IsTrue(content.DoBlocksStartInARandomColumn);
}
[Test, CloseAfterFirstFrame]
public void GetFilenameWithoutPrefix()
{
    var content = new JewelBlocksContent { Prefix = "ABC" };
    Assert.AreEqual("DEF", content.GetFilenameWithoutPrefix("ABCDEF"));
    Assert.Throws<BlocksContent.FilenameWrongPrefixException>(
        () => content.GetFilenameWithoutPrefix("ADEF"));
    Assert.Throws<BlocksContent.FilenameWrongPrefixException>(
        () => content.GetFilenameWithoutPrefix("AAADEF"));
}
[Test, CloseAfterFirstFrame]
public void LoadContentWithNoPrefixSet()
{
    var material = new Material(ShaderFlags.Position2DColoredTextured, "FruitBlocks_Block1");
    Assert.IsNotNull(material.DiffuseMap);
}
[Test, CloseAfterFirstFrame]
public void LoadContentWithPrefixSet()
{
    var content = new JewelBlocksContent { Prefix = "Mod1_" };
    var material = new Material(ShaderFlags.Position2DColoredTextured, "DeltaEngineLogo");
    new Sprite(material, new Rectangle(0.3f, 0.45f, 0.1f, 0.1f));
    content.Prefix = "Mod2_";
    material = new Material(ShaderFlags.Position2DColoredTextured, "DeltaEngineLogo");
    new Sprite(material, new Rectangle(0.6f, 0.45f, 0.1f, 0.1f));
}
[Test, CloseAfterFirstFrame]
public void ContentWithPrefixSet()
{
    var content = new JewelBlocksContent { Prefix = "FruitBlocks_" };
    var image = content.Load<Image>("Block1");
    Assert.IsTrue(image.PixelSize == new Size(4) || image.PixelSize == new Size(64) ||
        image.PixelSize == new Size(128));
    content.Prefix = "JewelBlocks_";
    image = content.Load<Image>("Block1");
    Assert.IsTrue(image.PixelSize == new Size(4) || image.PixelSize == new Size(64) ||
        image.PixelSize == new Size(128));
}
See Also