public void VerifyDiscountCalculation(decimal totalAmount, decimal expectedAmountAfterDiscount, int timeHour) { DateTimeOffsetWrapper.SetDateTimeOffset(new DateTimeOffset(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, timeHour, 0, 0, new TimeSpan(5, 30, 0))); DiscountService service = new DiscountService(); decimal result = service.CalculateDiscount(totalAmount); Assert.Equal(expectedAmountAfterDiscount, result); }
public void Initialize( ) { var dateTimeOffset = DateTimeOffset.Parse("2007-10-02T13:02:03.0000000-07:30"); _broadcastTime = new DateTimeOffsetWrapper(dateTimeOffset); _comparer = new DeviceComparer( ); }
public void Initialize( ) { _factory = TestFactory; _broadcastTime = new DateTimeOffsetWrapper( ).Now; _address = 254682828386071; _name = "Name"; _rawSignalStrengthInDBm = -50; }
public void Can_convert_max_DateTimeOffset() { var dto = new DateTimeOffsetWrapper { DateTimeOffset = DateTimeOffset.MaxValue, }; var json = JsonSerializer.SerializeToString(dto, typeof(DateTimeOffsetWrapper)); var fromJson = JsonSerializer.DeserializeFromString <DateTimeOffsetWrapper>(json); Assert.That(fromJson.DateTimeOffset, Is.EqualTo(dto.DateTimeOffset)); }