void TestConvertReturnsSingleResponseAsIsForSubTypedResponse()
        {
            SubTypedQueryResponse testResponse = new SubTypedQueryResponse();

            QueryResponse?result = TestSubject.Convert(testResponse);

            Assert.Equal(testResponse, result);
        }
Exemple #2
0
        void TestConvertReturnsEmptyListForResponseOfDifferentListTypeIfTheListIsEmpty()
        {
            List <IQueryResponseInterface> testResponse = new List <IQueryResponseInterface>();

            List <QueryResponse>?result = TestSubject.Convert(testResponse);

            Assert.True(!result.Any());
        }
Exemple #3
0
        void TestConvertReturnsListOnResponseOfSubTypedArrayType()
        {
            SubTypedQueryResponse[] testResponse = new SubTypedQueryResponse[] { new SubTypedQueryResponse() };

            List <QueryResponse>?result = TestSubject.Convert(testResponse);

            Assert.Equal(testResponse.Length, result?.Count);
            Assert.Equal(testResponse[0], result?[0]);
        }
Exemple #4
0
        void TestConvertThrowsExceptionForResponseOfDifferentListType()
        {
            List <QueryResponseFromInterface> testResponse = new List <QueryResponseFromInterface>();

            testResponse.Add(new QueryResponseFromInterface()
            {
            });

            Assert.Throws <ArgumentException>(() => TestSubject.Convert(testResponse));
        }
Exemple #5
0
        void TestConvertReturnsListOnResponseOfSetType()
        {
            HashSet <QueryResponse> testResponse = new HashSet <QueryResponse>();

            testResponse.Add(new QueryResponse());

            List <QueryResponse>?result = TestSubject.Convert(testResponse);

            Assert.Equal(testResponse.Count, result?.Count);
            Assert.Equal(testResponse.First(), result?[0]);
        }
Exemple #6
0
        void TestConvertReturnsListOnResponseOfSubTypedListType()
        {
            List <SubTypedQueryResponse> testResponse = new List <SubTypedQueryResponse>();

            testResponse.Add(new SubTypedQueryResponse());

            List <QueryResponse>?result = TestSubject.Convert(testResponse);

            Assert.Equal(testResponse.Count, result?.Count);
            Assert.Equal(testResponse[0], result?[0]);
        }
Exemple #7
0
        void TestConvertThrowsExceptionForResponseOfDifferentArrayType()
        {
            IQueryResponseInterface[] testResponse =
            {
                new QueryResponseFromInterface()
                {
                }
            };

            Assert.Throws <ArgumentException>(() => TestSubject.Convert(testResponse));
        }
 void TestConvertThrowsClassCastExceptionForMultipleInstanceResponse()
 {
     Assert.Throws <InvalidCastException>(() => {
         QueryResponse?convert = TestSubject.Convert(new QueryResponse[] {});
     });
 }
 void TestConvertThrowsClassCastExceptionForDifferentSingleInstanceResponse()
 {
     Assert.Throws <InvalidCastException>(() => {
         QueryResponse?convert = TestSubject.Convert(new QueryResponseFromInterface());
     });
 }
Exemple #10
0
 protected override void Act()
 {
     _actualFilters = TestSubject.Convert(new ClaimsAuthorizationSegment[0]);
 }
Exemple #11
0
 protected override void Act()
 {
     // Execute code under test
     _actualFilters = TestSubject.Convert(
         Supplied <IReadOnlyList <ClaimsAuthorizationSegment> >());
 }
Exemple #12
0
 void TestConvertThrowsExceptionForSingleInstanceResponse()
 {
     Assert.Throws <ArgumentException>(() => TestSubject.Convert(new QueryResponse()));
 }