コード例 #1
0
        public void ActorInterfaceDescription_CreateThrowsArgumentException_WhenTypeIsNotAnActorInterface()
        {
            // Arrange
            Type type = typeof(ICloneable);

            // Act
            Action action = () => ActorInterfaceDescription.Create(type);

            // Assert
            action.Should().ThrowExactly <ArgumentException>()
            .WithMessage("The type 'System.ICloneable' is not an actor interface as it does not derive from the interface 'Dapr.Actors.IActor'.*")
            .And.ParamName.Should().Be("actorInterfaceType");
        }
コード例 #2
0
        public void ActorInterfaceDescription_CreateThrowsArgumentException_WhenActorInterfaceInheritsNonActorInterfaces()
        {
            // Arrange
            Type type = typeof(IClonableActor);

            // Act
            Action action = () => ActorInterfaceDescription.Create(type);

            // Assert
            action.Should().ThrowExactly <ArgumentException>()
            .WithMessage("The type '*+IClonableActor' is not an actor interface as it derive from a non actor interface 'System.ICloneable'. All actor interfaces must derive from 'Dapr.Actors.IActor'.*")
            .And.ParamName.Should().Be("actorInterfaceType");
        }
コード例 #3
0
        public void ActorInterfaceDescription_CreateThrowsArgumentException_WhenTypeIsNotAnInterface()
        {
            // Arrange
            Type type = typeof(object);

            // Act
            Action action = () => ActorInterfaceDescription.Create(type);

            // Assert
            action.Should().ThrowExactly <ArgumentException>()
            .WithMessage("The type 'System.Object' is not an Actor interface as it is not an interface.*")
            .And.ParamName.Should().Be("actorInterfaceType");
        }
コード例 #4
0
        public void ActorInterfaceDescription_CreateUsingCRCIdActorInterfaceDescription()
        {
            // Arrange
            Type type = typeof(ITestActor);

            // Act
            var description = ActorInterfaceDescription.CreateUsingCRCId(type);

            // Assert
            description.Should().NotBeNull();

            using var _ = new AssertionScope();
            description.InterfaceType.Should().Be(type);
            description.Id.Should().Be(-934188464);
            description.V1Id.Should().NotBe(0);
            description.Methods.Should().HaveCount(2);
        }