Пример #1
0
        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>());
        }
Пример #2
0
        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')"));
        }
Пример #3
0
        public void Generate_GivenTypeAndDriver_InheritsFromPom()
        {
            var proxy = ProxyGenerator.Generate <PopgTestObject>(_fakeDriver);

            Assert.That(proxy.GetType().BaseType, Is.EqualTo(typeof(PopgTestObject)));
        }
Пример #4
0
        public void Generate_GivenTypeAndDriver_GeneratesProxyThatPassesTypeCheck()
        {
            var proxy = ProxyGenerator.Generate <PopgTestObject>(_fakeDriver);

            Assert.That(proxy, Is.InstanceOf <PopgTestObject>());
        }