예제 #1
0
        public void LoadAssemblyScopedResourceWithPartialNameThroughTypeScopedResourceManagerThrows()
        {
            var sut = ResourceManagerFactory.Create <ResourceManagerFixture>();

            Function(() => sut.LoadString("Stateless.Resources.Resource.txt").Should().Be("This is a resource scoped to an assembly."))
            .Should().Throw <FileNotFoundException>()
            .WithMessage(
                $"Cannot find resource 'Stateless.Resources.Resource.txt' scoped to type '{typeof(ResourceManagerFixture).FullName}' in assembly '{typeof(ResourceManagerFixture).Assembly.FullName}'.");
        }
예제 #2
0
        public void LoadTypeScopedResourceThrowsWhenNotFound()
        {
            var sut = ResourceManagerFactory.Create <ResourceManagerFixture>();

            Function(() => sut.LoadString("Nonexistent.txt"))
            .Should().Throw <FileNotFoundException>()
            .WithMessage(
                $"Cannot find resource 'Nonexistent.txt' scoped to type '{typeof(ResourceManagerFixture).FullName}' in assembly '{typeof(ResourceManagerFixture).Assembly.FullName}'.");
        }
예제 #3
0
        public void LoadAssemblyScopedResourceThrowsWhenNotFound()
        {
            var sut = ResourceManagerFactory.Create(Assembly.GetExecutingAssembly());

            Function(() => sut.LoadString("Stateless.Resources.Unknown.txt"))
            .Should().Throw <FileNotFoundException>()
            .WithMessage(
                $"Cannot find resource 'Stateless.Resources.Unknown.txt' in assembly '{typeof(ResourceManagerFixture).Assembly.FullName}'.");
        }
예제 #4
0
        public void LoadTypeSubScopedResource()
        {
            var sut = ResourceManagerFactory.Create <ResourceManagerFixture>();

            sut.LoadString("Data.Resource.txt").Should().Be("This is a resource sub-scoped to a type.");
        }
예제 #5
0
        public void LoadAssemblyScopedResourceWithPartialNameThroughAssemblyScopedResourceManager()
        {
            var sut = ResourceManagerFactory.Create(Assembly.GetExecutingAssembly());

            sut.LoadString("Stateless.Resources.Resource.txt").Should().Be("This is a resource scoped to an assembly.");
        }
예제 #6
0
        public void LoadAssemblyScopedResourceWithAbsoluteNameThroughTypeScopedResourceManager()
        {
            var sut = ResourceManagerFactory.Create <ResourceManagerFixture>();

            Function(() => sut.LoadString("Be.Stateless.Resources.Resource.txt").Should().Be("This is a resource scoped to an assembly.")).Should().NotThrow();
        }
예제 #7
0
        public void LoadTypeSubScopedResourceWithCompositeName()
        {
            var sut = ResourceManagerFactory.Create <ResourceManagerFixture>();

            sut.LoadString("Data.Resource.Composite.Name.txt").Should().Be("This is a resource with a composite name and sub-scoped to a type.");
        }
        public void LoadAssemblyScopedResourceWithAbsoluteNameThroughAssemblyScopedResourceManager()
        {
            var sut = ResourceManagerFactory.Create(Assembly.GetExecutingAssembly());

            Invoking(() => sut.LoadString("Be.Stateless.Resources.Resource.txt").Should().Be("This is a resource scoped to an assembly.")).Should().NotThrow();
        }