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); }
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); }
public void GetPocoAdapterForGenericObjects() { // Arrange var factory = new AdapterFactory(); //Act: var adapter = factory.Create(new PocoModel(), typeof(PocoModel)); // Assert Assert.Equal(typeof(PocoAdapter), adapter.GetType()); }
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()); }
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()); }
public void GetDynamicAdapterForGenericObjects() { // Arrange AdapterFactory factory = new AdapterFactory(); //Act: IAdapter adapter = factory.Create(new TestDynamicObject(), new DefaultContractResolver()); // Assert Assert.Equal(typeof(DynamicObjectAdapter), adapter.GetType()); }
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()); }
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()); }
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); }
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); }
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); }
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); }
protected override IAdapter <CustomizedPropertyShouldModel> Finish(CustomizedPropertyShouldModel model) { return(_result.Create(model)); }