예제 #1
0
파일: OwnedTests.cs 프로젝트: jrjohn/Grace
        public void SimpleDisposableTest()
        {
            Owned<IDisposableService> owned = new Owned<IDisposableService>();
            DisposableService disposableService = new DisposableService();
            bool eventFired = false;

            disposableService.Disposing += (sender, args) => eventFired = true;

            owned.SetValue(disposableService);

            Assert.True(ReferenceEquals(owned.Value, disposableService));

            owned.Dispose();

            Assert.True(eventFired);
        }
예제 #2
0
파일: OwnedTests.cs 프로젝트: jrjohn/Grace
        public void SimpleNonDisposableTest()
        {
            Owned<IBasicService> owned = new Owned<IBasicService>();
            BasicService basicService = new BasicService();

            owned.SetValue(basicService);

            Assert.True(ReferenceEquals(owned.Value, basicService));

            owned.Dispose();
        }