public void Given_A_BillingCompanyAddedOpenClosedWindowEvent_When_The_GuidParameterIsInvalid_ExceptionIsThrown() { //arrange billingCompanyId = Guid.Empty; //act var billingCompanyAddedOpenClosedWindow = new BillingCompanyAddedOpenClosedWindow(startDate, endDate, isOpen, concurrentScrapingLimit, billingCompanyId); //assert // see expected Exception }
public void Given_A_BillingCompanyAddedOpenClosedWindowEvent_When_The_EndDatePastTenseIsInvalid_ExceptionIsThrown() { //arrange ( you should be able to scrape if the window is open ) endDate = endDate.AddDays(-2); //act var billingCompanyAddedOpenClosedWindow = new BillingCompanyAddedOpenClosedWindow(startDate, endDate, isOpen, concurrentScrapingLimit, billingCompanyId); //assert // see expected Exception }
public void Given_A_BillingCompanyAddedOpenClosedWindowEvent_When_The_StartDateIsLessThanEndDateInLowestGranularity_ExceptionIsThrown() { //arrange ( you should be able to scrape if the window is open ) endDate = endDate.AddMilliseconds(2); startDate = startDate.AddMilliseconds(3); //act var billingCompanyAddedOpenClosedWindow = new BillingCompanyAddedOpenClosedWindow(startDate, endDate, isOpen, concurrentScrapingLimit, billingCompanyId); //assert // see expected Exception }
public void Given_A_BillingCompanyAddedOpenClosedWindowEvent_When_The_IsOpenAndScrapingLimitCombinationIsInvalid_ExceptionIsThrown() { //arrange ( you should be able to scrape if the window is open ) isOpen = true; concurrentScrapingLimit = 0; //act var billingCompanyAddedOpenClosedWindow = new BillingCompanyAddedOpenClosedWindow(startDate, endDate, isOpen, concurrentScrapingLimit, billingCompanyId); //assert // see expected Exception }
public void Given_A_BillingCompanyAddedOpenClosedWindowEvent_It_AllValuesAreSerializable() { //arrange //act var billingCompanyAddedOpenClosedWindow = new BillingCompanyAddedOpenClosedWindow(startDate, endDate, isOpen, concurrentScrapingLimit, billingCompanyId); //assert // all properties can be written and read PropertyInfo[] properties = billingCompanyAddedOpenClosedWindow.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (var propertyInfo in properties) { Assert.IsTrue(propertyInfo.CanRead); Assert.IsTrue(propertyInfo.CanWrite); } }
public void Given_A_SerializedBillingCompanyAddedOpenClosedWindowEvent_It_AllValuesAreDeSerializedCorrectly() { //arrange var billingCompanyAddedOpenClosedWindow = new BillingCompanyAddedOpenClosedWindow(startDate, endDate, isOpen, concurrentScrapingLimit, billingCompanyId); var serializedEvent = eventSerializer.SerializeMessage(billingCompanyAddedOpenClosedWindow); //act var deserializedMessage = eventDeSerializer.DeSerializeMessage(serializedEvent); //assert PropertyInfo[] properties = billingCompanyAddedOpenClosedWindow.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (var propertyInfo in properties) { var inValue = GetPropValue(billingCompanyAddedOpenClosedWindow, propertyInfo.Name); var outValue = GetPropValue(deserializedMessage, propertyInfo.Name); Assert.IsTrue(inValue.Equals(outValue),propertyInfo.Name + " does not match"); } }