Inheritance: IFooService
コード例 #1
0
ファイル: ServiceActorTests.cs プロジェクト: kkkaroth/tomato
        public async Task BaseServiceProcessCallTest()
        {
            ISerializer serializer = new JsonSerializer();
            var         fooService = new FooService();

            Assert.Equal("100.0", fooService.Id);


            var req = new FooReq {
                FooWord = "hello Tomato"
            };

            var context1 = new MockContext();

            var reqMessage = AmpMessage.CreateRequestMessage(100, 2);

            reqMessage.Version   = 1;
            reqMessage.CodecType = CodecType.JSON;
            reqMessage.Sequence  = 1;
            reqMessage.Data      = serializer.Serialize(req);

            await fooService.ReceiveAsync(context1, reqMessage);

            Assert.NotNull(context1.ResponseMessage);
            Assert.Equal(0, context1.ResponseMessage.Code);

            Assert.NotNull(context1.ResponseMessage.Data);

            var res = serializer.Deserialize <FooRes>(context1.ResponseMessage.Data);

            Assert.NotNull(res);

            Assert.Equal(req.FooWord, res.RetFooWord);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var service = new FooService();
            var result  = service.Bar();

            System.Console.WriteLine(result.b);
        }
コード例 #3
0
        public void insert_then_get()
        {
            using (ServiceContainer _container = new ServiceContainer())
            {
                FooService fooService = _container.GetInstance <FooService>();

                Foo foo = new Foo()
                {
                    Name           = "Tom Chen",
                    Birthday_Title = DateTime.Now,
                    Address        = "Beijing"
                };

                FooDTO fooDTO = Mapper.Map <FooDTO>(foo);

                var baseObj = fooService.Insert(fooDTO);

                var aa = fooService.GetById(baseObj.Id);

                Assert.AreEqual(baseObj.Id, aa.Id);
                Assert.AreEqual(baseObj.BirthDayTitle, aa.BirthDayTitle);
                Assert.AreEqual(baseObj.Name, aa.Name);
                Assert.AreEqual(baseObj.Address_title, aa.Address_title);

                List <int> ids = new List <int>()
                {
                    1, 2, 3, 4, 5, 6
                };
                var bb = fooService.GetByIds(ids);
            }
        }
コード例 #4
0
 public async Task TestFailThirdTrySmallTimeout()
 {
     var fooService = new FooService();
     await AssertEx.WaitUntil(() => fooService.GetFooAsync())
     .WithTimeout(TimeSpan.FromMilliseconds(1))
     .IsTrue(f => f.Bar == "bar" && f.TryCount == 3);
 }
コード例 #5
0
        public void Reset_Should_Replace_Default()
        {
            var defaultCount      = new InstanceCounter();
            var simpleLazyFactory = SimpleLazyFactory <IFooService> .CreateForTest();

            var defaultFunc = simpleLazyFactory.Default(() => new FooService(defaultCount)).Resolve;

            var instanceCount = new InstanceCounter();
            var theOne        = new FooService(instanceCount);
            var resetFunc     = simpleLazyFactory.Reset(() => theOne).Resolve;

            var fooService  = defaultFunc();
            var fooService2 = resetFunc();

            fooService.ShouldEqual(fooService2);

            for (int i = 0; i < 10; i++)
            {
                defaultFunc();
            }

            for (int i = 0; i < 10; i++)
            {
                resetFunc();
            }

            defaultCount.TotalCount.ShouldEqual(0);
            instanceCount.TotalCount.ShouldEqual(1);
        }
コード例 #6
0
        public void TestEnsureFooIsReturned()
        {
            var    fooService = new FooService();
            string foo        = fooService.GetFoo();

            Assert.Equal("Foo! Foo!", foo);
        }
コード例 #7
0
        public async Task <Option <IEnumerable <LogRecord> > > GetLogsFromFooService()
        {
            FooService fooService = new FooService(_logger);

            var logResult = await fooService.GenerateMockLogs();

            return(Option <IEnumerable <LogRecord> > .ToOption(logResult?.Value));
        }
コード例 #8
0
    static void Main(string[] args)
    {
        var request    = "request";
        var fooService = new FooService();

        ServiceProxy.Invoke(r => fooService.DoFoo(request), "abc");
        Console.Read();
    }
コード例 #9
0
    static void Main(string[] args)
    {
        var request    = "request";
        var fooService = new FooService();

        ServiceProxy.Invoke(fooService.DoFoo, "abc");     // lose the DoFoo parameter.
        Console.Read();
    }
コード例 #10
0
 //Note the new parameter here:                vvvvvvvvvvvvvvvvvvvvv
 public async Task Invoke(HttpContext context, FooService fooService)
 {
     context.Response.OnStarting(() =>
     {
         var fooCount = fooService.Foos.Count;
         return(Task.CompletedTask);
     });
     await _next(context);
 }
コード例 #11
0
    public void An_ArgumentException_is_raised()
    {
      // arrange
      var repo = new FooRepository();
      var service = new FooService(repo);

      // act
      service.Execute(Guid.Empty);
    }
コード例 #12
0
        public void Bar_returns_value_tuple_correctly()
        {
            var sut = new FooService();

            var actual = sut.Bar();

            Assert.AreEqual(1, actual.a);
            Assert.AreEqual("Hello ValueTuple", actual.b);
        }
コード例 #13
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, FooService service)
        {
            if (env.IsDevelopment())
            {
                Console.WriteLine("We're in dev mode");
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                routes.MapRoute(
                    name: "AllGames",
                    template: "games/all",
                    defaults: new { Controller = "Pages", Action = "Games" }
                    );

                routes.MapRoute(
                    name: "AllMovies",
                    template: "movies/all",
                    defaults: new { Controller = "Pages", Action = "Movies" }
                    );
            });

            // app.Run(async (context) =>
            // {
            //     var names = service.GetNames();
            //     StringBuilder builder = new StringBuilder();
            //     foreach (var name in names)
            //     {
            //         if (Configuration.GetValue<bool>("CapitalizedWords"))
            //         {
            //             builder.Append(name.ToUpper() + " ");
            //         }
            //         else
            //         {
            //             builder.Append(name + " ");

            //         }
            //     }
            //     await context.Response.WriteAsync(builder.ToString());
            // });
        }
コード例 #14
0
    public void GetAllCustomers()
    {
        var _foo = new FooService();

        customerEntity[] customers = _foo.getCustomerList;
        foreach (customerEntity customer in customers)
        {
            GetSingleCustomer(customer);
        }
    }
コード例 #15
0
        public void Static_Resolve_Default_Should_Call_Once()
        {
            for (int i = 0; i < 3; i++)
            {
                var fooService = FooService.Resolve();
                fooService.Counter.TotalCount.ShouldEqual(1);
            }

            FooService.Resolve.ShouldEqual(SimpleLazyFactory <IFooService> .Instance.Resolve);
        }
コード例 #16
0
        public void Invoke_With_SyncCompletingHandler()
        {
            var service = new FooService();

            var    called = 0;
            String arg    = null;

            var subscription = service.Changed.Subscribe(
                async x => {
                arg = x;
                called++;
            }
                );

            Check.That(subscription)
            .IsInstanceOf <FuncSubscription <String> >();

            Check.That(((FuncSubscription <String>)subscription).TestingGetPreviousSubscription())
            .IsNull();

            Check.That(((FuncSubscription <String>)subscription).Target)
            .IsNotNull();

            Check.That(((FuncSubscription <String>)subscription).Method)
            .IsNotNull();

            var flag1 = service.Do("abc");

            Check.That(flag1)
            .IsTrue();

            Check.That(called)
            .IsEqualTo(1);

            Check.That(arg)
            .IsEqualTo("abc");

            called = 0;
            var flag2 = service.Do("def");

            Check.That(flag2)
            .IsTrue();

            Check.That(called)
            .IsEqualTo(1);

            Check.That(arg)
            .IsEqualTo("def");

            Check.That(service.ChangedSource.NumberOfSubscriptions)
            .IsEqualTo(1);

            Check.That(service.ChangedSource.IsDisposed)
            .IsFalse();
        }
コード例 #17
0
        public Application(ILogger <Application> logger
                           , FooService fooService
                           , BarService barService
                           , BazService bazService)
        {
            _logger = logger;

            _fooService = fooService;
            _barService = barService;
            _bazService = bazService;
        }
コード例 #18
0
        public async Task Invoke_With_HandlerThrowingException_BeforeAwait()
        {
            var service = new FooService();

            var    called = 0;
            String arg    = null;

            var subscription = service.Changed.SubscribeWeak(
                async x => {
                arg = x;
                called++;

                if (called == 1)
                {
                    throw new ApplicationException();
                }

                await Task.Yield();
            }
                );

            Check.That(subscription)
            .IsInstanceOf <FuncSubscription <String> >();

            Check.That(((FuncSubscription <String>)subscription).TestingGetPreviousSubscription())
            .IsInstanceOf <WeakSubscription <String> >();

            Exception exception = null;

            using (EventSystem.UnobservedException.SubscribeWeak(
                       x => Volatile.Write(ref exception, x)
                       ))
            {
                var flag1 = await service.DoAsync("abc");

                Check.That(flag1)
                .IsTrue();

                Check.That(called)
                .IsEqualTo(1);

                Check.That(arg)
                .IsEqualTo("abc");

                Check.That(Volatile.Read(ref exception))
                .IsInstanceOf <ApplicationException>();

                Check.That(service.ChangedSource.NumberOfSubscriptions)
                .IsEqualTo(1);

                Check.That(service.ChangedSource.IsDisposed)
                .IsFalse();
            }
        }
コード例 #19
0
        [Test]         // bug #81886
        public void FaultTest()
        {
            IPEndPoint localEP = new IPEndPoint(IPAddress.Loopback, 5000);

            using (SocketResponder sr = new SocketResponder(localEP, s => FaultResponse_Qualified(s))) {
                FooService service = new FooService();
                service.Url = "http://" + IPAddress.Loopback.ToString() + ":5000/";
                try {
                    service.Run();
                    Assert.Fail("#A1");
                } catch (SoapException ex) {
                    Assert.AreEqual("Mono Web Service", ex.Actor, "#A2");
                    Assert.AreEqual(SoapException.ServerFaultCode, ex.Code, "#A3");
                    Assert.IsNotNull(ex.Detail, "#A4");
                    Assert.AreEqual("detail", ex.Detail.LocalName, "#A5");
                    Assert.AreEqual("http://schemas.xmlsoap.org/soap/envelope/", ex.Detail.NamespaceURI, "#A6");

                    XmlNamespaceManager nsMgr = new XmlNamespaceManager(ex.Detail.OwnerDocument.NameTable);
                    nsMgr.AddNamespace("se", "http://www.mono-project/System");

                    XmlElement systemError = (XmlElement)ex.Detail.SelectSingleNode(
                        "se:systemerror", nsMgr);
                    Assert.IsNotNull(systemError, "#A7");
                    Assert.IsNull(ex.InnerException, "#A8");
                    Assert.AreEqual("Failure processing request.", ex.Message, "#A9");
                }
                service.Dispose();
            }

            using (SocketResponder sr = new SocketResponder(localEP, s => FaultResponse_Unqualified(s))) {
                FooService service = new FooService();
                service.Url = "http://" + IPAddress.Loopback.ToString() + ":5000/";
                try {
                    service.Run();
                    Assert.Fail("#B1");
                } catch (SoapException ex) {
                    Assert.AreEqual("Mono Web Service", ex.Actor, "#B2");
                    Assert.AreEqual(SoapException.ServerFaultCode, ex.Code, "#B3");
                    Assert.IsNotNull(ex.Detail, "#B4");
                    Assert.AreEqual("detail", ex.Detail.LocalName, "#B5");
                    Assert.AreEqual(string.Empty, ex.Detail.NamespaceURI, "#B6");

                    XmlNamespaceManager nsMgr = new XmlNamespaceManager(ex.Detail.OwnerDocument.NameTable);
                    nsMgr.AddNamespace("se", "http://www.mono-project/System");

                    XmlElement systemError = (XmlElement)ex.Detail.SelectSingleNode(
                        "se:systemerror", nsMgr);
                    Assert.IsNotNull(systemError, "#B7");
                    Assert.IsNull(ex.InnerException, "#B8");
                    Assert.AreEqual("Failure processing request.", ex.Message, "#B9");
                }
                service.Dispose();
            }
        }
コード例 #20
0
 public void TestMethod2()
 {
     using (ServiceContainer _container = new ServiceContainer())
     {
         Mock <BaseObjRepository> mock = new Mock <BaseObjRepository>();
         mock.Setup(p => p.GetObj(It.IsAny <int>())).Returns(new Obj());
         _container.Register <BaseObjRepository>(factory => mock.Object);
         _container.Register <FooService>();
         FooService fooService = _container.GetInstance <FooService>();
     }
 }
コード例 #21
0
 public AsyncInterceptorSampleService(
     IApplicationLifetime appLifetime,
     ApplicationDbContext dbContext,
     ILogger <AsyncInterceptorSampleService> logger,
     FooService service)
 {
     this.appLifetime = appLifetime;
     this.dbContext   = dbContext;
     this.logger      = logger;
     fooService       = service;
 }
    public void A_new_instance_is_created()
    {
      // arrange
      var repository = new FooRepository();

      // act
      var service = new FooService(repository);

      // assert
      Assert.IsInstanceOf<FooService>(service);
    }
コード例 #23
0
    public ServiceProvider()
    {
        var fooService = new FooService();
        var barService = new BarService();

        Handlers = new Dictionary <Type, Action <object> >
        {
            { typeof(FooRequestA), request => fooService.ProcessA((FooRequestA)request) },
            { typeof(FooRequestB), request => fooService.ProcessB((FooRequestB)request) },
            { typeof(BarRequest), request => barService.Process((BarRequest)request) }
        };
    }
コード例 #24
0
        public async Task TestWaitAll()
        {
            var fooService = new FooService();

            await Task.WhenAll(
                AssertEx.WaitUntil(() => fooService.GetFooAsync())
                .IsTrue(f => f.Bar == "bar"),
                AssertEx.WaitUntil(() => fooService.GetFooAsync())
                .IsTrue(f => f.Bar == "bar"));

            AssertEx.IsTrue(() => fooService.TryCount == 2);
        }
コード例 #25
0
		[Test] // bug #81886
		public void FaultTest ()
		{
			IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 5000);
			using (SocketResponder sr = new SocketResponder (localEP, s => FaultResponse_Qualified (s))) {
				FooService service = new FooService ();
				service.Url = "http://" + IPAddress.Loopback.ToString () + ":5000/";
				try {
					service.Run ();
					Assert.Fail ("#A1");
				} catch (SoapException ex) {
					Assert.AreEqual ("Mono Web Service", ex.Actor, "#A2");
					Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#A3");
					Assert.IsNotNull (ex.Detail, "#A4");
					Assert.AreEqual ("detail", ex.Detail.LocalName, "#A5");
					Assert.AreEqual ("http://schemas.xmlsoap.org/soap/envelope/", ex.Detail.NamespaceURI, "#A6");

					XmlNamespaceManager nsMgr = new XmlNamespaceManager (ex.Detail.OwnerDocument.NameTable);
					nsMgr.AddNamespace ("se", "http://www.mono-project/System");

					XmlElement systemError = (XmlElement) ex.Detail.SelectSingleNode (
						"se:systemerror", nsMgr);
					Assert.IsNotNull (systemError, "#A7");
					Assert.IsNull (ex.InnerException, "#A8");
					Assert.AreEqual ("Failure processing request.", ex.Message, "#A9");
				}
				service.Dispose ();
			}

			using (SocketResponder sr = new SocketResponder (localEP, s => FaultResponse_Unqualified (s))) {
				FooService service = new FooService ();
				service.Url = "http://" + IPAddress.Loopback.ToString () + ":5000/";
				try {
					service.Run ();
					Assert.Fail ("#B1");
				} catch (SoapException ex) {
					Assert.AreEqual ("Mono Web Service", ex.Actor, "#B2");
					Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#B3");
					Assert.IsNotNull (ex.Detail, "#B4");
					Assert.AreEqual ("detail", ex.Detail.LocalName, "#B5");
					Assert.AreEqual (string.Empty, ex.Detail.NamespaceURI, "#B6");

					XmlNamespaceManager nsMgr = new XmlNamespaceManager (ex.Detail.OwnerDocument.NameTable);
					nsMgr.AddNamespace ("se", "http://www.mono-project/System");

					XmlElement systemError = (XmlElement) ex.Detail.SelectSingleNode (
						"se:systemerror", nsMgr);
					Assert.IsNotNull (systemError, "#B7");
					Assert.IsNull (ex.InnerException, "#B8");
					Assert.AreEqual ("Failure processing request.", ex.Message, "#B9");
				}
				service.Dispose ();
			}
		}
コード例 #26
0
        public void Invoke_With_HandlerThrowingException_AfterAwait()
        {
            var service = new FooService();

            var    called = 0;
            String arg    = null;

            var subscription = service.Changed.Subscribe(
                async x => {
                arg = x;
                called++;
                await Task.Delay(10);

                throw new ApplicationException();
            }
                );

            Check.That(subscription)
            .IsInstanceOf <FuncSubscription <String> >();

            Check.That(((FuncSubscription <String>)subscription).TestingGetPreviousSubscription())
            .IsNull();

            Exception exception = null;

            using (EventSystem.UnobservedException.SubscribeWeak(
                       x => Volatile.Write(ref exception, x)
                       ))
            {
                var flag1 = service.Do("abc");

                Check.That(flag1)
                .IsTrue();

                Check.That(called)
                .IsEqualTo(1);

                Check.That(arg)
                .IsEqualTo("abc");

                SpinWait.SpinUntil(() => Volatile.Read(ref exception) != null, 2000);

                Check.That(Volatile.Read(ref exception))
                .IsInstanceOf <ApplicationException>();

                Check.That(service.ChangedSource.NumberOfSubscriptions)
                .IsEqualTo(1);

                Check.That(service.ChangedSource.IsDisposed)
                .IsFalse();
            }
        }
コード例 #27
0
        public async Task Invoke_With_AlreadyCanceledHandler()
        {
            var service = new FooService();

            var    called = 0;
            String arg    = null;

            var subscription = service.Changed.SubscribeWeak(
                x => {
                arg = x;
                called++;
                var cts = new CancellationTokenSource();
                cts.Cancel();

                return(Task.FromCanceled(cts.Token));
            }
                );

            Check.That(subscription)
            .IsInstanceOf <FuncSubscription <String> >();

            Check.That(((FuncSubscription <String>)subscription).TestingGetPreviousSubscription())
            .IsInstanceOf <WeakSubscription <String> >();

            Exception exception = null;

            using (EventSystem.UnobservedException.SubscribeWeak(
                       x => Volatile.Write(ref exception, x)
                       ))
            {
                var flag1 = await service.DoAsync("abc");

                Check.That(flag1)
                .IsTrue();

                Check.That(called)
                .IsEqualTo(1);

                Check.That(arg)
                .IsEqualTo("abc");

                Check.That(Volatile.Read(ref exception))
                .IsNull();

                Check.That(service.ChangedSource.NumberOfSubscriptions)
                .IsEqualTo(1);

                Check.That(service.ChangedSource.IsDisposed)
                .IsFalse();
            }
        }
コード例 #28
0
        void serialized_Type_can_be_used_as_parameter_to_a_generic_function()
        {
            string stringType = typeof(TestClass).FullName ?? throw new InvalidOperationException();
            var    type       = Type.GetType(stringType);
            var    jsonString = GetTestObjectString();

            IFooService component = new FooService();

            dynamic actual = JsonSerializer.Deserialize(jsonString, type);

            var result = component.UseGeneric(actual);

            Assert.True(result == 0);
        }
コード例 #29
0
    public NewService(AuditableService <T> auditableService, FooService <T> fooService)
    {
        if (auditableService == null)
        {
            throw new ArgumentNullException("auditableService ");
        }

        if (fooService == null)
        {
            throw new ArgumentNullException("fooService");
        }
        _auditableService = auditableService;
        _fooService       = fooService;
    }
コード例 #30
0
		[Test] // bug #79988
		public void OutParametersTest ()
		{
			IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 5000);
			using (SocketResponder sr = new SocketResponder (localEP, s => OutParametersResponse (s))) {
				FooService service = new FooService ();
				service.Url = "http://" + IPAddress.Loopback.ToString () + ":5000/";

				int a;
				bool b;
				Elem [] e = service.Req ("x", out a, out b);
				Assert.IsNull (e, "#A1");
				Assert.AreEqual (0, a, "#A2");
				Assert.IsFalse (b, "#A3");
				service.Dispose ();
			}
		}
コード例 #31
0
 private void GracefulException()
 {
     try
     {
         var foo = new FooService();
         foo.DangerousApi();
     }
     catch (Exception ex)
     {
         _logger.Report(ex, new Dictionary <string, string>
         {
             { "loggerType", _logger.GetType().Name }
         });
         Messages.Add($"{ex.GetType().Name}: {ex.Message}");
     }
 }
コード例 #32
0
        public MainViewModel()
        {
            fooService   = new FooService();
            ClearCommand = new RelayCommand(() =>
            {
                this.Foos.Clear();
                this.GroupedFoos.Clear();
            });

            AboutCommand = new RelayCommand(() =>
            {
                var navigationService = ServiceLocator.Current.GetInstance <NavigationService>();

                navigationService.Navigate(typeof(AboutPage), null);
            });
        }
コード例 #33
0
ファイル: test.cs プロジェクト: mono/gert
	static void Main ()
	{
		IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 5000);
		using (SocketResponder sr = new SocketResponder (localEP, new SocketRequestHandler (Response_Bug79988))) {
			sr.Start ();

			FooService service = new FooService ();
			service.Url = "http://" + IPAddress.Loopback.ToString () + ":5000/";

			int a;
			bool b;
			Elem [] e = service.Req ("x", out a, out b);
			Assert.IsNull (e, "#A1");
			Assert.AreEqual (0, a, "#A2");
			Assert.IsFalse (b, "#A3");
		}
	}
コード例 #34
0
        [Test]         // bug #79988
        public void OutParametersTest()
        {
            IPEndPoint localEP = new IPEndPoint(IPAddress.Loopback, 5000);

            using (SocketResponder sr = new SocketResponder(localEP, s => OutParametersResponse(s))) {
                FooService service = new FooService();
                service.Url = "http://" + IPAddress.Loopback.ToString() + ":5000/";

                int     a;
                bool    b;
                Elem [] e = service.Req("x", out a, out b);
                Assert.IsNull(e, "#A1");
                Assert.AreEqual(0, a, "#A2");
                Assert.IsFalse(b, "#A3");
                service.Dispose();
            }
        }
コード例 #35
0
ファイル: test.cs プロジェクト: mono/gert
	static void Main ()
	{
		IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 5000);
		using (SocketResponder sr = new SocketResponder (localEP, new SocketRequestHandler (Response_Bug80131))) {
			sr.Start ();

			FooService service = new FooService ();
			service.Url = "http://" + sr.LocalEndPoint.Address.ToString () + ":5000/";

			int a;
			bool b;
			Elem [] e = service.Req ("x", out a, out b);
			Assert.IsNotNull (e, "#B1");
			Assert.AreEqual (1, e.Length, "#B2");
			Assert.AreEqual ("whatever", e [0].attr, "#B2");
			Assert.AreEqual (5, a, "#B3");
			Assert.IsTrue (b, "#B4");
		}
	}
コード例 #36
0
        public void Invoke_With_AsyncCompletingHandler()
        {
            var service = new FooService();

            var    called = 0;
            String arg    = null;

            var subscription = service.Changed.SubscribeWeak(
                async x => {
                await Task.Delay(100);
                arg = x;
                called++;
            }
                );

            Check.That(subscription)
            .IsInstanceOf <FuncSubscription <String> >();

            Check.That(((FuncSubscription <String>)subscription).TestingGetPreviousSubscription())
            .IsInstanceOf <WeakSubscription <String> >();

            var flag1 = service.Do("abc");

            Check.That(flag1)
            .IsTrue();

            Check.That(called)
            .IsEqualTo(0);

            SpinWait.SpinUntil(() => called == 1, 2000);

            Check.That(called)
            .IsEqualTo(1);

            Check.That(arg)
            .IsEqualTo("abc");

            Check.That(service.ChangedSource.NumberOfSubscriptions)
            .IsEqualTo(1);

            Check.That(service.ChangedSource.IsDisposed)
            .IsFalse();
        }
コード例 #37
0
 public void An_ArgumentNullException_is_raised()
 {
   // act
   var service = new FooService(null);
 }