Exemplo n.º 1
0
        public void TypeIsRegistered_returns_false_if_no_type_in_hierarchy_is_registered()
        {
            // Arrange
            var registry = new ResourceTypeRegistry();

            // Act
            var isRegistered = registry.TypeIsRegistered(typeof(Comment));

            // Assert
            isRegistered.Should().BeFalse();
        }
Exemplo n.º 2
0
        public void TypeIsRegistered_returns_true_if_parent_type_is_registered()
        {
            // Arrange
            var mockPostRegistration = new Mock <IResourceTypeRegistration>(MockBehavior.Strict);

            mockPostRegistration.Setup(m => m.Type).Returns(typeof(Post));
            mockPostRegistration.Setup(m => m.ResourceTypeName).Returns("posts");

            var registry = new ResourceTypeRegistry();

            registry.AddRegistration(mockPostRegistration.Object);

            // Act
            var isRegistered = registry.TypeIsRegistered(typeof(DerivedPost));

            // Assert
            isRegistered.Should().BeTrue();
        }