public void ActionsWithDifferentRecipientsAreDifferent() { //Arrange: Differet list of email var action = new EmailActionApiModel { Parameters = this.CreateSampleParameters() }; var action2 = Clone(action); action2.Parameters["Recipients"] = new List <string> { "*****@*****.**", "*****@*****.**", "*****@*****.**" }; // Assert Assert.NotEqual(action, action2); // Arrange: Different list of email, same length action2.Parameters["Recipients"] = new List <string>() { "*****@*****.**", "*****@*****.**" }; // Assert Assert.NotEqual(action, action2); }
public void EmptyActionsAreEqual() { // Arrange var action = new EmailActionApiModel(); var action2 = new EmailActionApiModel(); // Assert Assert.Equal(action, action2); }
public void ActionsAreEqual_WithParameters() { // Arrange: action with parameters var action = new EmailActionApiModel() { Type = ActionType.Email, Parameters = this.CreateSampleParameters() }; var action2 = Clone(action); // Assert Assert.Equal(action, action2); }
public void ActionsAreEqual_WithNoParameters() { // Arrange: action without parameters var action = new EmailActionApiModel() { Type = ActionType.Email }; var action2 = Clone(action); // Assert Assert.Equal(action, action2); }
public void ActionsWithDifferentKayValuesAreDifferent() { // Arrange: different template var action = new EmailActionApiModel() { Parameters = this.CreateSampleParameters() }; var action2 = Clone(action); action2.Parameters["Notes"] = "Changing note"; // Assert Assert.NotEqual(action, action2); }
public void ActionsWithDifferentKeysAreDifferent() { // Arrange: different number of key-value pairs in Parameters. var action = new EmailActionApiModel() { Parameters = this.CreateSampleParameters() }; var action2 = Clone(action); action2.Parameters.Add("Key1", "Value1"); // Assert Assert.NotEqual(action, action2); }
public void ActionsWithSameRecipientsAreSame() { // Arrange: Same list of email different order. var action = new EmailActionApiModel() { Parameters = this.CreateSampleParameters() }; var action2 = Clone(action); action2.Parameters["Recipients"] = new List <string>() { "*****@*****.**", "*****@*****.**" }; // Assert Assert.Equal(action, action2); }
public void ActionsWithDifferentDataAreDifferent() { // Arrange var action = new EmailActionApiModel() { Type = ActionType.Email, Parameters = this.CreateSampleParameters() }; var action2 = Clone(action); var action3 = Clone(action); action2.Parameters.Add("key1", "x"); action3.Parameters["Notes"] += "sample string"; // Assert Assert.NotEqual(action, action2); Assert.NotEqual(action, action3); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var jsonObject = JObject.Load(reader); var action = default(EmailActionApiModel); var actionType = Enum.Parse( typeof(ActionType), jsonObject.GetValue(TYPE_KEY).Value <string>(), true); switch (actionType) { case ActionType.Email: action = new EmailActionApiModel(); break; } serializer.Populate(jsonObject.CreateReader(), action); return(action); }