示例#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();
        }