Skip to content

Commit

Permalink
tests: Fix Firestore tests broken by xunit
Browse files Browse the repository at this point in the history
  • Loading branch information
amanda-tarafa committed Sep 24, 2024
1 parent 52ceae6 commit c2c5720
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public class ValueComparerTest
public static IEnumerable<object[]> Values => s_valuesInOrder.Select(x => new object[] { x });

// Each group has equal values.
public static TheoryData<dynamic[]> EqualityGroups { get; } = new TheoryData<dynamic[]>
public static TheoryData<IEnumerable<dynamic>> EqualityGroups { get; } = new TheoryData<IEnumerable<dynamic>>
{
new dynamic[] { 0, -0.0, 0.0 },
new dynamic[] { 1, 1.0 },
Expand Down Expand Up @@ -166,7 +166,7 @@ public void Compare_WithSelf(dynamic clrValue)
}

[Theory, MemberData(nameof(EqualityGroups))]
public void Compare_EqualValues(dynamic[] clrValues)
public void Compare_EqualValues(IEnumerable<dynamic> clrValues)
{
var instance = ValueComparer.Instance;
Value[] values = clrValues.Select(d => (Value) ProtoHelpers.CreateValue(d)).ToArray();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017, Google Inc. All rights reserved.
// Copyright 2017, Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,7 @@


using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;

Expand All @@ -22,7 +23,7 @@ namespace Google.Cloud.Firestore.Tests
// Just tests for WriteBatch.ValidateNoPrefixes
public partial class WriteBatchTest
{
public static TheoryData<FieldPath[]> ValidPathSets = new TheoryData<FieldPath[]>
public static TheoryData<IEnumerable<FieldPath>> ValidPathSets = new TheoryData<IEnumerable<FieldPath>>
{
SplitPaths("a", "b"),
SplitPaths("a.b", "b"),
Expand All @@ -32,7 +33,7 @@ public partial class WriteBatchTest
SplitPaths("ab.b", "b"),
};

public static TheoryData<FieldPath[]> InvalidPathSets = new TheoryData<FieldPath[]>
public static TheoryData<IEnumerable<FieldPath>> InvalidPathSets = new TheoryData<IEnumerable<FieldPath>>
{
SplitPaths("a", "a.b"),
SplitPaths("a", "a.b.c"),
Expand All @@ -44,18 +45,18 @@ private static FieldPath[] SplitPaths(params string[] paths) =>

[Theory]
[MemberData(nameof(ValidPathSets))]
public void ValidateNoPrefixes_Valid(FieldPath[] paths)
public void ValidateNoPrefixes_Valid(IEnumerable<FieldPath> paths)
{
WriteBatch.ValidateNoPrefixes(paths);
WriteBatch.ValidateNoPrefixes(paths.Reverse());
}

[Theory]
[MemberData(nameof(InvalidPathSets))]
public void ValidateNoPrefixes_Invalid(FieldPath[] paths)
public void ValidateNoPrefixes_Invalid(IEnumerable<FieldPath> paths)
{
Assert.Throws<ArgumentException>(() => WriteBatch.ValidateNoPrefixes(paths));
Assert.Throws<ArgumentException>(() => WriteBatch.ValidateNoPrefixes(paths.Reverse()));
}
}
}
}

0 comments on commit c2c5720

Please sign in to comment.