Exemple #1
0
        public void Create_ForCancellationToken_ReturnsBinder()
        {
            // Arrange
            var provider = new CancellationTokenModelBinderProvider();
            var context  = new TestModelBinderProviderContext(typeof(CancellationToken));

            // Act
            var result = provider.GetBinder(context);

            // Assert
            Assert.IsType <CancellationTokenModelBinder>(result);
        }
Exemple #2
0
        public void Create_ForNonCancellationTokenTypes_ReturnsNull(Type modelType)
        {
            // Arrange
            var provider = new CancellationTokenModelBinderProvider();
            var context  = new TestModelBinderProviderContext(modelType);

            // Act
            var result = provider.GetBinder(context);

            // Assert
            Assert.Null(result);
        }