public void TestInitialize() { Component testComponent = new Component(); testComponent.Initialize(); // No exception means success }
/// <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; }
public void TestConstructor() { Component testComponent = new Component(); Assert.IsNotNull(testComponent); // nonsense, avoids compiler warning }
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(); }
public void TestEnableDisable() { Component testComponent = new Component(); testComponent.Enabled = true; Assert.IsTrue(testComponent.Enabled); testComponent.Enabled = false; Assert.IsFalse(testComponent.Enabled); }
public void TestUpdateOrderChangeEvent() { Component testComponent = new Component(); IComponentSubscriber mockedSubscriber = mockSubscriber(testComponent); Expect.Once.On(mockedSubscriber).Method("UpdateOrderChanged").WithAnyArguments(); testComponent.UpdateOrder = 123; this.mockery.VerifyAllExpectationsHaveBeenMet(); }
public void TestChangeUpdateOrder() { Component testComponent = new Component(); testComponent.UpdateOrder = 123; Assert.AreEqual(123, testComponent.UpdateOrder); }
public void TestUpdate() { Component testComponent = new Component(); testComponent.Update(new GameTime()); // No exception means success }