public void Generate_GivenTypeAndDriver_ReturnsInterceptedType() { var proxy = ProxyGenerator.Generate <PopgTestObject>(_fakeDriver); var interceptor = ((IInterceptor[])proxy.GetType() .GetFields(BindingFlags.Instance | BindingFlags.NonPublic) .Single(x => x.Name == "__interceptors") .GetValue(proxy)).Single(); Assert.That(interceptor, Is.TypeOf <PageObjectProxy>()); }
public void Generate_PassedNullDriverBindings_Throws() { var ex = Assert.Throws <ArgumentNullException>(() => ProxyGenerator.Generate <PopgTestObject>(null)); Assert.That(ex.Message, Is.EqualTo("Value cannot be null. (Parameter 'configuration')")); }
public void Generate_GivenTypeAndDriver_InheritsFromPom() { var proxy = ProxyGenerator.Generate <PopgTestObject>(_fakeDriver); Assert.That(proxy.GetType().BaseType, Is.EqualTo(typeof(PopgTestObject))); }
public void Generate_GivenTypeAndDriver_GeneratesProxyThatPassesTypeCheck() { var proxy = ProxyGenerator.Generate <PopgTestObject>(_fakeDriver); Assert.That(proxy, Is.InstanceOf <PopgTestObject>()); }