public void AddResource_AddADuplicateResourcePath_ShouldReturnHandle() { var resourceManager = new ResourceManager(); var fileInfo = new FileInfo ("c:/this/is/a/test"); var fileInfoDuplicate = new FileInfo ("c:/this/is/a/test"); var handle = resourceManager.AddResource (fileInfo); var count = resourceManager.ResourceCount; Assert.That (resourceManager.AddResource (fileInfoDuplicate), Is.EqualTo (handle)); Assert.That (count, Is.EqualTo (resourceManager.ResourceCount)); }
public void GetResource_GetByValidHandle_ShouldSucceed() { var resourceManager = new ResourceManager(); var resourceHandle = resourceManager.AddResource (new FileInfo ("c:/this/is/a/test")); Assert.That (() => resourceManager.GetResource (resourceHandle), Throws.Nothing); }
public void RemoveResource_RemoveByValidHandle_ShouldSucceed() { var resourceManager = new ResourceManager(); var count = resourceManager.ResourceCount; var resourceHandle = resourceManager.AddResource (new FileInfo ("c:/this/is/a/test")); Assert.That (() => resourceManager.RemoveResource (resourceHandle), Throws.Nothing); Assert.That (count, Is.EqualTo (resourceManager.ResourceCount)); }
public void AddResource_AddAResource_ShouldSucceed() { var resourceManager = new ResourceManager(); Assert.That (() => resourceManager.AddResource (new FileInfo ("c:/this/is/a/test")), Is.InstanceOf<ResourceHandle>()); Assert.That (() => resourceManager.AddResource (new DirectoryInfo ("c:/this/is/a/test/dir")), Is.InstanceOf<ResourceHandle>()); }