public void Filtering_DateTime_Marge() { //arrange SMSProvider smsProvider = new SMSProvider(); Storage storage = new Storage(smsProvider); MessageFilteringParams messageFilteringParams = new MessageFilteringParams(); messageFilteringParams.SelectedUser = ""; messageFilteringParams.UsersSortOptions = SortOptions.AND; messageFilteringParams.MessageText = ""; messageFilteringParams.MessageTextSortOptions = SortOptions.AND; messageFilteringParams.FromDate = new DateTime(1994, 3, 14, 10, 14, 23); messageFilteringParams.BeforeDate = new DateTime(1996, 3, 14, 10, 14, 23); messageFilteringParams.FormattingOptions = "None"; var expected = new Message() { User = "******", Text = "You have no idea what it's like, being married to you.", ReceivingTime = new DateTime(1995, 3, 14, 10, 14, 23) }; //act var user = storage.GetMessages(messageFilteringParams).First(); //assert Assert.IsTrue(expected.User == user.User); Assert.IsTrue(expected.Text == user.Text); Assert.IsTrue(expected.ReceivingTime == user.ReceivingTime); }
public void Filtering_Remove_Removed() { //arrange SMSProvider smsProvider = new SMSProvider(); Storage storage = new Storage(smsProvider); MessageFilteringParams messageFilteringParams = new MessageFilteringParams(); messageFilteringParams.SelectedUser = "******"; messageFilteringParams.UsersSortOptions = SortOptions.AND; messageFilteringParams.MessageText = "You have no idea what"; messageFilteringParams.MessageTextSortOptions = SortOptions.AND; messageFilteringParams.FromDate = DateTime.MinValue; messageFilteringParams.BeforeDate = DateTime.MaxValue; messageFilteringParams.FormattingOptions = "None"; var expected = new Message() { User = "******", Text = "You have no idea what it's like, being married to you.", ReceivingTime = new DateTime(1995, 3, 14, 10, 14, 23) }; //act storage.Remove(expected); var user = storage.GetMessages(messageFilteringParams); //assert Assert.IsTrue(user.Count() == 0); }
public void Filtering_Message_Boring() { //arrange SMSProvider smsProvider = new SMSProvider(); Storage storage = new Storage(smsProvider); MessageFilteringParams messageFilteringParams = new MessageFilteringParams(); messageFilteringParams.SelectedUser = ""; messageFilteringParams.UsersSortOptions = SortOptions.AND; messageFilteringParams.MessageText = "Boring"; messageFilteringParams.MessageTextSortOptions = SortOptions.AND; messageFilteringParams.FromDate = DateTime.MinValue; messageFilteringParams.BeforeDate = DateTime.MaxValue; messageFilteringParams.FormattingOptions = "None"; var expected = new Message() { User = "******", Text = "Boring!", ReceivingTime = new DateTime(1996, 3, 14, 10, 14, 23) }; //act var user = storage.GetMessages(messageFilteringParams).First(); //assert Assert.IsTrue(expected.User == user.User); Assert.IsTrue(expected.Text == user.Text); Assert.IsTrue(expected.ReceivingTime == user.ReceivingTime); }
public void Filtering_Add_Added() { //arrange SMSProvider smsProvider = new SMSProvider(); Storage storage = new Storage(smsProvider); MessageFilteringParams messageFilteringParams = new MessageFilteringParams(); messageFilteringParams.SelectedUser = "******"; messageFilteringParams.UsersSortOptions = SortOptions.AND; messageFilteringParams.MessageText = "Hi"; messageFilteringParams.MessageTextSortOptions = SortOptions.AND; messageFilteringParams.FromDate = DateTime.MinValue; messageFilteringParams.BeforeDate = DateTime.MaxValue; messageFilteringParams.FormattingOptions = "None"; var expected = new Message() { User = "******", Text = "Hi", ReceivingTime = new DateTime(2021, 3, 14, 10, 14, 23) }; //act smsProvider.RaiseSMSReceivedEvent(expected); var user = storage.GetMessages(messageFilteringParams).First(); //assert Assert.IsTrue(expected.User == user.User); Assert.IsTrue(expected.Text == user.Text); Assert.IsTrue(expected.ReceivingTime == user.ReceivingTime); }