Esempio n. 1
0
        public void TestCreate()
        {
            var customTypeResolver = new CustomTypeResolver1();

            using (var silo = new InProcessRemotingSilo(customTypeResolver))
            {
                customTypeResolver.GetTypeCalled.Should().Be(0);
                var grain = silo.CreateGrain <IVoidMethodNoParameters>(typeof(AbortsThread).AssemblyQualifiedName);
                customTypeResolver.GetTypeCalled.Should().Be(1, "because the silo should've used the custom type resolver we've specified in the ctor");
            }
        }
Esempio n. 2
0
        public void TestRegisterDefaultImplementation2()
        {
            var customTypeResolver = new CustomTypeResolver1();

            using (var silo = new InProcessSilo(customTypeResolver))
            {
                customTypeResolver.GetTypeCalled.Should().Be(0);
                silo.RegisterDefaultImplementation <IVoidMethodNoParameters>(typeof(AbortsThread).AssemblyQualifiedName);
                customTypeResolver.GetTypeCalled.Should().Be(1, "because the silo should've used the custom type resolver we've specified in the ctor");

                var grain = silo.CreateGrain <IVoidMethodNoParameters>();
                grain.Should().BeOfType <AbortsThread>();
            }
        }
        public void TestCreate()
        {
            var customTypeResolver = new CustomTypeResolver1();

            using (var silo = new OutOfProcessSilo(codeGenerator: new CodeGenerator(customTypeResolver)))
            {
                silo.Start();

                customTypeResolver.GetTypeCalled.Should().Be(0);
                var grain = silo.CreateGrain <IReturnsType>(typeof(ReturnsTypeofString));
                customTypeResolver.GetTypeCalled.Should()
                .Be(0, "because the custom type resolver in this process didn't need to resolve anything yet");

                grain.Do().Should().Be <string>();
                customTypeResolver.GetTypeCalled.Should()
                .Be(1,
                    "Because the custom type resolver in this process should've been used to resolve typeof(string)");
            }
        }