public void AccurateForSingleCarpet() { //e181f408-3f56-40d8-9149-d12a06aeea18 9 20 70 1400 $4,251.46 //grade 9 //1 room, 1 carpet, at 100 per hour of labor should be 100m labor float expectedPriceResult = (float)((4251.46m + 100m) * 1.4m); string[] expectedCarpetIdArray = { "e181f408-3f56-40d8-9149-d12a06aeea18" }; IQuote lowestQuote = _joust.GetQuote(new int[] { 1000, 1, 100, 9 }); Assert.Equal(4251.46f, lowestQuote.MaterialCost); Assert.Equal(100f, lowestQuote.LaborCost); Assert.Equal(expectedPriceResult, lowestQuote.Price); Assert.Equal(expectedCarpetIdArray, lowestQuote.RollOrders); }
public void ReturnsNullIfNoneAvalibleInATimelyManner() { Type joustInterfaceType = typeof(IJoust); Type joust = Assembly.Load(new AssemblyName("DotNetCore.Joust")).GetTypes() .FirstOrDefault(type => joustInterfaceType.IsAssignableFrom(type) && type != joustInterfaceType); var timer = System.Diagnostics.Stopwatch.StartNew(); IJoust speedTest = (IJoust)Activator.CreateInstance(joust); IQuote lowestQuote = speedTest.GetQuote(new int[] { int.MaxValue, 100, 100, 1 }); timer.Stop(); Assert.True(timer.Elapsed.TotalMinutes < 1); Assert.Null(lowestQuote); }
public void ThrowErrorGivenANullArgument() { Assert.ThrowsAny <Exception>(() => _joust.GetQuote(null)); }
public void ShouldErrorIfGradeIsLessThanOne() { Assert.ThrowsAny <Exception>(() => _joust.GetQuote(new int[] { 1000, 1, 1, 0 })); }