示例#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
 }