public void SetTimeRange_Should_Throw_InvalidEndTimeException_When_Set_InvalidEndTime() { var existPlan = new FlashSalePlan( id: Guid.NewGuid(), tenantId: null, storeId: Guid.NewGuid(), beginTime: DateTime.Now, endTime: DateTime.Now.AddSeconds(1), productId: Guid.NewGuid(), productSkuId: Guid.NewGuid(), isPublished: true ); Assert.Throws <InvalidEndTimeException>(() => existPlan.SetTimeRange(DateTime.Now, DateTime.Now.AddMinutes(-1))); }
public void SetTimeRange() { var existPlan = new FlashSalePlan( id: Guid.NewGuid(), tenantId: null, storeId: Guid.NewGuid(), beginTime: DateTime.Now, endTime: DateTime.Now.AddSeconds(1), productId: Guid.NewGuid(), productSkuId: Guid.NewGuid(), isPublished: true ); var newBeginTime = DateTime.Now; var newEndTime = newBeginTime.AddMinutes(1); existPlan.SetTimeRange(newBeginTime, newEndTime); existPlan.BeginTime.ShouldBe(newBeginTime); existPlan.EndTime.ShouldBe(newEndTime); }