Exemple #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}'.");
        }
Exemple #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}'.");
        }
Exemple #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}'.");
        }
Exemple #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.");
        }
Exemple #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.");
        }
Exemple #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();
        }
Exemple #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();
        }