コード例 #1
0
        public void Invoke_collection_deserializer()
        {
            //Arrange
            var converter = new CustomCollectionJsonConverter();

            //Act
            bool   shouldTrue = converter.CanConvert(ListScopes.GetType());
            string response   = JsonConvert.SerializeObject(ListScopes, Formatting.Indented, converter);

            //Assert
            Assert.Throws <NotImplementedException>(() => JsonConvert.DeserializeObject <List <Model.Security> >(response, converter));
        }
コード例 #2
0
        public void Validate_types_available_collection_converter()
        {
            //Arrange
            var converter = new CustomCollectionJsonConverter();

            //Act
            bool shouldFalse = converter.CanConvert(ListScopes[0].GetType());
            bool shouldTrue  = converter.CanConvert(ListScopes.GetType());

            //Assert
            Assert.True(shouldTrue);
            Assert.False(shouldFalse);
        }
コード例 #3
0
        public void Invoke_collection_serializer()
        {
            //Arrange
            var converter = new CustomCollectionJsonConverter();

            //Act
            bool   shouldTrue = converter.CanConvert(ListScopes.GetType());
            string response   = JsonConvert.SerializeObject(ListScopes, Formatting.Indented, converter);

            //Assert
            Assert.True(shouldTrue);
            Assert.NotEmpty(response);
            Assert.All(ListScopes, item => response.Contains(item.Key));
        }