예제 #1
0
 public void TestInitialize() {
   Component testComponent = new Component();
   testComponent.Initialize();
   // No exception means success
 }
예제 #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;
    }
예제 #3
0
 public void TestConstructor() {
   Component testComponent = new Component();
   Assert.IsNotNull(testComponent); // nonsense, avoids compiler warning
 }
예제 #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();
    }
예제 #5
0
 public void TestEnableDisable() {
   Component testComponent = new Component();
   testComponent.Enabled = true;
   Assert.IsTrue(testComponent.Enabled);
   testComponent.Enabled = false;
   Assert.IsFalse(testComponent.Enabled);
 }
예제 #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();
    }
예제 #7
0
 public void TestChangeUpdateOrder() {
   Component testComponent = new Component();
   testComponent.UpdateOrder = 123;
   Assert.AreEqual(123, testComponent.UpdateOrder);
 }
예제 #8
0
 public void TestUpdate() {
   Component testComponent = new Component();
   testComponent.Update(new GameTime());
   // No exception means success
 }