public void Test_AutoPerson_MyScopedObjectOne_Two_Scopes() { var myScopedObjectOne_scope1 = ServiceScopeOne.GetService <MyScopedObjectOne>(); myScopedObjectOne_scope1.SingletonPerson.ShouldNotBeNull(); var myScopedObjectOne_scope2 = ServiceScopeTwo.GetService <MyScopedObjectOne>(); myScopedObjectOne_scope2.SingletonPerson.ShouldNotBeNull(); myScopedObjectOne_scope1.SingletonPerson.ShouldBe(myScopedObjectOne_scope2.SingletonPerson); }
public void Test_Simple_MyScopedObjectOne_Two_Scopes() { var myScopedObjectOne_scope1 = ServiceScopeOne.GetService <MyScopedObjectOne>(); var myScopedObjectTwo_scope1 = ServiceScopeOne.GetService <MyScopedObjectTwo>(); myScopedObjectOne_scope1.SingletonName = Guid.NewGuid().ToString(); myScopedObjectOne_scope1.SingletonName.ShouldBe(myScopedObjectTwo_scope1.SingletonName); var myScopedObjectOne_scope2 = ServiceScopeTwo.GetService <MyScopedObjectOne>(); var myScopedObjectTwo_scope2 = ServiceScopeTwo.GetService <MyScopedObjectTwo>(); myScopedObjectOne_scope1.SingletonName.ShouldBe(myScopedObjectOne_scope2.SingletonName); myScopedObjectOne_scope1.SingletonName.ShouldBe(myScopedObjectTwo_scope2.SingletonName); }
public void Test_New_AutoPerson_MyScopedObjectOne_Two_Scopes() { var myScopedObjectOne_scope1 = ServiceScopeOne.GetService <MyScopedObjectOne>(); myScopedObjectOne_scope1.SingletonPerson.ShouldNotBeNull(); var myScopedObjectOne_scope2 = ServiceScopeTwo.GetService <MyScopedObjectOne>(); myScopedObjectOne_scope2.SingletonPerson.ShouldNotBeNull(); myScopedObjectOne_scope1.SingletonPerson.ShouldBe(myScopedObjectOne_scope2.SingletonPerson); myScopedObjectOne_scope1.SingletonPerson = new Person() { Name = Guid.NewGuid().ToString() }; myScopedObjectOne_scope1.SingletonPerson.ShouldBe(myScopedObjectOne_scope2.SingletonPerson); }