Skip to content

Commit abbd27d

Browse files
author
maximv
committed
fixing things on CI
1 parent f2df3e4 commit abbd27d

File tree

4 files changed

+36
-24
lines changed

4 files changed

+36
-24
lines changed

docs/DryIoc.Docs/SpecifyDependencyAndPrimitiveValues.cs

+5-4
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ [Test] public void Example_via_strongly_typed_spec_and_direct_argument_spec()
365365
{
366366
var c = new Container();
367367

368-
c.Register<Foo>(Made.Of(() => new Foo(Arg.Index<string>(0)), _ => "someString"));
368+
c.Register<Foo>(Made.Of(() => new Foo(Arg.Index<string>(0)), _ => "my string"));
369369

370370
Assert.AreEqual("my string", c.Resolve<Foo>().Name);
371371
}
@@ -375,7 +375,7 @@ [Test] public void Example_via_RegisterDelegate()
375375
{
376376
var c = new Container();
377377

378-
c.RegisterDelegate<Foo>(() => new Foo("someString"));
378+
c.RegisterDelegate<Foo>(() => new Foo("my string"));
379379

380380
Assert.AreEqual("my string", c.Resolve<Foo>().Name);
381381
}
@@ -438,12 +438,13 @@ class Injecting_the_custom_value_with_condition_setup
438438
[Test] public void Example()
439439
{
440440
var container = new Container();
441+
container.Register<IBigFish, Tuna>();
441442

442443
container.Register<ILogger, FileLogger>(
443-
setup: Setup.With(condition: request => request.Parent.ServiceType.IsAssignableTo(typeof(ISmallFish))));
444+
setup: Setup.With(condition: request => request.Parent.ServiceType.IsAssignableTo<ISmallFish>()));
444445

445446
container.Register<ILogger, DbLogger>(
446-
setup: Setup.With(condition: request => request.Parent.ServiceType.IsAssignableTo(typeof(IBigFish))));
447+
setup: Setup.With(condition: request => request.Parent.ServiceType.IsAssignableTo<IBigFish>()));
447448

448449
var fish = container.Resolve<IBigFish>();
449450
Assert.IsInstanceOf<DbLogger>((fish as Tuna).Logger);

docs/DryIoc.Docs/SpecifyDependencyAndPrimitiveValues.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ class Injecting_the_value_of_a_primitive_type
356356
{
357357
var c = new Container();
358358

359-
c.Register<Foo>(Made.Of(() => new Foo(Arg.Index<string>(0)), _ => "someString"));
359+
c.Register<Foo>(Made.Of(() => new Foo(Arg.Index<string>(0)), _ => "my string"));
360360

361361
Assert.AreEqual("my string", c.Resolve<Foo>().Name);
362362
}
@@ -366,7 +366,7 @@ class Injecting_the_value_of_a_primitive_type
366366
{
367367
var c = new Container();
368368

369-
c.RegisterDelegate<Foo>(() => new Foo("someString"));
369+
c.RegisterDelegate<Foo>(() => new Foo("my string"));
370370

371371
Assert.AreEqual("my string", c.Resolve<Foo>().Name);
372372
}
@@ -427,12 +427,13 @@ class Injecting_the_custom_value_with_condition_setup
427427
[Test] public void Example()
428428
{
429429
var container = new Container();
430+
container.Register<IBigFish, Tuna>();
430431

431432
container.Register<ILogger, FileLogger>(
432-
setup: Setup.With(condition: request => request.Parent.ServiceType.IsAssignableTo(typeof(ISmallFish))));
433+
setup: Setup.With(condition: request => request.Parent.ServiceType.IsAssignableTo<ISmallFish>()));
433434

434435
container.Register<ILogger, DbLogger>(
435-
setup: Setup.With(condition: request => request.Parent.ServiceType.IsAssignableTo(typeof(IBigFish))));
436+
setup: Setup.With(condition: request => request.Parent.ServiceType.IsAssignableTo<IBigFish>()));
436437

437438
var fish = container.Resolve<IBigFish>();
438439
Assert.IsInstanceOf<DbLogger>((fish as Tuna).Logger);

docs/DryIoc.Docs/ThreadSafety.cs

+13-8
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,35 @@
2121
The above guaranties are possible because of the Container data-structure.
2222
In a pseudo code and simplifying things a lot the DryIoc Container may be represented as following:
2323
```cs md*/
24+
//md{ usings ...
2425
using System;
2526
using System.Linq.Expressions;
2627
using System.Threading.Tasks;
2728
using NUnit.Framework;
2829
using ImTools;
2930
using DryIoc;
31+
#pragma warning disable CS0649
3032
// ReSharper disable UnusedVariable
33+
//md}
3134

3235
class Oversimplified_container
3336
{
34-
class Ref<T> { T Value; } // represents CAS (compare-and-swap) box for the referenced value
37+
class Ref<T> { public T Value; } // represents the CAS (compare-and-swap) box for the referenced value
3538

3639
class Container
3740
{
38-
Ref<Registry> registry;
41+
public Ref<Registry> Registry;
3942
}
4043

4144
class Registry
4245
{
43-
ImHashMap<object, Expression<Func<Container, object>>> registrations;
44-
Ref<ResolutionCache> resolutionCache;
46+
public ImHashMap<object, Expression<Func<Container, object>>> Registrations;
47+
public Ref<ResolutionCache> ResolutionCache;
4548
}
4649

4750
class ResolutionCache
4851
{
49-
ImHashMap<object, Func<Container, object>> cache;
52+
public ImHashMap<object, Func<Container, object>> Cache;
5053
}
5154
}
5255
/*md
@@ -71,9 +74,11 @@ [Test] public void Example()
7174

7275
container.Register<A>(Reuse.Singleton);
7376

74-
Task.Run(() => container.Resolve<A>());
75-
Task.Run(() => container.Resolve<A>());
76-
Task.Run(() => container.Resolve<A>());
77+
Task.WaitAll(
78+
Task.Run(() => container.Resolve<A>()),
79+
Task.Run(() => container.Resolve<A>()),
80+
Task.Run(() => container.Resolve<A>())
81+
);
7782

7883
Assert.AreEqual(1, A.InstanceCount);
7984
}

docs/DryIoc.Docs/ThreadSafety.md

+13-8
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,35 @@ DryIoc ensures that:
2020
The above guaranties are possible because of the Container data-structure.
2121
In a pseudo code and simplifying things a lot the DryIoc Container may be represented as following:
2222
```cs
23+
//md{ usings ...
2324
using System;
2425
using System.Linq.Expressions;
2526
using System.Threading.Tasks;
2627
using NUnit.Framework;
2728
using ImTools;
2829
using DryIoc;
30+
#pragma warning disable CS0649
2931
// ReSharper disable UnusedVariable
32+
//md}
3033
3134
class Oversimplified_container
3235
{
33-
class Ref<T> { T Value; } // represents CAS (compare-and-swap) box for the referenced value
36+
class Ref<T> { public T Value; } // represents the CAS (compare-and-swap) box for the referenced value
3437
3538
class Container
3639
{
37-
Ref<Registry> registry;
40+
public Ref<Registry> Registry;
3841
}
3942

4043
class Registry
4144
{
42-
ImHashMap<object, Expression<Func<Container, object>>> registrations;
43-
Ref<ResolutionCache> resolutionCache;
45+
public ImHashMap<object, Expression<Func<Container, object>>> Registrations;
46+
public Ref<ResolutionCache> ResolutionCache;
4447
}
4548

4649
class ResolutionCache
4750
{
48-
ImHashMap<object, Func<Container, object>> cache;
51+
public ImHashMap<object, Func<Container, object>> Cache;
4952
}
5053
}
5154
```
@@ -69,9 +72,11 @@ class Resolving_singleton_in_parallel
6972

7073
container.Register<A>(Reuse.Singleton);
7174

72-
Task.Run(() => container.Resolve<A>());
73-
Task.Run(() => container.Resolve<A>());
74-
Task.Run(() => container.Resolve<A>());
75+
Task.WaitAll(
76+
Task.Run(() => container.Resolve<A>()),
77+
Task.Run(() => container.Resolve<A>()),
78+
Task.Run(() => container.Resolve<A>())
79+
);
7580

7681
Assert.AreEqual(1, A.InstanceCount);
7782
}

0 commit comments

Comments
 (0)