public void TestDeleteValueFromHttpContext() { // arrange this.InitialTestHttpContext(); using (var httpContextLifetimeManger = new HttpContextLifetimeManager<TestingController>()) { var testingController = new TestingController(); // act httpContextLifetimeManger.SetValue(testingController); httpContextLifetimeManger.RemoveValue(); object controllerFromHttpContext = httpContextLifetimeManger.GetValue(); // assert Assert.Null(controllerFromHttpContext); } }
public void TestDeleteValueFromHttpContext() { // arrange this.InitialTestHttpContext(); using (var httpContextLifetimeManger = new HttpContextLifetimeManager <TestingController>()) { var testingController = new TestingController(); // act httpContextLifetimeManger.SetValue(testingController); httpContextLifetimeManger.RemoveValue(); object controllerFromHttpContext = httpContextLifetimeManger.GetValue(); // assert Assert.Null(controllerFromHttpContext); } }
public void TestSetValueAndSetValueFromHttpContext() { // arrange this.InitialTestHttpContext(); using (var httpContextLifetimeManger = new HttpContextLifetimeManager<TestingController>()) { var testingController = new TestingController(); // act httpContextLifetimeManger.SetValue(testingController); object controllerFromHttpContext = httpContextLifetimeManger.GetValue(); // assert Assert.NotNull(controllerFromHttpContext); Assert.IsType<TestingController>(controllerFromHttpContext); Assert.Same(testingController, controllerFromHttpContext); } }
public void TestSetValueAndSetValueFromHttpContext() { // arrange this.InitialTestHttpContext(); using (var httpContextLifetimeManger = new HttpContextLifetimeManager <TestingController>()) { var testingController = new TestingController(); // act httpContextLifetimeManger.SetValue(testingController); object controllerFromHttpContext = httpContextLifetimeManger.GetValue(); // assert Assert.NotNull(controllerFromHttpContext); Assert.IsType <TestingController>(controllerFromHttpContext); Assert.Same(testingController, controllerFromHttpContext); } }