public void Start_ArgsNull_Should_Ex() { AssertHelper.ShouldThrows <ArgumentNullException>(() => { new SimpleProcessRunner(null); }); }
public void Default_Not_Init_Should_Ex() { AssertHelper.ShouldThrows <Exception>(() => { var simpleLazyFactory = SimpleLazyFactory <IFooService> .CreateForTest(); simpleLazyFactory.Resolve(); }); }
public void Default_Multi_Call_Should_Ex() { AssertHelper.ShouldThrows <Exception>(() => { var defaultCount = new InstanceCounter(); var simpleLazyFactory = SimpleLazyFactory <IFooService> .CreateForTest(); simpleLazyFactory.Default(() => new FooService(defaultCount)); simpleLazyFactory.Default(() => new FooService(defaultCount)); }); }
public void AppendToGroups_GetGroupKeyNull_Should_Throws() { AssertHelper.ShouldThrows <ArgumentNullException>(() => { var delayedGroupCache = new DelayedGroupCache <MockItem>(); delayedGroupCache.AppendToGroups(new List <MockItem>(), null, item => item.CreateAt); }); AssertHelper.ShouldThrows <ArgumentNullException>(() => { var delayedGroupCache = new DelayedGroupCache <MockItem>(); delayedGroupCache.AppendToGroups(new List <MockItem>(), item => item.GroupKey, null); }); }
public void ShapeData_NotExitProperties_Should_FillByArgs() { var instance = Create(); var mockShapeModel = MockShapeModel.Create(); dynamic result = instance.ShapeData(mockShapeModel, "Id,Name,Bar", false); ((object)result).Log(); ((int)result.Id).ShouldEqual(1); ((string)result.Name).ShouldEqual(mockShapeModel.Name); AssertHelper.ShouldThrows <RuntimeBinderException>(() => { var test = result.Bar; }); }
public void Create_GetOrCreate_ArgsNull_Should_Ex() { AssertHelper.ShouldThrows <ArgumentNullException>(() => { var simpleProcessFactory = new SimpleProcessFactory(); simpleProcessFactory.Create(null); }); AssertHelper.ShouldThrows <ArgumentNullException>(() => { var simpleProcessFactory = new SimpleProcessFactory(); simpleProcessFactory.GetOrCreate(null); }); }
public void Create_GetOrCreate_ExePathNull_Should_Ex() { AssertHelper.ShouldThrows <ArgumentException>(() => { var simpleProcessFactory = new SimpleProcessFactory(); simpleProcessFactory.Create(new SimpleProcessInfo() { ProcessName = "Foo", ExePath = "" }); }); AssertHelper.ShouldThrows <ArgumentException>(() => { var simpleProcessFactory = new SimpleProcessFactory(); simpleProcessFactory.GetOrCreate(new SimpleProcessInfo() { ProcessName = "Foo", ExePath = "" }); }); }
public static void ShouldThrows <T>(this Action action) where T : Exception { AssertHelper.ShouldThrows <T>(action); }