public void TestValuesAreCreated() { SessionStateBindingStrategy strategy = new SessionStateBindingStrategy(); MockBuilderContext builderContext = new MockBuilderContext(strategy); MockSessionStateLocatorService sessionLocator = new MockSessionStateLocatorService(); builderContext.Locator.Add(new DependencyResolutionLocatorKey(typeof (ISessionStateLocatorService), null), sessionLocator); SampleClass sample = new SampleClass(); sample.String0 = "test"; strategy.BuildUp(builderContext, typeof (SampleClass), sample, null); Assert.AreEqual("test", sample.String0); Assert.IsNotNull(sample.String1); Assert.IsNotNull(sample.String2); }
public void ValuesArePulledFromSession() { SessionStateBindingStrategy strategy = new SessionStateBindingStrategy(); MockBuilderContext builderContext = new MockBuilderContext(strategy); MockSessionStateLocatorService sessionLocator = new MockSessionStateLocatorService(); sessionLocator.SessionState["key"] = "value"; builderContext.Locator.Add(new DependencyResolutionLocatorKey(typeof (ISessionStateLocatorService), null), sessionLocator); SampleClass sample = new SampleClass(); strategy.BuildUp(builderContext, typeof (SampleClass), sample, null); Assert.AreEqual("value", sample.String2.Value); }