Esempio n. 1
0
        public void Create_WhenTokenIssuedSuccessEvent_WillReturnTokenIssuedSuccessEventAdapter()
        {
            // Arrange
            var authResponse = new AuthorizeResponse()
            {
                Request = new ValidatedAuthorizeRequest()
                {
                    Client  = new Client(),
                    Subject = new ClaimsPrincipal(new ClaimsIdentity(new List <Claim>()
                    {
                        new Claim(JwtClaimTypes.Subject, string.Empty)
                    }))
                }
            };

            var evt = new TokenIssuedSuccessEvent(authResponse);

            var sut = new AdapterFactory();

            // Act
            var adapter = sut.Create(evt);

            // Assert
            Assert.IsType <TokenIssuedSuccessEventAdapter>(adapter);
        }
Esempio n. 2
0
    public static InterfaceT ToInterface <InterfaceT>(object target) where InterfaceT : class
    {
        var i = target as InterfaceT;

        if (i == null)
        {
            i = AdapterFactory <InterfaceT> .Create(target);
        }
        return(i);
    }
Esempio n. 3
0
        public void GetPocoAdapterForGenericObjects()
        {
            // Arrange
            var factory = new AdapterFactory();

            //Act:
            var adapter = factory.Create(new PocoModel(), typeof(PocoModel));

            // Assert
            Assert.Equal(typeof(PocoAdapter), adapter.GetType());
        }
Esempio n. 4
0
        public void GetDictionaryAdapterForDictionaryObjects()
        {
            // Arrange
            var factory = new AdapterFactory();

            //Act:
            var adapter = factory.Create(new Dictionary <string, string>(), typeof(Dictionary <string, string>));

            // Assert
            Assert.Equal(typeof(DictionaryAdapter <string, string>), adapter.GetType());
        }
Esempio n. 5
0
        public void GetListAdapterForListTargets()
        {
            // Arrange
            var factory = new AdapterFactory();

            //Act:
            var adapter = factory.Create(new List <string>(), typeof(List <string>));

            // Assert
            Assert.Equal(typeof(ListAdapter), adapter.GetType());
        }
Esempio n. 6
0
        public void GetDynamicAdapterForGenericObjects()
        {
            // Arrange
            AdapterFactory factory = new AdapterFactory();

            //Act:
            IAdapter adapter = factory.Create(new TestDynamicObject(), new DefaultContractResolver());

            // Assert
            Assert.Equal(typeof(DynamicObjectAdapter), adapter.GetType());
        }
Esempio n. 7
0
        public void GetDictionaryAdapterForDictionaryObjects()
        {
            // Arrange
            AdapterFactory factory = new AdapterFactory();

            //Act:
            IAdapter adapter = factory.Create(new Dictionary <string, string>(), new DefaultContractResolver());

            // Assert
            Assert.Equal(typeof(DictionaryAdapter <string, string>), adapter.GetType());
        }
Esempio n. 8
0
        public void GetListAdapterForListTargets()
        {
            // Arrange
            AdapterFactory factory = new AdapterFactory();

            //Act:
            IAdapter adapter = factory.Create(new List <string>(), new DefaultContractResolver());

            // Assert
            Assert.Equal(typeof(ListAdapter), adapter.GetType());
        }
Esempio n. 9
0
        public void Create_WhenUserLogoutSuccessEvent_WillReturnUserLogoutSuccessAdapter()
        {
            // Arrange
            var evt = new UserLogoutSuccessEvent(string.Empty, string.Empty);

            var sut = new AdapterFactory();

            // Act
            var adapter = sut.Create(evt);

            // Assert
            Assert.IsType <UserLogoutSuccessEventAdapter>(adapter);
        }
Esempio n. 10
0
        public void Create_WhenConsentGrantedEvent_WillReturnConsentGrantedEventAdapter()
        {
            // Arrange
            var evt = new ConsentGrantedEvent(string.Empty, string.Empty, new List <string>(), new List <string>(), false);

            var sut = new AdapterFactory();

            // Act
            var adapter = sut.Create(evt);

            // Assert
            Assert.IsType <ConsentGrantedEventAdapter>(adapter);
        }
Esempio n. 11
0
        public void Create_WhenGrantsRevokedEvent_WillReturnGrantsRevokedAdapter()
        {
            // Arrange
            var evt = new GrantsRevokedEvent(string.Empty, string.Empty);

            var sut = new AdapterFactory();

            // Act
            var adapter = sut.Create(evt);

            // Assert
            Assert.IsType <GrantsRevokedEventAdapter>(adapter);
        }
Esempio n. 12
0
        public void Create_WhenConsentDeniedEvent_WillReturnConsentDeniedAdapter()
        {
            // Arrange
            var evt = new ConsentDeniedEvent(string.Empty, string.Empty, new string[] { });

            var sut = new AdapterFactory();

            // Act
            var adapter = sut.Create(evt);

            // Assert
            Assert.IsType <ConsentDeniedEventAdapter>(adapter);
        }
Esempio n. 13
0
 protected override IAdapter <CustomizedPropertyShouldModel> Finish(CustomizedPropertyShouldModel model)
 {
     return(_result.Create(model));
 }