public async Task Expect <TModel>(TModel model) where TModel : class
        {
            var id     = ExtractIdFromObject(model);
            var actual = await ProjectionsStore.LoadAsync <TModel>(id);

            var diff = ObjectComparer.FindDifferences(model, actual);

            if (!string.IsNullOrEmpty(diff))
            {
                throw new AssertionException(diff);
            }
        }
Exemple #2
0
        public static string FindDifferences(object expected, object actual)
        {
            var compare = new ObjectComparer
            {
                MaxDifferences = 10
            };

            if (compare.Compare(expected, actual))
            {
                return(null);
            }

            return(compare.DifferencesString
                   .Trim('\r', '\n')
                   .Replace("object1", "expected")
                   .Replace("object2", "actual"));
        }