Exemple #1
0
        public void LoggableEntity_SetsId()
        {
            Int64 expected = model.Id;
            Int64 actual   = new LoggableEntity(entry).Id();

            Assert.Equal(expected, actual);
        }
Exemple #2
0
        public void LoggableEntity_SetsName()
        {
            String actual   = new LoggableEntity(entry).Name;
            String expected = nameof(Role);

            Assert.Equal(expected, actual);
        }
Exemple #3
0
        public void ToString_Modified_Changes()
        {
            model.Title += "Test";
            entry.State  = EntityState.Modified;

            String actual   = new LoggableEntity(entry).ToString();
            String expected = $"Title: \"{model.Title[..^4]}\" => \"{model.Title}\"\n";
Exemple #4
0
        public void LoggableEntity_SetsAction()
        {
            entry.State = EntityState.Deleted;

            String expected = nameof(EntityState.Deleted);
            String actual   = new LoggableEntity(entry).Action;

            Assert.Equal(expected, actual);
        }
Exemple #5
0
        public void ToString_Added_Changes()
        {
            entry.State = EntityState.Added;

            String actual   = new LoggableEntity(entry).ToString();
            String expected = $"CreationDate: \"{model.CreationDate}\"\nTitle: \"{model.Title}\"\n";

            Assert.Equal(expected, actual);
        }
Exemple #6
0
        public void LoggableEntity_Proxy_SetsName()
        {
            model = context.Set <Role>().Single();
            entry = context.ChangeTracker.Entries <AModel>().Single();

            String actual   = new LoggableEntity(entry).Name;
            String expected = nameof(Role);

            Assert.IsAssignableFrom <IProxyTargetAccessor>(model);
            Assert.Equal(expected, actual);
        }