コード例 #1
0
        public void HashEntity_Error_CustomPropertyRemoved()
        {
            var entity = new Entity
            {
                Properties = new Dictionary <string, List <dynamic> >
                {
                    { Graph.Metadata.Constants.Resource.HasResourceDefintion, new List <dynamic> {
                          "<p>def</p>"
                      } },
                }
            };
            ISet <string> ignoredKeys = new HashSet <string> {
                Graph.Metadata.Constants.Resource.HasResourceDefintion
            };

            Assert.Throws <MissingPropertiesException>(() => _hasher.Hash(entity, ignoredKeys));
        }
コード例 #2
0
        public void HashEntity_Sample_Resource_Should_Result_In_Expected_Hash()
        {
            var entity = JsonConvert.DeserializeObject <Entity>(ResourceSample());

            const string expectedSha256Hash = "e0de7b31ccc6cdcf1480771d340e6b539f404fea5dbf17c636af5467711d4cbd";
            var          resultHash         = _hasher.Hash(entity);

            Assert.Equal(expectedSha256Hash, resultHash);
        }