Ejemplo n.º 1
0
 public void TestInitialize() {
   Component testComponent = new Component();
   testComponent.Initialize();
   // No exception means success
 }
Ejemplo n.º 2
0
    /// <summary>Mocks a subscriber for the events of a tracker</summary>
    /// <param name="component">Component to mock an event subscriber for</param>
    /// <returns>The mocked event subscriber</returns>
    private IComponentSubscriber mockSubscriber(Component component) {
      IComponentSubscriber mockedSubscriber = this.mockery.NewMock<IComponentSubscriber>();

      component.EnabledChanged += new DeviceEventHandler(mockedSubscriber.EnabledChanged);
      component.UpdateOrderChanged += new DeviceEventHandler(
        mockedSubscriber.UpdateOrderChanged
      );

      return mockedSubscriber;
    }
Ejemplo n.º 3
0
 public void TestConstructor() {
   Component testComponent = new Component();
   Assert.IsNotNull(testComponent); // nonsense, avoids compiler warning
 }
Ejemplo n.º 4
0
    public void TestEnabledChangeEvent() {
      Component testComponent = new Component();
      testComponent.Enabled = true;

      IComponentSubscriber mockedSubscriber = mockSubscriber(testComponent);

      Expect.Once.On(mockedSubscriber).Method("EnabledChanged").WithAnyArguments();
      testComponent.Enabled = false;
      this.mockery.VerifyAllExpectationsHaveBeenMet();
    }
Ejemplo n.º 5
0
 public void TestEnableDisable() {
   Component testComponent = new Component();
   testComponent.Enabled = true;
   Assert.IsTrue(testComponent.Enabled);
   testComponent.Enabled = false;
   Assert.IsFalse(testComponent.Enabled);
 }
Ejemplo n.º 6
0
    public void TestUpdateOrderChangeEvent() {
      Component testComponent = new Component();
      IComponentSubscriber mockedSubscriber = mockSubscriber(testComponent);

      Expect.Once.On(mockedSubscriber).Method("UpdateOrderChanged").WithAnyArguments();
      testComponent.UpdateOrder = 123;
      this.mockery.VerifyAllExpectationsHaveBeenMet();
    }
Ejemplo n.º 7
0
 public void TestChangeUpdateOrder() {
   Component testComponent = new Component();
   testComponent.UpdateOrder = 123;
   Assert.AreEqual(123, testComponent.UpdateOrder);
 }
Ejemplo n.º 8
0
 public void TestUpdate() {
   Component testComponent = new Component();
   testComponent.Update(new GameTime());
   // No exception means success
 }