public void Test_Registry_ShouldReturnSingletonRegistry() { //---------------Set up test pack------------------- //---------------Assert Precondition---------------- BODefaultValueRegistry registry = BODefaultValueRegistry.Instance; //---------------Test Result ----------------------- Assert.IsNotNull(registry); }
public void Test_SetRegistry_WithNull_ShouldReturnNewSingleton() { //---------------Set up test pack------------------- //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- BODefaultValueRegistry.Instance = null; BODefaultValueRegistry boDefaultValueRegistry = BODefaultValueRegistry.Instance; //---------------Test Result ----------------------- Assert.IsNotNull(boDefaultValueRegistry); }
public void Test_Registry_WhenCallTwice_ShouldReturnSameSingletonRegistry() { //---------------Set up test pack------------------- //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- BODefaultValueRegistry origRegistry = BODefaultValueRegistry.Instance; BODefaultValueRegistry registry = BODefaultValueRegistry.Instance; //---------------Test Result ----------------------- Assert.AreSame(origRegistry, registry); }
public void Test_IsRegister_WhenNotRegistered_ShouldReturnFalse() { //---------------Set up test pack------------------- const string methodName = "fdsafasdfasd"; BODefaultValueRegistry registry = new BODefaultValueRegistry(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- bool isRegistered = registry.IsRegistered(methodName); //---------------Test Result ----------------------- Assert.IsFalse(isRegistered); }
public void Test_Register_WithValue_ResolveShouldReturn() { //---------------Set up test pack------------------- const string methodName = "fdsafasdfasd"; const string expectedDefaultValue = "fdfasdfasd"; BODefaultValueRegistry registry = new BODefaultValueRegistry(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- registry.Register(methodName, expectedDefaultValue); object defaultValue = registry.Resolve(methodName); //---------------Test Result ----------------------- Assert.AreSame(expectedDefaultValue, defaultValue); }
public void Test_IsRegister_WhenRegistered_ShouldReturnTrue() { //---------------Set up test pack------------------- const string methodName = "fdsafasdfasd"; const string expectedDefaultValue = "fdfasdfasd"; BODefaultValueRegistry registry = new BODefaultValueRegistry(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- registry.Register(methodName, expectedDefaultValue); bool isRegistered = registry.IsRegistered(methodName); //---------------Test Result ----------------------- Assert.IsTrue(isRegistered); }