コード例 #1
0
        void TestConvertReturnsSingleResponseAsIsForSubTypedResponse()
        {
            SubTypedQueryResponse testResponse = new SubTypedQueryResponse();

            QueryResponse?result = TestSubject.Convert(testResponse);

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

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

            Assert.True(!result.Any());
        }
コード例 #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]);
        }
コード例 #4
0
        void TestConvertThrowsExceptionForResponseOfDifferentListType()
        {
            List <QueryResponseFromInterface> testResponse = new List <QueryResponseFromInterface>();

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

            Assert.Throws <ArgumentException>(() => TestSubject.Convert(testResponse));
        }
コード例 #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]);
        }
コード例 #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]);
        }
コード例 #7
0
        void TestConvertThrowsExceptionForResponseOfDifferentArrayType()
        {
            IQueryResponseInterface[] testResponse =
            {
                new QueryResponseFromInterface()
                {
                }
            };

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